+ fix return signature for closePipeline method

This commit is contained in:
Costin Leau
2011-03-14 12:37:31 +02:00
parent 146257b1f8
commit aef3cdece0
4 changed files with 22 additions and 17 deletions

View File

@@ -1119,7 +1119,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
} }
@Override @Override
public List<Object> closePipeline() { public List<byte[]> closePipeline() {
return delegate.closePipeline(); return delegate.closePipeline();
} }

View File

@@ -95,5 +95,5 @@ public interface RedisConnection extends RedisCommands {
* *
* @return the result of the executed commands. * @return the result of the executed commands.
*/ */
List<Object> closePipeline(); List<byte[]> closePipeline();
} }

View File

@@ -186,10 +186,14 @@ public class JedisConnection implements RedisConnection {
} }
} }
@SuppressWarnings("unchecked")
@Override @Override
public List<Object> closePipeline() { public List<byte[]> closePipeline() {
if (pipeline != null) { if (pipeline != null) {
return pipeline.execute(); List execute = pipeline.execute();
if (execute != null && !execute.isEmpty()) {
return (List<byte[]>) execute;
}
} }
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -217,7 +221,7 @@ public class JedisConnection implements RedisConnection {
else { else {
pipeline.sort(key); pipeline.sort(key);
} }
return null; return null;
} }
return (sortParams != null ? jedis.sort(key, sortParams) : jedis.sort(key)); return (sortParams != null ? jedis.sort(key, sortParams) : jedis.sort(key));
@@ -741,7 +745,8 @@ public class JedisConnection implements RedisConnection {
for (byte[] key : keys) { for (byte[] key : keys) {
if (isPipelined()) { if (isPipelined()) {
pipeline.watch(key); pipeline.watch(key);
} else { }
else {
jedis.watch(key); jedis.watch(key);
} }
} }
@@ -1096,11 +1101,11 @@ public class JedisConnection implements RedisConnection {
if (isPipelined()) { if (isPipelined()) {
final List<byte[]> args = new ArrayList<byte[]>(); final List<byte[]> args = new ArrayList<byte[]>();
for (final byte[] arg : keys) { for (final byte[] arg : keys) {
args.add(arg); args.add(arg);
} }
args.add(Protocol.toByteArray(timeout)); args.add(Protocol.toByteArray(timeout));
pipeline.blpop(args.toArray(new byte[args.size()][])); pipeline.blpop(args.toArray(new byte[args.size()][]));
return null; return null;
} }
return jedis.blpop(timeout, keys); return jedis.blpop(timeout, keys);
} catch (Exception ex) { } catch (Exception ex) {
@@ -1117,11 +1122,11 @@ public class JedisConnection implements RedisConnection {
if (isPipelined()) { if (isPipelined()) {
final List<byte[]> args = new ArrayList<byte[]>(); final List<byte[]> args = new ArrayList<byte[]>();
for (final byte[] arg : keys) { for (final byte[] arg : keys) {
args.add(arg); args.add(arg);
} }
args.add(Protocol.toByteArray(timeout)); args.add(Protocol.toByteArray(timeout));
pipeline.brpop(args.toArray(new byte[args.size()][])); pipeline.brpop(args.toArray(new byte[args.size()][]));
return null; return null;
} }
return jedis.brpop(timeout, keys); return jedis.brpop(timeout, keys);
} catch (Exception ex) { } catch (Exception ex) {

View File

@@ -112,7 +112,7 @@ public class JredisConnection implements RedisConnection {
} }
@Override @Override
public List<Object> closePipeline() { public List<byte[]> closePipeline() {
return Collections.emptyList(); return Collections.emptyList();
} }