Let BinaryJedis.multi() consumes "OK" message

* Transaction doesn't have to consume "multi"'s response
This commit is contained in:
Jungtaek Lim
2014-01-20 07:31:13 +09:00
parent f7bd9c8313
commit 5bf29b43ee
2 changed files with 2 additions and 4 deletions

View File

@@ -1679,6 +1679,7 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
public Transaction multi() { public Transaction multi() {
client.multi(); client.multi();
client.getOne(); // expected OK
return new Transaction(client); return new Transaction(client);
} }
@@ -1687,6 +1688,7 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands, MultiKey
jedisTransaction.setClient(client); jedisTransaction.setClient(client);
try { try {
client.multi(); client.multi();
client.getOne(); // expected OK
jedisTransaction.execute(); jedisTransaction.execute();
results = jedisTransaction.exec(); results = jedisTransaction.exec();
} catch (Exception ex) { } catch (Exception ex) {

View File

@@ -44,8 +44,6 @@ public class Transaction extends MultiKeyPipelineBase {
} }
public List<Object> exec() { public List<Object> exec() {
// Discard multi
consumeResponse(1);
// Discard QUEUED or ERROR // Discard QUEUED or ERROR
consumeResponse(getPipelinedResponseLength()); consumeResponse(getPipelinedResponseLength());
@@ -67,8 +65,6 @@ public class Transaction extends MultiKeyPipelineBase {
} }
public List<Response<?>> execGetResponse() { public List<Response<?>> execGetResponse() {
// Discard multi
consumeResponse(1);
// Discard QUEUED or ERROR // Discard QUEUED or ERROR
consumeResponse(getPipelinedResponseLength()); consumeResponse(getPipelinedResponseLength());