Fixes xetorthio/jedis#758
This commit is contained in:
@@ -88,17 +88,18 @@ public class Pipeline extends MultiKeyPipelineBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncronize pipeline by reading all responses. This operation close the
|
||||
* Synchronize pipeline by reading all responses. This operation close the
|
||||
* pipeline. In order to get return values from pipelined commands, capture
|
||||
* the different Response<?> of the commands you execute.
|
||||
*/
|
||||
public void sync() {
|
||||
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
|
||||
for (Object o : unformatted) {
|
||||
generateResponse(o);
|
||||
}
|
||||
if (client.isConnected()) {
|
||||
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
|
||||
for (Object o : unformatted) {
|
||||
generateResponse(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncronize pipeline by reading all responses. This operation close the
|
||||
* pipeline. Whenever possible try to avoid using this version and use
|
||||
@@ -108,17 +109,21 @@ public class Pipeline extends MultiKeyPipelineBase {
|
||||
* @return A list of all the responses in the order you executed them.
|
||||
*/
|
||||
public List<Object> syncAndReturnAll() {
|
||||
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
|
||||
List<Object> formatted = new ArrayList<Object>();
|
||||
if (client.isConnected()) {
|
||||
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
|
||||
List<Object> formatted = new ArrayList<Object>();
|
||||
|
||||
for (Object o : unformatted) {
|
||||
try {
|
||||
formatted.add(generateResponse(o).get());
|
||||
} catch (JedisDataException e) {
|
||||
formatted.add(e);
|
||||
}
|
||||
}
|
||||
return formatted;
|
||||
for (Object o : unformatted) {
|
||||
try {
|
||||
formatted.add(generateResponse(o).get());
|
||||
} catch (JedisDataException e) {
|
||||
formatted.add(e);
|
||||
}
|
||||
}
|
||||
return formatted;
|
||||
} else {
|
||||
return java.util.Collections.<Object>emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public Response<String> discard() {
|
||||
|
||||
Reference in New Issue
Block a user