Fix indentation (code formatting...)
This commit is contained in:
@@ -22,7 +22,6 @@ import redis.clients.util.SafeEncoder;
|
|||||||
public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
||||||
MultiKeyBinaryCommands, AdvancedBinaryJedisCommands,
|
MultiKeyBinaryCommands, AdvancedBinaryJedisCommands,
|
||||||
BinaryScriptingCommands, Closeable {
|
BinaryScriptingCommands, Closeable {
|
||||||
|
|
||||||
protected Client client = null;
|
protected Client client = null;
|
||||||
protected Transaction transaction = null;
|
protected Transaction transaction = null;
|
||||||
protected Pipeline pipeline = null;
|
protected Pipeline pipeline = null;
|
||||||
@@ -1771,10 +1770,10 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
|||||||
public List<Object> multi(final TransactionBlock jedisTransaction) {
|
public List<Object> multi(final TransactionBlock jedisTransaction) {
|
||||||
List<Object> results = null;
|
List<Object> results = null;
|
||||||
jedisTransaction.setClient(client);
|
jedisTransaction.setClient(client);
|
||||||
client.multi();
|
client.multi();
|
||||||
client.getOne(); // expected OK
|
client.getOne(); // expected OK
|
||||||
jedisTransaction.execute();
|
jedisTransaction.execute();
|
||||||
results = jedisTransaction.exec();
|
results = jedisTransaction.exec();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1794,24 +1793,24 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetState() {
|
public void resetState() {
|
||||||
if (client.isConnected()) {
|
if (client.isConnected()) {
|
||||||
if (transaction != null) {
|
if (transaction != null) {
|
||||||
transaction.clear();
|
transaction.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipeline != null) {
|
if (pipeline != null) {
|
||||||
pipeline.clear();
|
pipeline.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.isInWatch()) {
|
if (client.isInWatch()) {
|
||||||
unwatch();
|
unwatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
client.resetState();
|
client.resetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction = null;
|
transaction = null;
|
||||||
pipeline = null;
|
pipeline = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String watch(final byte[]... keys) {
|
public String watch(final byte[]... keys) {
|
||||||
|
|||||||
@@ -231,42 +231,42 @@ public class Connection implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object getOne() {
|
public Object getOne() {
|
||||||
flush();
|
flush();
|
||||||
return readProtocolWithCheckingBroken();
|
return readProtocolWithCheckingBroken();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBroken() {
|
public boolean isBroken() {
|
||||||
return broken;
|
return broken;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void flush() {
|
protected void flush() {
|
||||||
try {
|
try {
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
broken = true;
|
broken = true;
|
||||||
throw new JedisConnectionException(ex);
|
throw new JedisConnectionException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object readProtocolWithCheckingBroken() {
|
protected Object readProtocolWithCheckingBroken() {
|
||||||
try {
|
try {
|
||||||
return Protocol.read(inputStream);
|
return Protocol.read(inputStream);
|
||||||
} catch (JedisConnectionException exc) {
|
} catch (JedisConnectionException exc) {
|
||||||
broken = true;
|
broken = true;
|
||||||
throw exc;
|
throw exc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getMany(int count) {
|
public List<Object> getMany(int count) {
|
||||||
flush();
|
flush();
|
||||||
List<Object> responses = new ArrayList<Object>();
|
List<Object> responses = new ArrayList<Object>();
|
||||||
for (int i = 0 ; i < count ; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
try {
|
try {
|
||||||
responses.add(readProtocolWithCheckingBroken());
|
responses.add(readProtocolWithCheckingBroken());
|
||||||
} catch (JedisDataException e) {
|
} catch (JedisDataException e) {
|
||||||
responses.add(e);
|
responses.add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return responses;
|
return responses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,15 +70,15 @@ public class Pipeline extends MultiKeyPipelineBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (isInMulti()) {
|
if (isInMulti()) {
|
||||||
discard();
|
discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInMulti() {
|
public boolean isInMulti() {
|
||||||
return currentMulti != null;
|
return currentMulti != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ package redis.clients.jedis;
|
|||||||
* @see https://github.com/xetorthio/jedis/pull/498
|
* @see https://github.com/xetorthio/jedis/pull/498
|
||||||
*/
|
*/
|
||||||
public abstract class PipelineBlock extends Pipeline {
|
public abstract class PipelineBlock extends Pipeline {
|
||||||
// For shadowing
|
// For shadowing
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
public abstract void execute();
|
public abstract void execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ public class Queable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasPipelinedResponse() {
|
protected boolean hasPipelinedResponse() {
|
||||||
return pipelinedResponses.size() > 0;
|
return pipelinedResponses.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getPipelinedResponseLength() {
|
protected int getPipelinedResponseLength() {
|
||||||
return pipelinedResponses.size();
|
return pipelinedResponses.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ public class Transaction extends MultiKeyPipelineBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (inTransaction) {
|
if (inTransaction) {
|
||||||
discard();
|
discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> exec() {
|
public List<Object> exec() {
|
||||||
@@ -60,7 +60,7 @@ public class Transaction extends MultiKeyPipelineBase {
|
|||||||
public List<Response<?>> execGetResponse() {
|
public List<Response<?>> execGetResponse() {
|
||||||
// Discard QUEUED or ERROR
|
// Discard QUEUED or ERROR
|
||||||
client.getMany(getPipelinedResponseLength());
|
client.getMany(getPipelinedResponseLength());
|
||||||
client.exec();
|
client.exec();
|
||||||
|
|
||||||
List<Object> unformatted = client.getObjectMultiBulkReply();
|
List<Object> unformatted = client.getObjectMultiBulkReply();
|
||||||
if (unformatted == null) {
|
if (unformatted == null) {
|
||||||
@@ -81,8 +81,8 @@ public class Transaction extends MultiKeyPipelineBase {
|
|||||||
return client.getStatusCodeReply();
|
return client.getStatusCodeReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClient(Client client) {
|
public void setClient(Client client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,9 +9,9 @@ import redis.clients.jedis.exceptions.JedisException;
|
|||||||
* @see https://github.com/xetorthio/jedis/pull/498
|
* @see https://github.com/xetorthio/jedis/pull/498
|
||||||
*/
|
*/
|
||||||
public abstract class TransactionBlock extends Transaction {
|
public abstract class TransactionBlock extends Transaction {
|
||||||
// For shadowing
|
// For shadowing
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
public TransactionBlock(Client client) {
|
public TransactionBlock(Client client) {
|
||||||
super(client);
|
super(client);
|
||||||
@@ -23,6 +23,6 @@ public abstract class TransactionBlock extends Transaction {
|
|||||||
public abstract void execute() throws JedisException;
|
public abstract void execute() throws JedisException;
|
||||||
|
|
||||||
public void setClient(Client client) {
|
public void setClient(Client client) {
|
||||||
super.setClient(client);
|
super.setClient(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user