add a number of null check to return methods.

This allows calling these methods on error cleanup paths without having
to surround them with if checks all the time.
This commit is contained in:
Henning Schmiedehausen
2014-02-27 10:58:46 -08:00
parent ddb1870a5f
commit 46eef9530b
2 changed files with 14 additions and 6 deletions

View File

@@ -80,11 +80,15 @@ public class JedisPool extends Pool<Jedis> {
}
public void returnBrokenResource(final Jedis resource) {
returnBrokenResourceObject(resource);
if (resource != null) {
returnBrokenResourceObject(resource);
}
}
public void returnResource(final Jedis resource) {
resource.resetState();
returnResourceObject(resource);
if (resource != null) {
resource.resetState();
returnResourceObject(resource);
}
}
}