diff --git a/src/main/java/org/springframework/data/redis/connection/Pool.java b/src/main/java/org/springframework/data/redis/connection/Pool.java new file mode 100644 index 000000000..104f8c66d --- /dev/null +++ b/src/main/java/org/springframework/data/redis/connection/Pool.java @@ -0,0 +1,52 @@ +/* + * Copyright 2011-2013 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.redis.connection; + + +/** + * Pool of resources + * + * @author Jennifer Hickey + * + */ +public interface Pool { + + /** + * + * @return A resource, if available + */ + T getResource(); + + /** + * + * @param resource + * A broken resource that should be invalidated + */ + void returnBrokenResource(final T resource); + + /** + * + * @param resource + * A resource to return to the pool + */ + void returnResource(final T resource); + + /** + * Destroys the pool + */ + void destroy(); + +} diff --git a/src/main/java/org/springframework/data/redis/connection/PoolException.java b/src/main/java/org/springframework/data/redis/connection/PoolException.java new file mode 100644 index 000000000..4bb1d6307 --- /dev/null +++ b/src/main/java/org/springframework/data/redis/connection/PoolException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2013 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.redis.connection; + +import org.springframework.core.NestedRuntimeException; + +/** + * Exception thrown when there are issues with a resource pool + * + * @author Jennifer Hickey + * + */ +@SuppressWarnings("serial") +public class PoolException extends NestedRuntimeException { + /** + * Constructs a new PoolException instance. + * + * @param msg + * @param cause + */ + public PoolException(String msg, Throwable cause) { + super(msg, cause); + } + + /** + * Constructs a new PoolException instance. + * + * @param msg + */ + public PoolException(String msg) { + super(msg); + } +} diff --git a/src/main/java/org/springframework/data/redis/connection/jredis/DefaultJredisPool.java b/src/main/java/org/springframework/data/redis/connection/jredis/DefaultJredisPool.java deleted file mode 100644 index bdaae0275..000000000 --- a/src/main/java/org/springframework/data/redis/connection/jredis/DefaultJredisPool.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2011-2013 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.redis.connection.jredis; - -import org.apache.commons.pool.BasePoolableObjectFactory; -import org.apache.commons.pool.impl.GenericObjectPool; -import org.apache.commons.pool.impl.GenericObjectPool.Config; -import org.jredis.ClientRuntimeException; -import org.jredis.JRedis; -import org.jredis.connector.Connection; -import org.jredis.connector.ConnectionSpec; -import org.jredis.connector.Connection.Socket.Property; -import org.jredis.ri.alphazero.JRedisClient; -import org.jredis.ri.alphazero.connection.DefaultConnectionSpec; -import org.springframework.util.StringUtils; - -/** - * Default implementation of {@link JredisPool} - * - * @author Jennifer Hickey - * - */ -public class DefaultJredisPool implements JredisPool { - - private final GenericObjectPool internalPool; - - /** - * Uses the {@link Config} and {@link ConnectionSpec} defaults for - * configuring the connection pool - * - * @param hostName - * The Redis host - * @param port - * The Redis port - */ - public DefaultJredisPool(String hostName, int port) { - this(hostName, port, 0, null, 0, new Config()); - } - - /** - * Uses the {@link ConnectionSpec} defaults for configuring the connection - * pool - * - * @param hostName - * The Redis host - * @param port - * The Redis port - * @param poolConfig - * The pool {@link Config} - */ - public DefaultJredisPool(String hostName, int port, Config poolConfig) { - this(hostName, port, 0, null, 0, poolConfig); - } - - /** - * - * Uses the {@link Config} defaults for configuring the connection pool - * - * @param connectionSpec - * The {@link ConnectionSpec} for connecting to Redis - * - */ - public DefaultJredisPool(ConnectionSpec connectionSpec) { - this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), new Config()); - } - - /** - * - * @param connectionSpec - * The {@link ConnectionSpec} for connecting to Redis - * - * @param poolConfig - * The pool {@link Config} - */ - public DefaultJredisPool(ConnectionSpec connectionSpec, Config poolConfig) { - this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), poolConfig); - } - - /** - * Uses the {@link Config} defaults for configuring the connection pool - * - * @param hostName - * The Redis host - * @param port - * The Redis port - * @param dbIndex - * The index of the database all connections should use. The - * database will only be selected on initial creation of the - * pooled {@link JRedis} instances. Since calling select directly - * on {@link JRedis} is not supported, it is assumed that - * connections can be re-used without subsequent selects. - * @param password - * The password used for authenticating with the Redis server or - * null if no password required - * @param timeout - * The socket timeout or 0 to use the default socket timeout - */ - public DefaultJredisPool(String hostName, int port, int dbIndex, String password, int timeout) { - this(hostName, port, dbIndex, password, timeout, new Config()); - } - - /** - * - * @param hostName - * The Redis host - * @param port - * The Redis port - * @param dbIndex - * The index of the database all connections should use - * @param password - * The password used for authenticating with the Redis server or - * null if no password required - * @param timeout - * The socket timeout or 0 to use the default socket timeout - * @param poolConfig - * The pool {@link COnfig} - */ - public DefaultJredisPool(String hostName, int port, int dbIndex, String password, int timeout, - Config poolConfig) { - ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(hostName, port, dbIndex, null); - connectionSpec.setConnectionFlag(Connection.Flag.RELIABLE, false); - if (StringUtils.hasLength(password)) { - connectionSpec.setCredentials(password); - } - if (timeout > 0) { - connectionSpec.setSocketProperty(Property.SO_TIMEOUT, timeout); - } - this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), poolConfig); - } - - public JRedis getResource() { - try { - return (JRedis) internalPool.borrowObject(); - } catch (Exception e) { - throw new ClientRuntimeException("Could not get a resource from the pool", e); - } - } - - public void returnBrokenResource(final JRedis resource) { - try { - internalPool.invalidateObject(resource); - } catch (Exception e) { - throw new ClientRuntimeException("Could not invalidate the broken resource", e); - } - } - - public void returnResource(final JRedis resource) { - try { - internalPool.returnObject(resource); - } catch (Exception e) { - throw new ClientRuntimeException("Could not return the resource to the pool", e); - } - } - - public void destroy() { - try { - internalPool.close(); - } catch (Exception e) { - throw new ClientRuntimeException("Could not destroy the pool", e); - } - } - - private static class JredisFactory extends BasePoolableObjectFactory { - - private final ConnectionSpec connectionSpec; - - public JredisFactory(ConnectionSpec connectionSpec) { - super(); - this.connectionSpec = connectionSpec; - } - - public Object makeObject() throws Exception { - return new JRedisClient(connectionSpec); - } - - public void destroyObject(final Object obj) throws Exception { - if (obj instanceof JRedis) { - try { - ((JRedis) obj).quit(); - }catch(Exception e) { - // Errors may happen if returning a broken resource - } - } - } - - public boolean validateObject(final Object obj) { - if (obj instanceof JRedis) { - try { - ((JRedis) obj).ping(); - return true; - } catch (Exception e) { - return false; - } - } else { - return false; - } - } - } - -} diff --git a/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnection.java b/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnection.java index b0aa5bea6..3a020b48c 100644 --- a/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnection.java @@ -38,6 +38,7 @@ import org.springframework.dao.DataAccessException; import org.springframework.data.redis.RedisSystemException; import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.connection.MessageListener; +import org.springframework.data.redis.connection.Pool; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.ReturnType; import org.springframework.data.redis.connection.SortParameters; @@ -57,7 +58,7 @@ public class JredisConnection implements RedisConnection { private static final Method SERVICE_REQUEST; private final JRedis jredis; - private final JredisPool pool; + private final Pool pool; private boolean isClosed = false; /** flag indicating whether the connection needs to be dropped or not */ private boolean broken = false; @@ -77,7 +78,7 @@ public class JredisConnection implements RedisConnection { this(jredis, null); } - public JredisConnection(JRedis jredis, JredisPool pool) { + public JredisConnection(JRedis jredis, Pool pool) { Assert.notNull(jredis, "a not-null instance required"); this.jredis = jredis; this.pool = pool; diff --git a/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnectionFactory.java index bf470a934..6ee83698e 100644 --- a/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/jredis/JredisConnectionFactory.java @@ -16,6 +16,7 @@ package org.springframework.data.redis.connection.jredis; import org.jredis.ClientRuntimeException; +import org.jredis.JRedis; import org.jredis.connector.Connection; import org.jredis.connector.Connection.Socket.Property; import org.jredis.connector.ConnectionSpec; @@ -24,6 +25,7 @@ import org.jredis.ri.alphazero.connection.DefaultConnectionSpec; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.DataAccessException; +import org.springframework.data.redis.connection.Pool; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.util.Assert; @@ -44,7 +46,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean private String password = null; private int timeout; private int dbIndex = DEFAULT_REDIS_DB; - private JredisPool pool; + private Pool pool; private static final int DEFAULT_REDIS_PORT = 6379; private static final int DEFAULT_REDIS_DB = 0; @@ -67,7 +69,7 @@ public class JredisConnectionFactory implements InitializingBean, DisposableBean this.connectionSpec = connectionSpec; } - public JredisConnectionFactory(JredisPool pool) { + public JredisConnectionFactory(Pool pool) { this.pool = pool; } diff --git a/src/main/java/org/springframework/data/redis/connection/jredis/JredisPool.java b/src/main/java/org/springframework/data/redis/connection/jredis/JredisPool.java index ecae162ac..6dcdd655f 100644 --- a/src/main/java/org/springframework/data/redis/connection/jredis/JredisPool.java +++ b/src/main/java/org/springframework/data/redis/connection/jredis/JredisPool.java @@ -15,42 +15,200 @@ */ package org.springframework.data.redis.connection.jredis; -import org.jredis.ClientRuntimeException; +import org.apache.commons.pool.BasePoolableObjectFactory; +import org.apache.commons.pool.impl.GenericObjectPool; +import org.apache.commons.pool.impl.GenericObjectPool.Config; import org.jredis.JRedis; +import org.jredis.connector.Connection; +import org.jredis.connector.Connection.Socket.Property; +import org.jredis.connector.ConnectionSpec; +import org.jredis.ri.alphazero.JRedisClient; +import org.jredis.ri.alphazero.connection.DefaultConnectionSpec; +import org.springframework.data.redis.connection.Pool; +import org.springframework.data.redis.connection.PoolException; +import org.springframework.util.StringUtils; /** - * Pool of {@link JRedis} connection objects. + * JRedis implementation of {@link Pool} * * @author Jennifer Hickey * */ -public interface JredisPool { +public class JredisPool implements Pool { + + private final GenericObjectPool internalPool; + + /** + * Uses the {@link Config} and {@link ConnectionSpec} defaults for + * configuring the connection pool + * + * @param hostName + * The Redis host + * @param port + * The Redis port + */ + public JredisPool(String hostName, int port) { + this(hostName, port, 0, null, 0, new Config()); + } + + /** + * Uses the {@link ConnectionSpec} defaults for configuring the connection + * pool + * + * @param hostName + * The Redis host + * @param port + * The Redis port + * @param poolConfig + * The pool {@link Config} + */ + public JredisPool(String hostName, int port, Config poolConfig) { + this(hostName, port, 0, null, 0, poolConfig); + } /** * - * @return A {@link JRedis} connection, if available. Throws a - * {@link ClientRuntimeException} if a connection cannot be borrowed - * from the pool + * Uses the {@link Config} defaults for configuring the connection pool + * + * @param connectionSpec + * The {@link ConnectionSpec} for connecting to Redis + * */ - JRedis getResource(); + public JredisPool(ConnectionSpec connectionSpec) { + this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), new Config()); + } /** - * - * @param resource - * A broken {@link JRedis} connection that should be invalidated + * + * @param connectionSpec + * The {@link ConnectionSpec} for connecting to Redis + * + * @param poolConfig + * The pool {@link Config} */ - void returnBrokenResource(final JRedis resource); + public JredisPool(ConnectionSpec connectionSpec, Config poolConfig) { + this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), poolConfig); + } /** - * - * @param resource - * A {@link JRedis} connection to return to the pool + * Uses the {@link Config} defaults for configuring the connection pool + * + * @param hostName + * The Redis host + * @param port + * The Redis port + * @param dbIndex + * The index of the database all connections should use. The + * database will only be selected on initial creation of the + * pooled {@link JRedis} instances. Since calling select directly + * on {@link JRedis} is not supported, it is assumed that + * connections can be re-used without subsequent selects. + * @param password + * The password used for authenticating with the Redis server or + * null if no password required + * @param timeout + * The socket timeout or 0 to use the default socket timeout */ - void returnResource(final JRedis resource); + public JredisPool(String hostName, int port, int dbIndex, String password, int timeout) { + this(hostName, port, dbIndex, password, timeout, new Config()); + } /** - * Destroys the connection pool + * + * @param hostName + * The Redis host + * @param port + * The Redis port + * @param dbIndex + * The index of the database all connections should use + * @param password + * The password used for authenticating with the Redis server or + * null if no password required + * @param timeout + * The socket timeout or 0 to use the default socket timeout + * @param poolConfig + * The pool {@link COnfig} */ - void destroy(); + public JredisPool(String hostName, int port, int dbIndex, String password, int timeout, + Config poolConfig) { + ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(hostName, port, dbIndex, null); + connectionSpec.setConnectionFlag(Connection.Flag.RELIABLE, false); + if (StringUtils.hasLength(password)) { + connectionSpec.setCredentials(password); + } + if (timeout > 0) { + connectionSpec.setSocketProperty(Property.SO_TIMEOUT, timeout); + } + this.internalPool = new GenericObjectPool(new JredisFactory(connectionSpec), poolConfig); + } + + public JRedis getResource() { + try { + return (JRedis) internalPool.borrowObject(); + } catch (Exception e) { + throw new PoolException("Could not get a resource from the pool", e); + } + } + + public void returnBrokenResource(final JRedis resource) { + try { + internalPool.invalidateObject(resource); + } catch (Exception e) { + throw new PoolException("Could not invalidate the broken resource", e); + } + } + + public void returnResource(final JRedis resource) { + try { + internalPool.returnObject(resource); + } catch (Exception e) { + throw new PoolException("Could not return the resource to the pool", e); + } + } + + public void destroy() { + try { + internalPool.close(); + } catch (Exception e) { + throw new PoolException("Could not destroy the pool", e); + } + } + + private static class JredisFactory extends BasePoolableObjectFactory { + + private final ConnectionSpec connectionSpec; + + public JredisFactory(ConnectionSpec connectionSpec) { + super(); + this.connectionSpec = connectionSpec; + } + + public Object makeObject() throws Exception { + return new JRedisClient(connectionSpec); + } + + public void destroyObject(final Object obj) throws Exception { + if (obj instanceof JRedis) { + try { + ((JRedis) obj).quit(); + }catch(Exception e) { + // Errors may happen if returning a broken resource + } + } + } + + public boolean validateObject(final Object obj) { + if (obj instanceof JRedis) { + try { + ((JRedis) obj).ping(); + return true; + } catch (Exception e) { + return false; + } + } else { + return false; + } + } + } } diff --git a/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java index 10ef1942d..11041550b 100644 --- a/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java @@ -92,7 +92,7 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat @Test public void testConnectionStaysOpenWhenPooled() { - JredisConnectionFactory factory2 = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory factory2 = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort())); RedisConnection conn2 = factory2.getConnection(); conn2.close(); @@ -104,7 +104,7 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat Config config = new Config(); config.maxActive = 1; config.maxWait = 1; - JredisConnectionFactory factory2 = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory factory2 = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort(), config)); RedisConnection conn2 = factory2.getConnection(); ((JRedis) conn2.getNativeConnection()).quit(); diff --git a/src/test/java/org/springframework/data/redis/connection/jredis/DefaultJredisPoolTests.java b/src/test/java/org/springframework/data/redis/connection/jredis/JredisPoolTests.java similarity index 78% rename from src/test/java/org/springframework/data/redis/connection/jredis/DefaultJredisPoolTests.java rename to src/test/java/org/springframework/data/redis/connection/jredis/JredisPoolTests.java index 0052241fd..461ac0111 100644 --- a/src/test/java/org/springframework/data/redis/connection/jredis/DefaultJredisPoolTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jredis/JredisPoolTests.java @@ -15,7 +15,11 @@ */ package org.springframework.data.redis.connection.jredis; -import org.jredis.ClientRuntimeException; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.fail; + +import org.apache.commons.pool.impl.GenericObjectPool.Config; import org.jredis.JRedis; import org.jredis.RedisException; import org.jredis.connector.ConnectionSpec; @@ -25,19 +29,15 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.data.redis.SettingsUtils; -import org.apache.commons.pool.impl.GenericObjectPool.Config; -import static org.junit.Assert.fail; -import static org.junit.Assert.assertNotSame; - -import static org.junit.Assert.assertNotNull; +import org.springframework.data.redis.connection.PoolException; /** - * Integration test of {@link DefaultJredisPool} + * Integration test of {@link JredisPool} * * @author Jennifer Hickey * */ -public class DefaultJredisPoolTests { +public class JredisPoolTests { private ConnectionSpec connectionSpec; @@ -58,7 +58,7 @@ public class DefaultJredisPoolTests { @Test public void testGetResource() throws RedisException { - this.pool = new DefaultJredisPool(connectionSpec); + this.pool = new JredisPool(connectionSpec); JRedis client = pool.getResource(); assertNotNull(client); client.ping(); @@ -69,13 +69,13 @@ public class DefaultJredisPoolTests { Config poolConfig = new Config(); poolConfig.maxActive = 1; poolConfig.maxWait = 1; - this.pool = new DefaultJredisPool(connectionSpec, poolConfig); + this.pool = new JredisPool(connectionSpec, poolConfig); JRedis client = pool.getResource(); assertNotNull(client); try { pool.getResource(); - fail("ClientRuntimeException should be thrown when pool exhausted"); - } catch (ClientRuntimeException e) { + fail("PoolException should be thrown when pool exhausted"); + } catch (PoolException e) { } } @@ -84,16 +84,16 @@ public class DefaultJredisPoolTests { public void testGetResourceValidate() { Config poolConfig = new Config(); poolConfig.testOnBorrow = true; - this.pool = new DefaultJredisPool(connectionSpec, poolConfig); + this.pool = new JredisPool(connectionSpec, poolConfig); JRedis client = pool.getResource(); assertNotNull(client); } - @Test(expected = ClientRuntimeException.class) + @Test(expected = PoolException.class) public void testGetResourceCreationUnsuccessful() { // Config poolConfig = new Config(); // poolConfig.testOnBorrow = true; - this.pool = new DefaultJredisPool(DefaultConnectionSpec.newSpec(SettingsUtils.getHost(), 3333, 0, + this.pool = new JredisPool(DefaultConnectionSpec.newSpec(SettingsUtils.getHost(), 3333, 0, null)); pool.getResource(); } @@ -103,7 +103,7 @@ public class DefaultJredisPoolTests { Config poolConfig = new Config(); poolConfig.maxActive = 1; poolConfig.maxWait = 1; - this.pool = new DefaultJredisPool(connectionSpec); + this.pool = new JredisPool(connectionSpec); JRedis client = pool.getResource(); assertNotNull(client); pool.returnResource(client); @@ -115,7 +115,7 @@ public class DefaultJredisPoolTests { Config poolConfig = new Config(); poolConfig.maxActive = 1; poolConfig.maxWait = 1; - this.pool = new DefaultJredisPool(connectionSpec, poolConfig); + this.pool = new JredisPool(connectionSpec, poolConfig); JRedis client = pool.getResource(); assertNotNull(client); pool.returnBrokenResource(client); @@ -130,13 +130,13 @@ public class DefaultJredisPoolTests { @Test public void testCreateWithHostAndPort() { - this.pool = new DefaultJredisPool(SettingsUtils.getHost(), SettingsUtils.getPort()); + this.pool = new JredisPool(SettingsUtils.getHost(), SettingsUtils.getPort()); assertNotNull(pool.getResource()); } @Test public void testCreateWithHostPortAndDbIndex() { - this.pool = new DefaultJredisPool(SettingsUtils.getHost(), SettingsUtils.getPort(), 1, null, 0); + this.pool = new JredisPool(SettingsUtils.getHost(), SettingsUtils.getPort(), 1, null, 0); assertNotNull(pool.getResource()); } diff --git a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java index 493f5abb0..9c3b260c0 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java @@ -20,7 +20,7 @@ import java.util.Collection; import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.connection.jredis.DefaultJredisPool; +import org.springframework.data.redis.connection.jredis.JredisPool; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; @@ -40,7 +40,7 @@ public abstract class AtomicCountersParam { jedisConnFactory.afterPropertiesSet(); // JRedis - JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort())); jredisConnFactory.afterPropertiesSet(); diff --git a/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java index 9eba8da5b..99e0dfa97 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java +++ b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java @@ -21,7 +21,7 @@ import java.util.Collection; import org.springframework.data.redis.Person; import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.connection.jredis.DefaultJredisPool; +import org.springframework.data.redis.connection.jredis.JredisPool; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; @@ -81,7 +81,7 @@ public abstract class CollectionTestParams { jsonPersonTemplate.afterPropertiesSet(); // jredis - JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort())); jredisConnFactory.afterPropertiesSet(); diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java index 643972c90..95173adcd 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java @@ -22,7 +22,7 @@ import org.junit.runners.Parameterized.Parameters; import org.springframework.data.redis.Person; import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.connection.jredis.DefaultJredisPool; +import org.springframework.data.redis.connection.jredis.JredisPool; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; @@ -93,7 +93,7 @@ public class RedisMapTests extends AbstractRedisMapTests { jsonPersonTemplate.afterPropertiesSet(); // JRedis - JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort())); jredisConnFactory.afterPropertiesSet(); diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java index 87cdb18d8..e52832a2c 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java @@ -38,7 +38,7 @@ import org.junit.runners.Parameterized.Parameters; import org.springframework.data.redis.Person; import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.connection.jredis.DefaultJredisPool; +import org.springframework.data.redis.connection.jredis.JredisPool; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; @@ -262,7 +262,7 @@ public class RedisPropertiesTests extends RedisMapTests { jsonPersonTemplate.afterPropertiesSet(); // JRedis - JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new DefaultJredisPool( + JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new JredisPool( SettingsUtils.getHost(), SettingsUtils.getPort())); jredisConnFactory.afterPropertiesSet();