This commit is contained in:
nilskp
2014-10-03 15:36:09 -05:00
parent 321e5136be
commit 6ea1959cc5

View File

@@ -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() {
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,6 +109,7 @@ public class Pipeline extends MultiKeyPipelineBase {
* @return A list of all the responses in the order you executed them.
*/
public List<Object> syncAndReturnAll() {
if (client.isConnected()) {
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
List<Object> formatted = new ArrayList<Object>();
@@ -119,6 +121,9 @@ public class Pipeline extends MultiKeyPipelineBase {
}
}
return formatted;
} else {
return java.util.Collections.<Object>emptyList();
}
}
public Response<String> discard() {