fixing Issue 188
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
import redis.clients.jedis.exceptions.JedisDataException;
|
||||
|
||||
public class BinaryTransaction extends Queable {
|
||||
protected Client client = null;
|
||||
@@ -28,10 +29,29 @@ public class BinaryTransaction extends Queable {
|
||||
}
|
||||
List<Object> formatted = new ArrayList<Object>();
|
||||
for (Object o : unformatted) {
|
||||
formatted.add(generateResponse(o).get());
|
||||
try{
|
||||
formatted.add(generateResponse(o).get());
|
||||
}catch(JedisDataException e){
|
||||
formatted.add(e);
|
||||
}
|
||||
}
|
||||
return formatted;
|
||||
}
|
||||
|
||||
public List<Response<?>> execGetResponse() {
|
||||
client.exec();
|
||||
client.getAll(1); // Discard all but the last reply
|
||||
|
||||
List<Object> unformatted = client.getObjectMultiBulkReply();
|
||||
if (unformatted == null) {
|
||||
return null;
|
||||
}
|
||||
List<Response<?>> response = new ArrayList<Response<?>>();
|
||||
for (Object o : unformatted) {
|
||||
response.add(generateResponse(o));
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public String discard() {
|
||||
client.discard();
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
import redis.clients.jedis.Protocol.Command;
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
import redis.clients.jedis.exceptions.JedisDataException;
|
||||
import redis.clients.jedis.exceptions.JedisException;
|
||||
import redis.clients.util.RedisInputStream;
|
||||
import redis.clients.util.RedisOutputStream;
|
||||
@@ -204,7 +205,11 @@ public class Connection {
|
||||
List<Object> all = new ArrayList<Object>();
|
||||
flush();
|
||||
while (pipelinedCommands > except) {
|
||||
all.add(protocol.read(inputStream));
|
||||
try{
|
||||
all.add(protocol.read(inputStream));
|
||||
}catch(JedisDataException e){
|
||||
all.add(e);
|
||||
}
|
||||
pipelinedCommands--;
|
||||
}
|
||||
return all;
|
||||
|
||||
@@ -113,7 +113,11 @@ public final class Protocol {
|
||||
}
|
||||
List<Object> ret = new ArrayList<Object>(num);
|
||||
for (int i = 0; i < num; i++) {
|
||||
ret.add(process(is));
|
||||
try{
|
||||
ret.add(process(is));
|
||||
}catch(JedisDataException e){
|
||||
ret.add(e);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ public class Response<T> {
|
||||
"Please close pipeline or multi block before calling this method.");
|
||||
}
|
||||
if (!built) {
|
||||
if (data instanceof JedisDataException){
|
||||
throw new JedisDataException((JedisDataException)data);
|
||||
}
|
||||
response = builder.build(data);
|
||||
this.data = null;
|
||||
built = true;
|
||||
|
||||
Reference in New Issue
Block a user