java.lang.IllegalStateException: Shutdown in progress in XMemcachedClient.shutdown

5.2k views Asked by At

I am getting an exception in my XMemcached related code. Can anyone help me to fix this expcetion? Thank you very much for advanced!

Exception in thread "Thread-9" java.lang.IllegalStateException: Shutdown in progress at java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82) at java.lang.Runtime.removeShutdownHook(Runtime.java:239) at com.google.code.yanf4j.core.impl.AbstractController.stop(AbstractController.java:476) at net.rubyeye.xmemcached.XMemcachedClient.shutdown(XMemcachedClient.java:2482) at net.rubyeye.xmemcached.XMemcachedClient$1.run(XMemcachedClient.java:650) ... more

    MemcachedClient client = LowCardinalityMemcachedClientSingleton.getPrimaryClient();
    try {
        if(client.isShutdown() != true){
            client.shutdown();
        } else{
            logger.debug("client already shutdown");
        }
    } catch (IOException e) {
         logger.debug("Shutdown MemcachedClient fail", e);
    }

    long startTime = System.currentTimeMillis();
    long total = 0;
    logger.debug("about to run wait loop");

    while(client.isShutdown() == false || 
            total < 4000){
        long stopTime = System.currentTimeMillis();
         total = stopTime - startTime;
        if(total > 12000){
            logger.debug("breaking because waiting more than 12 seconds");
            break;          
        }
    }


    logger.debug("exiting");
    System.exit(0);
}
1

There are 1 answers

0
super.xiaow On

That is a xmencache defect. I have contacted the author and fixed this in next the newest release.