diff --git a/spring-data-redis/pom.xml b/spring-data-redis/pom.xml
index 2f683aefe..c0fe69d97 100644
--- a/spring-data-redis/pom.xml
+++ b/spring-data-redis/pom.xml
@@ -16,8 +16,10 @@
"[3.0.0, 4.0.0)"
03122010
1.5.2
+ 0.6.2
"[1.0.0,2.0.0)"
"[1.6, 2.0.0)"
+ "[0.6.2, 0.6.2]"
@@ -135,27 +137,18 @@
compile
-
org.jredis
jredis-anthonylauzon
${jredis.ver}
compile
+
+ org.idevlab
+ rjc
+ ${rjc.ver}
+ compile
+
diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnectionFactory.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnectionFactory.java
index 099067bbd..51f326a39 100644
--- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnectionFactory.java
+++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnectionFactory.java
@@ -34,7 +34,7 @@ import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.Protocol;
/**
- * Connection factory using creating Jedis based connections.
+ * Connection factory creating Jedis based connections.
*
* @author Costin Leau
*/
diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java
index dca7e829d..6357ff522 100644
--- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java
+++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java
@@ -81,7 +81,11 @@ public class JredisConnection implements RedisConnection {
// don't actually close the connection
// if a pool is used
if (!isPool) {
- jredis.quit();
+ try {
+ jredis.quit();
+ } catch (Exception ex) {
+ throw convertJredisAccessException(ex);
+ }
}
}
diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/rjc/RjcConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/rjc/RjcConnection.java
new file mode 100644
index 000000000..1983555d5
--- /dev/null
+++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/rjc/RjcConnection.java
@@ -0,0 +1,709 @@
+/*
+ * Copyright 2011 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.data.keyvalue.redis.connection.rjc;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.idevlab.rjc.RedisException;
+import org.idevlab.rjc.Session;
+import org.idevlab.rjc.SessionFactoryImpl;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.keyvalue.UncategorizedKeyvalueStoreException;
+import org.springframework.data.keyvalue.redis.connection.DataType;
+import org.springframework.data.keyvalue.redis.connection.MessageListener;
+import org.springframework.data.keyvalue.redis.connection.RedisConnection;
+import org.springframework.data.keyvalue.redis.connection.SortParameters;
+import org.springframework.data.keyvalue.redis.connection.Subscription;
+
+/**
+ * {@code RedisConnection} implementation on top of rjc library.
+ *
+ * @author Costin Leau
+ */
+public class RjcConnection implements RedisConnection {
+
+ private final int dbIndex;
+ private final Session session;
+ private boolean isClosed = false;
+
+ public RjcConnection(org.idevlab.rjc.ds.RedisConnection connection, int dbIndex) {
+ session = new SessionFactoryImpl(new SingleDataSource(connection)).create();
+ this.dbIndex = dbIndex;
+
+ // select the db
+ if (dbIndex > 0) {
+ select(dbIndex);
+ }
+ }
+
+ protected DataAccessException convertRjcAccessException(Exception ex) {
+ if (ex instanceof RedisException) {
+ return RjcUtils.convertRjcAccessException((RedisException) ex);
+ }
+ return new UncategorizedKeyvalueStoreException("Unknown rjc exception", ex);
+ }
+
+ @Override
+ public void close() throws DataAccessException {
+ isClosed = true;
+ try {
+ session.close();
+ } catch (Exception ex) {
+ throw convertRjcAccessException(ex);
+ }
+ }
+
+
+ @Override
+ public boolean isClosed() {
+ return isClosed;
+ }
+
+ @Override
+ public Session getNativeConnection() {
+ return session;
+ }
+
+ @Override
+ public List closePipeline() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ @Override
+ public boolean isPipelined() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isQueueing() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void openPipeline() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Long del(byte[]... keys) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public byte[] echo(byte[] message) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Boolean exists(byte[] key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Boolean expire(byte[] key, long seconds) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Boolean expireAt(byte[] key, long unixTime) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Set keys(byte[] pattern) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Boolean persist(byte[] key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String ping() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public byte[] randomKey() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void rename(byte[] oldName, byte[] newName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Boolean renameNX(byte[] oldName, byte[] newName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void select(int dbIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List sort(byte[] key, SortParameters params) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Long sort(byte[] key, SortParameters params, byte[] storeKey) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Long ttl(byte[] key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DataType type(byte[] key) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void discard() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List