killme2008 / xmemcached

High performance, easy to use multithreaded memcached client in java.
http://fnil.net/xmemcached
Apache License 2.0
757 stars 280 forks source link

ConfigurationPoller is not stopped when you call net.rubyeye.xmemcached.aws.AWSElasticCacheClient#shutdown #61

Closed mbellani closed 7 years ago

mbellani commented 7 years ago

hello

We have been using xmemcached client for some time in production and it seems to be working pretty well. We recently discovered that when we call shutdown on net.rubyeye.xmemcached.aws.AWSElasticCacheClient it doesn't actually stop the underlying net.rubyeye.xmemcached.aws.ConfigurationPoller's ThreadPoolExecutor. When looking through the code it seems like there are few different ways to approach it

  1. We remove final from net.rubyeye.xmemcached.XMemcachedClient#shutdown and override it in net.rubyeye.xmemcached.aws.AWSElasticCacheClient and call configPoller.shutdown() there. but since i don't fully understand the design decision for making it final i am not sure if that's a good idea.
  2. Another way to do this would be to add following code to net.rubyeye.xmemcached.aws.ConfigurationPoller:
    public void run() {
        if(client.isShutdown()){
            stop();
            return;
        }

Either one will do the trick and i am happy to make the change and open a PR if you like.

Thanks Manish

killme2008 commented 7 years ago

Thanks, it's a bug, i will fix it ASAP.

2017-07-02 0:45 GMT+08:00 Manish Bellani notifications@github.com:

hello

We have been using xmemcached client for some time in production and it seems to be working pretty well. We recently discovered that when we call shutdown on net.rubyeye.xmemcached.aws.AWSElasticCacheClient it doesn't actually stop the underlying net.rubyeye.xmemcached.aws. ConfigurationPoller's ThreadPoolExecutor. When looking through the code it seems like there are few different ways to approach it

  1. We remove final from net.rubyeye.xmemcached. XMemcachedClient#shutdown and override it in net.rubyeye.xmemcached.aws.AWSElasticCacheClient and call configPoller.shutdown() there. but since i don't fully understand the design decision for making it final i am not sure if that's a good idea.
  2. Another way to do this would be to add following code to net.rubyeye.xmemcached.aws.ConfigurationPoller:

    public void run() { if(client.isShutdown()){ stop(); return; }

Either one will do the trick and i am happy to make the change and open a PR if you like.

Thanks Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/killme2008/xmemcached/issues/61, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA3PhX_LcLagyOgLZoQpP7GLpLy7WRmks5sJne7gaJpZM4OLXGw .

-- 庄晓丹 Email: killme2008@gmail.com Site: http://fnil.net

不学习,毋宁死