Do not return Jedis conns to pool after NPE

DATAREDIS-153

- Return conn to pool as broken resource if NPE
occurs (for example if a null key or value is given),
preventing later flush of OutputStream with incomplete
data

- Workaround Jedis issue in pub/sub tests that prevents
subscribing with a pooled connection

- Continue not using pool in conn tests, as they
are too brittle with potentially unclosed pipelines,
unexecuted txs, etc
This commit is contained in:
Jennifer Hickey
2013-08-21 11:07:28 -07:00
parent e1f54d6c68
commit b106f03bd7
3 changed files with 148 additions and 7 deletions

View File

@@ -162,6 +162,10 @@ public class JedisConnection implements RedisConnection {
}
protected DataAccessException convertJedisAccessException(Exception ex) {
if(ex instanceof NullPointerException) {
// An NPE before flush will leave data in the OutputStream of a pooled connection
broken = true;
}
DataAccessException exception = JedisConverters.toDataAccessException(ex);
if (exception instanceof RedisConnectionFailureException) {
broken = true;