keep old connection file. DO NOT CROSS BRANCHES AGAIN

This commit is contained in:
Dario Guzik
2011-05-15 18:24:23 -03:00
parent 37587df2b6
commit 56fd098ee2

View File

@@ -61,24 +61,6 @@ public class Connection {
} }
} }
protected Object read() {
try {
return protocol.read(inputStream);
} catch (JedisConnectionException e) {
disconnect();
throw new JedisConnectionException(e);
}
}
protected void sendProtocolCommand(final Command cmd, final byte[]... args) {
try {
protocol.sendCommand(outputStream, cmd, args);
} catch (JedisConnectionException e) {
disconnect();
throw new JedisConnectionException(e);
}
}
protected Connection sendCommand(final Command cmd, final String... args) { protected Connection sendCommand(final Command cmd, final String... args) {
final byte[][] bargs = new byte[args.length][]; final byte[][] bargs = new byte[args.length][];
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
@@ -89,14 +71,14 @@ public class Connection {
protected Connection sendCommand(final Command cmd, final byte[]... args) { protected Connection sendCommand(final Command cmd, final byte[]... args) {
connect(); connect();
sendProtocolCommand(cmd, args); protocol.sendCommand(outputStream, cmd, args);
pipelinedCommands++; pipelinedCommands++;
return this; return this;
} }
protected Connection sendCommand(final Command cmd) { protected Connection sendCommand(final Command cmd) {
connect(); connect();
sendProtocolCommand(cmd, new byte[0][]); protocol.sendCommand(outputStream, cmd, new byte[0][]);
pipelinedCommands++; pipelinedCommands++;
return this; return this;
} }
@@ -163,7 +145,7 @@ public class Connection {
protected String getStatusCodeReply() { protected String getStatusCodeReply() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
final byte[] resp = (byte[]) read(); final byte[] resp = (byte[]) protocol.read(inputStream);
if (null == resp) { if (null == resp) {
return null; return null;
} else { } else {
@@ -183,13 +165,13 @@ public class Connection {
public byte[] getBinaryBulkReply() { public byte[] getBinaryBulkReply() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
return (byte[]) read(); return (byte[]) protocol.read(inputStream);
} }
public Long getIntegerReply() { public Long getIntegerReply() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
return (Long) read(); return (Long) protocol.read(inputStream);
} }
public List<String> getMultiBulkReply() { public List<String> getMultiBulkReply() {
@@ -200,14 +182,14 @@ public class Connection {
public List<byte[]> getBinaryMultiBulkReply() { public List<byte[]> getBinaryMultiBulkReply() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
return (List<byte[]>) read(); return (List<byte[]>) protocol.read(inputStream);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<Object> getObjectMultiBulkReply() { public List<Object> getObjectMultiBulkReply() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
return (List<Object>) read(); return (List<Object>) protocol.read(inputStream);
} }
public List<Object> getAll() { public List<Object> getAll() {
@@ -218,7 +200,7 @@ public class Connection {
List<Object> all = new ArrayList<Object>(); List<Object> all = new ArrayList<Object>();
flush(); flush();
while (pipelinedCommands > except) { while (pipelinedCommands > except) {
all.add(read()); all.add(protocol.read(inputStream));
pipelinedCommands--; pipelinedCommands--;
} }
return all; return all;
@@ -227,6 +209,6 @@ public class Connection {
public Object getOne() { public Object getOne() {
flush(); flush();
pipelinedCommands--; pipelinedCommands--;
return read(); return protocol.read(inputStream);
} }
} }