Implement Closeable for Jedis, BinaryJedis etc.

This allows a Jedis object to participate in try-with-resources when
using Java 7+. This change is fully backwards compatible to Java 6 and
previous releases of the Jedis client.
This commit is contained in:
Henning Schmiedehausen
2014-02-07 13:39:41 -08:00
parent 51a4bf9a56
commit 7449619fca
3 changed files with 20 additions and 2 deletions

View File

@@ -948,6 +948,12 @@ public class BinaryClient extends Connection {
super.disconnect();
}
@Override
public void close() {
db = 0;
super.close();
}
public void resetState() {
if (isInMulti())
discard();