java.lang.IllegalStateException:在XMemcachedClient.shutdown中正在关闭

时间:2013-08-26 14:43:03

标签: java shutdown xmemcached

我在XMemcached相关代码中遇到异常。任何人都可以帮我解决这个问题吗?非常感谢您的进步!

线程中的异常"线程9" java.lang.IllegalStateException:正在关闭     在java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82)     在java.lang.Runtime.removeShutdownHook(Runtime.java:239)     在com.google.code.yanf4j.core.impl.AbstractController.stop(AbstractController.java:476)     在net.rubyeye.xmemcached.XMemcachedClient.shutdown(XMemcachedClient.java:2482)     at net.rubyeye.xmemcached.XMemcachedClient $ 1.run(XMemcachedClient.java:650) ...更多

    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 个答案:

答案 0 :(得分:0)

这是一个xmencache缺陷。我已经联系了作者并在下一个最新版本中解决了这个问题。