-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jodis should return jedis resource after using it #166
Comments
JedisResourcePool jedisPool = new RoundRobinJedisPool("zkserver:2181", 30000, "/zk/codis/db_xxx/proxy", new JedisPoolConfig()); After the try block, jodis will rerurn it to pool automaticly |
I have read the code and found no code about However, calling |
https://github.com/xetorthio/jedis/blob/master/src/main/java/redis/clients/jedis/Jedis.java#L3166 jodis will not change the original behavior of JedisPool. |
Thanks @c4pt0r . You're right and I hope you to read this through 😃 The latest version of jedis(currently 3.0.0-SNAPSHOT) has fixed this problem after redis/jedis#909. If we use 3.0.0, we can just
This is merged in March 9th, 2015. Before this day, all the usages without calling You're lucky to get the right result but the current usage is totally wrong. I wanna make sure you know about that. BTW, redis/jedis#562 has rejected to use |
It seems I misunderstand the commit message. The https://github.com/xetorthio/jedis/releases/tag/jedis-2.6.0 has supported TryWithResource syntax and it would be okay to use it after 2.6.0. The problem of 3.0.0 is that we can't use pool to call Thanks for your support @Apache9 😃 |
My pleasure. |
need not return resource? |
Refer to official document redis/jedis#476 , jedis object is not thread-safe and we should return the resource after using it from pool.
This is the proper way to use jedis pool. I think jodis provide the interface to get resource from pool but no way to return the resource.
The text was updated successfully, but these errors were encountered: