jedis icon indicating copy to clipboard operation
jedis copied to clipboard

Why design returnBrokenResource method?

Open cat-debot opened this issue 12 years ago • 2 comments

I think this api is unnecessary,the code of redis operation in Jedis instance can catch exceptions,and mark the current Jedis instance must be destroied after return to pool,when developer call returnResource method,check the flag we mark before,decide whether or not destroy it.

cat-debot avatar Jun 17 '14 07:06 cat-debot

@lianghaijian Hello. It's Apache commons pool's functionalities, so we expose it.

Btw, during supporting auto closeable Jedis, we already implemented your proposal. Please see https://github.com/xetorthio/jedis/pull/563 for details.

You can feel to return resource with force broken. In this situation, returnBrokenResource will help you. Please note that when you use try-with-resource you can't. (It returns same instance twice, and leads problems.) Hope this helps.

When you are sure with my comment, please close this issue. :)

HeartSaVioR avatar Jun 17 '14 08:06 HeartSaVioR

Thinks.My jedis version is 2.4.2,i have tried the version 2.5.1,it solve my problem.

cat-debot avatar Jun 17 '14 09:06 cat-debot