Return null from SRP exec if watched value modified

DATAREDIS-168
This commit is contained in:
Jennifer Hickey
2013-06-13 22:20:23 -07:00
parent 37e79bafd5
commit 5817e24b9e
5 changed files with 23 additions and 13 deletions

View File

@@ -429,10 +429,11 @@ public class SrpConnection implements RedisConnection {
isMulti = false;
Exception execException = null;
List<Object> results = null;
boolean resultsSet = true;
try {
Future<Boolean> exec = client.exec();
// Need to wait on execution or subsequent non-pipelined calls may read exec results
exec.get();
resultsSet = exec.get();
} catch (Exception ex) {
execException = ex;
} finally {
@@ -447,7 +448,8 @@ public class SrpConnection implements RedisConnection {
}
}
}
if(execException != null) {
// If resultsSet is false, it's b/c of nil Multi-Bulk reply (watch case) and null is returned
if(execException != null && resultsSet) {
// Intentionally convert RedisPipelineException too, it's an impl detail
throw convertSrpAccessException(execException);
}