diff --git a/spring-datastore-redis/pom.xml b/spring-datastore-redis/pom.xml
index 95b738e3c..c72cefea6 100644
--- a/spring-datastore-redis/pom.xml
+++ b/spring-datastore-redis/pom.xml
@@ -96,7 +96,7 @@
redis.clients
jedis
- 1.3.1
+ 1.3.2-binaryfork-121110
compile
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/DefaultEntry.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/DefaultEntry.java
deleted file mode 100644
index db44fbbf2..000000000
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/DefaultEntry.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2010 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.datastore.redis.connection;
-
-import org.springframework.datastore.redis.connection.RedisHashCommands.Entry;
-
-/**
- * Default {@link Entry} implementation.
- *
- * @author Costin Leau
- */
-public class DefaultEntry implements Entry {
-
- private final String field;
- private final String value;
-
- public DefaultEntry(String field, String value) {
- this.field = field;
- this.value = value;
- }
-
- @Override
- public byte[] getField() {
- return null;
- }
-
- @Override
- public byte[] getValue() {
- return null;
- }
-
-}
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisCommands.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisCommands.java
index c09dd12c5..70e1cd397 100644
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisCommands.java
+++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisCommands.java
@@ -32,7 +32,7 @@ public interface RedisCommands extends RedisTxCommands, RedisStringCommands, Red
DataType type(byte[] key);
- Collection keys(String pattern);
+ Collection keys(byte[] pattern);
byte[] randomKey();
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisHashCommands.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisHashCommands.java
index 862ded3d5..aac379edb 100644
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisHashCommands.java
+++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/RedisHashCommands.java
@@ -17,6 +17,7 @@
package org.springframework.datastore.redis.connection;
import java.util.List;
+import java.util.Map;
import java.util.Set;
/**
@@ -26,12 +27,6 @@ import java.util.Set;
*/
public interface RedisHashCommands {
- public interface Entry {
- public byte[] getField();
-
- public byte[] getValue();
- }
-
Boolean hSet(byte[] key, byte[] field, byte[] value);
Boolean hSetNX(byte[] key, byte[] field, byte[] value);
@@ -40,7 +35,7 @@ public interface RedisHashCommands {
List hMGet(byte[] key, byte[]... fields);
- void hMSet(byte[] key, byte[][] fields, byte[][] values);
+ void hMSet(byte[] key, Map hashes);
Integer hIncrBy(byte[] key, byte[] field, int delta);
@@ -54,5 +49,5 @@ public interface RedisHashCommands {
List hVals(byte[] key);
- Set hGetAll(byte[] key);
+ Map hGetAll(byte[] key);
}
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnection.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnection.java
index 42f5cc523..6a3c7c53e 100644
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnection.java
+++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnection.java
@@ -17,8 +17,8 @@ package org.springframework.datastore.redis.connection.jedis;
import java.io.IOException;
import java.lang.reflect.Field;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -30,6 +30,8 @@ import org.springframework.datastore.redis.connection.DataType;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.util.ReflectionUtils;
+import redis.clients.jedis.BinaryJedis;
+import redis.clients.jedis.BinaryTransaction;
import redis.clients.jedis.Client;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisException;
@@ -46,13 +48,13 @@ public class JedisConnection implements RedisConnection {
private static final Field CLIENT_FIELD;
static {
- CLIENT_FIELD = ReflectionUtils.findField(Jedis.class, "client", Client.class);
+ CLIENT_FIELD = ReflectionUtils.findField(BinaryJedis.class, "client", Client.class);
ReflectionUtils.makeAccessible(CLIENT_FIELD);
}
private final Jedis jedis;
private final Client client;
- private final Transaction transaction;
+ private final BinaryTransaction transaction;
public JedisConnection(Jedis jedis) {
this.jedis = jedis;
@@ -176,7 +178,7 @@ public class JedisConnection implements RedisConnection {
}
@Override
- public Collection keys(String pattern) {
+ public Collection keys(byte[] pattern) {
try {
if (isQueueing()) {
transaction.keys(pattern);
@@ -214,10 +216,10 @@ public class JedisConnection implements RedisConnection {
public byte[] randomKey() {
try {
if (isQueueing()) {
- transaction.randomKey();
+ transaction.randomBinaryKey();
return null;
}
- return jedis.randomKey();
+ return jedis.randomBinaryKey();
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -303,7 +305,7 @@ public class JedisConnection implements RedisConnection {
}
try {
- for (String key : keys) {
+ for (byte[] key : keys) {
jedis.watch(key);
}
} catch (Exception ex) {
@@ -379,24 +381,24 @@ public class JedisConnection implements RedisConnection {
}
@Override
- public void mSet(byte[][] keys, byte[][] values) {
+ public void mSet(Map tuples) {
try {
if (isQueueing()) {
- transaction.mset(JedisUtils.arrange(keys, values));
+ transaction.mset(JedisUtils.convert(tuples));
}
- jedis.mset(JedisUtils.arrange(keys, values));
+ jedis.mset(JedisUtils.convert(tuples));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
- public void mSetNX(byte[][] keys, byte[][] values) {
+ public void mSetNX(Map tuples) {
try {
if (isQueueing()) {
- transaction.msetnx(JedisUtils.arrange(keys, values));
+ transaction.msetnx(JedisUtils.convert(tuples));
}
- jedis.msetnx(JedisUtils.arrange(keys, values));
+ jedis.msetnx(JedisUtils.convert(tuples));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1198,13 +1200,13 @@ public class JedisConnection implements RedisConnection {
}
@Override
- public Set hGetAll(byte[] key) {
+ public Map hGetAll(byte[] key) {
try {
if (isQueueing()) {
transaction.hgetAll(key);
return null;
}
- return JedisUtils.convert(jedis.hgetAll(key));
+ return jedis.hgetAll(key);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1230,7 +1232,7 @@ public class JedisConnection implements RedisConnection {
transaction.hkeys(key);
return null;
}
- return new LinkedHashSet(jedis.hkeys(key));
+ return jedis.hkeys(key);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1263,13 +1265,12 @@ public class JedisConnection implements RedisConnection {
}
@Override
- public void hMSet(byte[] key, byte[][] fields, byte[][] values) {
- Map param = JedisUtils.convert(fields, values);
+ public void hMSet(byte[] key, Map tuple) {
try {
if (isQueueing()) {
- transaction.hmset(key, param);
+ transaction.hmset(key, tuple);
}
- jedis.hmset(key, param);
+ jedis.hmset(key, tuple);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
@@ -1282,7 +1283,7 @@ public class JedisConnection implements RedisConnection {
transaction.hvals(key);
return null;
}
- return jedis.hvals(key);
+ return new ArrayList(jedis.hvals(key));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnectionFactory.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnectionFactory.java
index f779f5d1a..1eb782033 100644
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnectionFactory.java
+++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisConnectionFactory.java
@@ -96,7 +96,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
protected Jedis fetchJedisConnector() {
try {
if (usePool) {
- return new JedisPoolWrapper(pool.getResource(), pool);
+ return pool.getResource();
}
return new Jedis(getShardInfo());
} catch (TimeoutException ex) {
diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisPoolWrapper.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisPoolWrapper.java
deleted file mode 100644
index 4250d37f1..000000000
--- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/connection/jedis/JedisPoolWrapper.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Copyright 2010 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.datastore.redis.connection.jedis;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import redis.clients.jedis.DebugParams;
-import redis.clients.jedis.Jedis;
-import redis.clients.jedis.JedisMonitor;
-import redis.clients.jedis.JedisPipeline;
-import redis.clients.jedis.JedisPool;
-import redis.clients.jedis.JedisPubSub;
-import redis.clients.jedis.SortingParams;
-import redis.clients.jedis.Transaction;
-import redis.clients.jedis.TransactionBlock;
-import redis.clients.jedis.Tuple;
-import redis.clients.jedis.ZParams;
-import redis.clients.jedis.Client.LIST_POSITION;
-
-/**
- * Wrapper class used for returning to the pool the Jedis connections,
- * once they are closed.
- *
- * @author Costin Leau
- */
-class JedisPoolWrapper extends Jedis {
-
- private final Jedis delegate;
- private final JedisPool pool;
-
- /**
- * Constructs a new JedisPoolWrapper instance.
- *
- * @param host
- * @param delegate
- */
- public JedisPoolWrapper(Jedis delegate, JedisPool pool) {
- super((String) null);
- this.delegate = delegate;
- this.pool = pool;
- }
-
- public Integer append(String key, String value) {
- return delegate.append(key, value);
- }
-
- public String auth(String password) {
- return delegate.auth(password);
- }
-
- public String bgrewriteaof() {
- return delegate.bgrewriteaof();
- }
-
- public String bgsave() {
- return delegate.bgsave();
- }
-
- public List blpop(int timeout, String... keys) {
- return delegate.blpop(timeout, keys);
- }
-
- public List brpop(int timeout, String... keys) {
- return delegate.brpop(timeout, keys);
- }
-
- public List configGet(String pattern) {
- return delegate.configGet(pattern);
- }
-
- public String configSet(String parameter, String value) {
- return delegate.configSet(parameter, value);
- }
-
- public void connect() throws UnknownHostException, IOException {
- delegate.connect();
- }
-
- public Integer dbSize() {
- return delegate.dbSize();
- }
-
- public String debug(DebugParams params) {
- return delegate.debug(params);
- }
-
- public Integer decr(String key) {
- return delegate.decr(key);
- }
-
- public Integer decrBy(String key, int integer) {
- return delegate.decrBy(key, integer);
- }
-
- public Integer del(String... keys) {
- return delegate.del(keys);
- }
-
- public void disconnect() throws IOException {
- cleanup();
- }
-
- public String echo(String string) {
- return delegate.echo(string);
- }
-
- public boolean equals(Object obj) {
- return delegate.equals(obj);
- }
-
- public Integer exists(String key) {
- return delegate.exists(key);
- }
-
- public Integer expire(String key, int seconds) {
- return delegate.expire(key, seconds);
- }
-
- public Integer expireAt(String key, long unixTime) {
- return delegate.expireAt(key, unixTime);
- }
-
- public String flushAll() {
- return delegate.flushAll();
- }
-
- public String flushDB() {
- return delegate.flushDB();
- }
-
- public String get(String key) {
- return delegate.get(key);
- }
-
- public String getSet(String key, String value) {
- return delegate.getSet(key, value);
- }
-
- public int hashCode() {
- return delegate.hashCode();
- }
-
- public Integer hdel(String key, String field) {
- return delegate.hdel(key, field);
- }
-
- public Integer hexists(String key, String field) {
- return delegate.hexists(key, field);
- }
-
- public String hget(String key, String field) {
- return delegate.hget(key, field);
- }
-
- public Map hgetAll(String key) {
- return delegate.hgetAll(key);
- }
-
- public Integer hincrBy(String key, String field, int value) {
- return delegate.hincrBy(key, field, value);
- }
-
- public List hkeys(String key) {
- return delegate.hkeys(key);
- }
-
- public Integer hlen(String key) {
- return delegate.hlen(key);
- }
-
- public List hmget(String key, String... fields) {
- return delegate.hmget(key, fields);
- }
-
- public String hmset(String key, Map hash) {
- return delegate.hmset(key, hash);
- }
-
- public Integer hset(String key, String field, String value) {
- return delegate.hset(key, field, value);
- }
-
- public Integer hsetnx(String key, String field, String value) {
- return delegate.hsetnx(key, field, value);
- }
-
- public List hvals(String key) {
- return delegate.hvals(key);
- }
-
- public Integer incr(String key) {
- return delegate.incr(key);
- }
-
- public Integer incrBy(String key, int integer) {
- return delegate.incrBy(key, integer);
- }
-
- public String info() {
- return delegate.info();
- }
-
- public boolean isConnected() {
- return delegate.isConnected();
- }
-
- public List keys(String pattern) {
- return delegate.keys(pattern);
- }
-
- public Integer lastsave() {
- return delegate.lastsave();
- }
-
- public String lindex(String key, int index) {
- return delegate.lindex(key, index);
- }
-
- public Integer linsert(String key, LIST_POSITION where, String pivot, String value) {
- return delegate.linsert(key, where, pivot, value);
- }
-
- public Integer llen(String key) {
- return delegate.llen(key);
- }
-
- public String lpop(String key) {
- return delegate.lpop(key);
- }
-
- public Integer lpush(String key, String string) {
- return delegate.lpush(key, string);
- }
-
- public Integer lpushx(String key, String string) {
- return delegate.lpushx(key, string);
- }
-
- public List lrange(String key, int start, int end) {
- return delegate.lrange(key, start, end);
- }
-
- public Integer lrem(String key, int count, String value) {
- return delegate.lrem(key, count, value);
- }
-
- public String lset(String key, int index, String value) {
- return delegate.lset(key, index, value);
- }
-
- public String ltrim(String key, int start, int end) {
- return delegate.ltrim(key, start, end);
- }
-
- public List mget(String... keys) {
- return delegate.mget(keys);
- }
-
- public void monitor(JedisMonitor jedisMonitor) {
- delegate.monitor(jedisMonitor);
- }
-
- public Integer move(String key, int dbIndex) {
- return delegate.move(key, dbIndex);
- }
-
- public String mset(String... keysvalues) {
- return delegate.mset(keysvalues);
- }
-
- public Integer msetnx(String... keysvalues) {
- return delegate.msetnx(keysvalues);
- }
-
- public Transaction multi() {
- return delegate.multi();
- }
-
- public List