This commit is contained in:
nilskp
2014-10-04 11:22:45 -05:00
parent 6ea1959cc5
commit 745f1b1e4e

View File

@@ -93,7 +93,7 @@ public class Pipeline extends MultiKeyPipelineBase {
* the different Response<?> of the commands you execute. * the different Response<?> of the commands you execute.
*/ */
public void sync() { public void sync() {
if (client.isConnected()) { if (getPipelinedResponseLength() > 0) {
List<Object> unformatted = client.getMany(getPipelinedResponseLength()); List<Object> unformatted = client.getMany(getPipelinedResponseLength());
for (Object o : unformatted) { for (Object o : unformatted) {
generateResponse(o); generateResponse(o);
@@ -101,7 +101,7 @@ 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. Whenever possible try to avoid using this version and use * pipeline. Whenever possible try to avoid using this version and use
* Pipeline.sync() as it won't go through all the responses and generate the * Pipeline.sync() as it won't go through all the responses and generate the
* right response type (usually it is a waste of time). * right response type (usually it is a waste of time).
@@ -109,10 +109,9 @@ public class Pipeline extends MultiKeyPipelineBase {
* @return A list of all the responses in the order you executed them. * @return A list of all the responses in the order you executed them.
*/ */
public List<Object> syncAndReturnAll() { public List<Object> syncAndReturnAll() {
if (client.isConnected()) { if (getPipelinedResponseLength() > 0) {
List<Object> unformatted = client.getMany(getPipelinedResponseLength()); List<Object> unformatted = client.getMany(getPipelinedResponseLength());
List<Object> formatted = new ArrayList<Object>(); List<Object> formatted = new ArrayList<Object>();
for (Object o : unformatted) { for (Object o : unformatted) {
try { try {
formatted.add(generateResponse(o).get()); formatted.add(generateResponse(o).get());