diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java index 8aa8fe9bc..07bc8190d 100644 --- a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java +++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java @@ -17,7 +17,6 @@ package org.springframework.data.redis.cache; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.Optional; import java.util.function.Consumer; import org.springframework.cache.Cache; @@ -143,25 +142,6 @@ public class RedisCacheConfiguration { valueSerializationPair, conversionService); } - /** - * Use the given prefix instead of using the cache name.
- * This option replaces the cache name with {@code prefix} therefore we recommend rather using - * {@link #prefixCacheNameWith(String)} or {@link #computePrefixWith(CacheKeyPrefix)} for more control.
- * The generated cache key will be: {@code prefix + cache entry key}. - * - * @param prefix must not be {@literal null}. - * @return new {@link RedisCacheConfiguration}. - * @deprecated since 2.3. Use {@link #prefixCacheNameWith(String)} or {@link #computePrefixWith(CacheKeyPrefix)} - * instead. - */ - @Deprecated - public RedisCacheConfiguration prefixKeysWith(String prefix) { - - Assert.notNull(prefix, "Prefix must not be null!"); - - return computePrefixWith((cacheName) -> prefix); - } - /** * Prefix the {@link RedisCache#getName() cache name} with the given value.
* The generated cache key will be: {@code prefix + cache name + "::" + cache entry key}. @@ -261,15 +241,6 @@ public class RedisCacheConfiguration { valueSerializationPair, conversionService); } - /** - * @return never {@literal null}. - * @deprecated since 2.0.4. Please use {@link #getKeyPrefixFor(String)}. - */ - @Deprecated - public Optional getKeyPrefix() { - return usePrefix() ? Optional.of(keyPrefix.compute("")) : Optional.empty(); - } - /** * Get the computed {@literal key} prefix for a given {@literal cacheName}. * diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java index 51fba4f18..4b6a9ab28 100644 --- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java +++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java @@ -15,7 +15,6 @@ */ package org.springframework.data.redis.connection; -import java.util.Collection; import java.util.Collections; import java.util.List; @@ -32,8 +31,6 @@ public class ClusterCommandExecutionFailureException extends UncategorizedDataAc private static final long serialVersionUID = 5727044227040368955L; - private final Collection causes; - /** * Creates new {@link ClusterCommandExecutionFailureException}. * @@ -51,18 +48,8 @@ public class ClusterCommandExecutionFailureException extends UncategorizedDataAc public ClusterCommandExecutionFailureException(List causes) { super(causes.get(0).getMessage(), causes.get(0)); - this.causes = causes; causes.forEach(this::addSuppressed); } - /** - * Get the collected errors. - * - * @return never {@literal null}. - * @deprecated since 2.0, use {@link #getSuppressed()}. - */ - public Collection getCauses() { - return causes; - } } diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java index 4baa3834c..5ebdf8283 100644 --- a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java @@ -199,14 +199,6 @@ public class DefaultStringRedisConnection implements StringRedisConnection, Deco delegate.bgReWriteAof(); } - /** - * @deprecated As of 1.3, use {@link #bgReWriteAof}. - */ - @Deprecated - public void bgWriteAof() { - bgReWriteAof(); - } - @Override public List bLPop(int timeout, byte[]... keys) { return convertAndReturn(delegate.bLPop(timeout, keys), Converters.identityConverter()); diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java index 2b01db7a0..71da3804f 100644 --- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java @@ -1590,13 +1590,6 @@ public interface DefaultedRedisConnection extends RedisConnection { // SERVER COMMANDS - /** @deprecated in favor of {@link RedisConnection#serverCommands()}. */ - @Override - @Deprecated - default void bgWriteAof() { - serverCommands().bgWriteAof(); - } - /** @deprecated in favor of {@link RedisConnection#serverCommands()}. */ @Override @Deprecated diff --git a/src/main/java/org/springframework/data/redis/connection/Pool.java b/src/main/java/org/springframework/data/redis/connection/Pool.java deleted file mode 100644 index 8c7a033f3..000000000 --- a/src/main/java/org/springframework/data/redis/connection/Pool.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011-2022 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 - * - * https://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/PoolConfig.java b/src/main/java/org/springframework/data/redis/connection/PoolConfig.java deleted file mode 100644 index 180d144b1..000000000 --- a/src/main/java/org/springframework/data/redis/connection/PoolConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013-2022 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 - * - * https://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.apache.commons.pool2.impl.GenericObjectPoolConfig; - -/** - * Subclass of {@link GenericObjectPoolConfig} that includes setters for instantiation in Spring - * - * @author Jennifer Hickey - * @author Christoph Strobl - * @deprecated use {@link GenericObjectPoolConfig} instead. Will be removed in a future revision. - */ -@Deprecated -public class PoolConfig extends GenericObjectPoolConfig { - - public PoolConfig() { - super(); - } - - public void setMaxActive(int maxActive) { - setMaxTotal(maxActive); - } -} diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java index a8438fb8d..3ab7d99d4 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java @@ -346,16 +346,6 @@ public interface ReactiveKeyCommands { return new RenameCommand(getKey(), newKey); } - /** - * @return can be {@literal null}. - * @deprecated since 2.5.7, renamed to {@link #getNewKey()}. - */ - @Nullable - @Deprecated - public ByteBuffer getNewName() { - return newKey; - } - /** * @return can be {@literal null}. * @since 2.5.7 diff --git a/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java index 8bf80131c..f55a115d7 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java @@ -51,17 +51,6 @@ public interface RedisServerCommands { SYNC, ASYNC } - /** - * Start an {@literal Append Only File} rewrite process on server. - * - * @deprecated As of 1.3, use {@link #bgReWriteAof}. - * @see Redis Documentation: BGREWRITEAOF - */ - @Deprecated - default void bgWriteAof() { - bgReWriteAof(); - } - /** * Start an {@literal Append Only File} rewrite process on server. * diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java index 21731028d..c77a0030d 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java @@ -76,7 +76,7 @@ import org.springframework.util.Assert; public class JedisClusterConnection implements DefaultedRedisClusterConnection { private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new FallbackExceptionTranslationStrategy( - JedisConverters.exceptionConverter()); + JedisExceptionConverter.INSTANCE); private static final byte[][] EMPTY_2D_BYTE_ARRAY = new byte[0][]; diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java index 70c74adb1..92fc89c68 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java @@ -61,7 +61,7 @@ import org.springframework.util.CollectionUtils; public class JedisConnection extends AbstractRedisConnection { private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new FallbackExceptionTranslationStrategy( - JedisConverters.exceptionConverter()); + JedisExceptionConverter.INSTANCE); private final Jedis jedis; @@ -417,7 +417,7 @@ public class JedisConnection extends AbstractRedisConnection { try { if (isPipelined()) { pipeline(newJedisResult(getRequiredPipeline().exec(), - new TransactionResultConverter<>(new LinkedList<>(txResults), JedisConverters.exceptionConverter()))); + new TransactionResultConverter<>(new LinkedList<>(txResults), JedisExceptionConverter.INSTANCE))); return null; } @@ -428,7 +428,7 @@ public class JedisConnection extends AbstractRedisConnection { List results = transaction.exec(); return !CollectionUtils.isEmpty(results) - ? new TransactionResultConverter<>(txResults, JedisConverters.exceptionConverter()).convert(results) + ? new TransactionResultConverter<>(txResults, JedisExceptionConverter.INSTANCE).convert(results) : results; } catch (Exception ex) { throw convertJedisAccessException(ex); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java index ee367bdaf..c1d751e8d 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java @@ -61,7 +61,6 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; /** * Connection factory creating Jedis based connections. @@ -90,12 +89,10 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, private final static Log log = LogFactory.getLog(JedisConnectionFactory.class); private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy( - JedisConverters.exceptionConverter()); + JedisExceptionConverter.INSTANCE); private final JedisClientConfiguration clientConfiguration; - private @Nullable JedisShardInfo shardInfo; private JedisClientConfig clientConfig = DefaultJedisClientConfig.builder().build(); - private boolean providedShardInfo = false; private @Nullable Pool pool; private boolean convertPipelineAndTxResults = true; private RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration("localhost", @@ -131,23 +128,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, this.clientConfiguration = clientConfig; } - /** - * Constructs a new JedisConnectionFactory instance. Will override the other connection parameters passed - * to the factory. - * - * @param shardInfo shard information - * @deprecated since 2.0, configure Jedis with {@link JedisClientConfiguration} and - * {@link RedisStandaloneConfiguration}. - */ - @Deprecated - public JedisConnectionFactory(JedisShardInfo shardInfo) { - - this(MutableJedisClientConfiguration.create(shardInfo)); - - this.shardInfo = shardInfo; - this.providedShardInfo = true; - } - /** * Constructs a new JedisConnectionFactory instance using the given pool configuration. * @@ -176,7 +156,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, * @param poolConfig pool configuration. Defaulted to new instance if {@literal null}. * @since 1.4 */ - public JedisConnectionFactory(RedisSentinelConfiguration sentinelConfig, JedisPoolConfig poolConfig) { + public JedisConnectionFactory(RedisSentinelConfiguration sentinelConfig, @Nullable JedisPoolConfig poolConfig) { this.configuration = sentinelConfig; this.clientConfiguration = MutableJedisClientConfiguration @@ -295,10 +275,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, private Jedis createJedis() { - if (providedShardInfo) { - return new Jedis(getShardInfo()); - } - return new Jedis(new HostAndPort(getHostName(), getPort()), this.clientConfig); } @@ -317,29 +293,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, clientConfig = createClientConfig(getDatabase(), getRedisUsername(), getRedisPassword()); - if (shardInfo == null && clientConfiguration instanceof MutableJedisClientConfiguration) { - - providedShardInfo = false; - shardInfo = new JedisShardInfo(getHostName(), getPort(), isUseSsl(), // - clientConfiguration.getSslSocketFactory().orElse(null), // - clientConfiguration.getSslParameters().orElse(null), // - clientConfiguration.getHostnameVerifier().orElse(null)); - - getRedisPassword().map(String::new).ifPresent(shardInfo::setPassword); - String username = getRedisUsername(); - if (StringUtils.hasText(username)) { - shardInfo.setUser(username); - } - - int readTimeout = getReadTimeout(); - - if (readTimeout > 0) { - shardInfo.setSoTimeout(readTimeout); - } - - getMutableConfiguration().setShardInfo(shardInfo); - } - if (getUsePool() && !isRedisClusterAware()) { this.pool = createPool(); } @@ -630,34 +583,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, standaloneConfig.setPort(port); } - /** - * Returns the shardInfo. - * - * @return the shardInfo. - * @deprecated since 2.0. - */ - @Deprecated - @Nullable - public JedisShardInfo getShardInfo() { - return shardInfo; - } - - /** - * Sets the shard info for this factory. - * - * @param shardInfo the shardInfo to set. - * @deprecated since 2.0, configure the individual properties from {@link JedisShardInfo} using - * {@link JedisClientConfiguration}. - * @throws IllegalStateException if {@link JedisClientConfiguration} is immutable. - */ - @Deprecated - public void setShardInfo(JedisShardInfo shardInfo) { - - this.shardInfo = shardInfo; - this.providedShardInfo = true; - getMutableConfiguration().setShardInfo(shardInfo); - } - /** * Returns the timeout. * @@ -968,7 +893,6 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, public static JedisClientConfiguration create(JedisShardInfo shardInfo) { MutableJedisClientConfiguration configuration = new MutableJedisClientConfiguration(); - configuration.setShardInfo(shardInfo); return configuration; } @@ -1060,14 +984,5 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean, this.connectTimeout = connectTimeout; } - public void setShardInfo(JedisShardInfo shardInfo) { - - setSslSocketFactory(shardInfo.getSslSocketFactory()); - setSslParameters(shardInfo.getSslParameters()); - setHostnameVerifier(shardInfo.getHostnameVerifier()); - setUseSsl(shardInfo.getSsl()); - setConnectTimeout(Duration.ofMillis(shardInfo.getConnectionTimeout())); - setReadTimeout(Duration.ofMillis(shardInfo.getSoTimeout())); - } } } diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java index 105661bf5..fa10a250f 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java @@ -41,7 +41,6 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import org.springframework.core.convert.converter.Converter; -import org.springframework.dao.DataAccessException; import org.springframework.data.geo.Distance; import org.springframework.data.geo.GeoResult; import org.springframework.data.geo.GeoResults; @@ -70,7 +69,6 @@ import org.springframework.data.redis.connection.SortParameters.Range; import org.springframework.data.redis.connection.ValueEncoding; import org.springframework.data.redis.connection.convert.Converters; import org.springframework.data.redis.connection.convert.ListConverter; -import org.springframework.data.redis.connection.convert.MapConverter; import org.springframework.data.redis.connection.convert.SetConverter; import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter; import org.springframework.data.redis.connection.zset.DefaultTuple; @@ -95,10 +93,9 @@ import org.springframework.util.StringUtils; * @author Guy Korland * @author dengliming */ +@SuppressWarnings("ConstantConditions") public abstract class JedisConverters extends Converters { - private static final Converter EXCEPTION_CONVERTER = new JedisExceptionConverter(); - public static final byte[] PLUS_BYTES; public static final byte[] MINUS_BYTES; public static final byte[] POSITIVE_INFINITY_BYTES; @@ -122,56 +119,19 @@ public abstract class JedisConverters extends Converters { * @return * @since 1.4 */ - public static ListConverter tuplesToTuples() { + static ListConverter tuplesToTuples() { return new ListConverter<>(JedisConverters::toTuple); } - public static ListConverter stringListToByteList() { + static ListConverter stringListToByteList() { return new ListConverter<>(stringToBytes()); } /** * @deprecated since 2.5 */ - @Deprecated - public static SetConverter stringSetToByteSet() { - return new SetConverter<>(stringToBytes()); - } - - /** - * @deprecated since 2.5 - */ - @Deprecated - public static MapConverter stringMapToByteMap() { - return new MapConverter<>(stringToBytes()); - } - - /** - * @deprecated since 2.5 - */ - @Deprecated - public static SetConverter tupleSetToTupleSet() { - return new SetConverter<>(JedisConverters::toTuple); - } - - public static Converter exceptionConverter() { - return EXCEPTION_CONVERTER; - } - - public static String[] toStrings(byte[][] source) { - String[] result = new String[source.length]; - for (int i = 0; i < source.length; i++) { - result[i] = SafeEncoder.encode(source[i]); - } - return result; - } - - /** - * @deprecated since 2.5 - */ - @Deprecated - public static Set toTupleSet(Set source) { - return tupleSetToTupleSet().convert(source); + static Set toTupleSet(Set source) { + return new SetConverter<>(JedisConverters::toTuple).convert(source); } public static Tuple toTuple(redis.clients.jedis.Tuple source) { @@ -192,18 +152,8 @@ public abstract class JedisConverters extends Converters { Map args = new LinkedHashMap<>(tuples.size(), 1); Set scores = new HashSet<>(tuples.size(), 1); - boolean isAtLeastJedis24 = JedisVersionUtil.atLeastJedis24(); - for (Tuple tuple : tuples) { - - if (!isAtLeastJedis24) { - if (scores.contains(tuple.getScore())) { - throw new UnsupportedOperationException( - "Bulk add of multiple elements with the same score is not supported. Add the elements individually."); - } - scores.add(tuple.getScore()); - } - + scores.add(tuple.getScore()); args.put(tuple.getValue(), tuple.getScore()); } @@ -292,14 +242,6 @@ public abstract class JedisConverters extends Converters { return toList(it -> RedisServer.newServerFrom(Converters.toProperties(it)), source); } - /** - * @deprecated since 2.5 - */ - @Deprecated - public static DataAccessException toDataAccessException(Exception ex) { - return EXCEPTION_CONVERTER.convert(ex); - } - public static ListPosition toListPosition(Position source) { Assert.notNull(source, "list positions are mandatory"); return (Position.AFTER.equals(source) ? ListPosition.AFTER : ListPosition.BEFORE); @@ -609,26 +551,9 @@ public abstract class JedisConverters extends Converters { return target; } - /** - * @deprecated since 2.5 - */ - @Deprecated - public static ListConverter bytesListToStringListConverter() { - return new ListConverter<>(JedisConverters::toString); - } - - /** - * @deprecated since 2.5 - */ - @Deprecated - public static ListConverter getBytesListToLongListConverter() { - return new ListConverter<>(JedisConverters::toLong); - } - /** * @return * @since 1.8 - * @deprecated since 2.5 */ public static ListConverter geoCoordinateToPointConverter() { return new ListConverter<>(JedisConverters::toPoint); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java index 22392fee1..278793faf 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java @@ -41,6 +41,8 @@ import org.springframework.data.redis.TooManyClusterRedirectionsException; */ public class JedisExceptionConverter implements Converter { + static final JedisExceptionConverter INSTANCE = new JedisExceptionConverter(); + public DataAccessException convert(Exception ex) { if (ex instanceof DataAccessException) { diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java deleted file mode 100644 index f87c5cb57..000000000 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisUtils.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright 2011-2022 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 - * - * https://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.jedis; - -import redis.clients.jedis.BinaryJedisPubSub; -import redis.clients.jedis.ListPosition; -import redis.clients.jedis.Protocol; -import redis.clients.jedis.SortingParams; -import redis.clients.jedis.exceptions.JedisConnectionException; -import redis.clients.jedis.exceptions.JedisDataException; -import redis.clients.jedis.exceptions.JedisException; -import redis.clients.jedis.util.SafeEncoder; - -import java.io.IOException; -import java.io.StringReader; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.TimeoutException; - -import org.springframework.dao.DataAccessException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.data.redis.RedisConnectionFailureException; -import org.springframework.data.redis.RedisSystemException; -import org.springframework.data.redis.connection.MessageListener; -import org.springframework.data.redis.connection.RedisListCommands.Position; -import org.springframework.data.redis.connection.ReturnType; -import org.springframework.data.redis.connection.SortParameters; -import org.springframework.data.redis.connection.SortParameters.Order; -import org.springframework.data.redis.connection.SortParameters.Range; -import org.springframework.data.redis.connection.zset.DefaultTuple; -import org.springframework.data.redis.connection.zset.Tuple; -import org.springframework.util.Assert; - -/** - * Helper class featuring methods for Jedis connection handling, providing support for exception translation. Deprecated - * in favor of {@link JedisConverters} - * - * @author Costin Leau - * @author Jennifer Hickey - */ -@Deprecated -public abstract class JedisUtils { - - private static final String OK_CODE = "OK"; - private static final String OK_MULTI_CODE = "+OK"; - private static final byte[] ONE = new byte[] { '1' }; - private static final byte[] ZERO = new byte[] { '0' }; - - /** - * Converts the given, native Jedis exception to Spring's DAO hierarchy. - * - * @param ex Jedis exception - * @return converted exception - */ - public static DataAccessException convertJedisAccessException(JedisException ex) { - if (ex instanceof JedisDataException) { - return new InvalidDataAccessApiUsageException(ex.getMessage(), ex); - } - if (ex instanceof JedisConnectionException) { - return new RedisConnectionFailureException(ex.getMessage(), ex); - } - - // fallback to invalid data exception - return new InvalidDataAccessApiUsageException(ex.getMessage(), ex); - } - - /** - * Converts the given, native, runtime Jedis exception to Spring's DAO hierarchy. - * - * @param ex Jedis runtime/unchecked exception - * @return converted exception - */ - public static DataAccessException convertJedisAccessException(RuntimeException ex) { - if (ex instanceof JedisException) { - return convertJedisAccessException((JedisException) ex); - } - - return null; - } - - static DataAccessException convertJedisAccessException(IOException ex) { - if (ex instanceof UnknownHostException) { - return new RedisConnectionFailureException("Unknown host " + ex.getMessage(), ex); - } - return new RedisConnectionFailureException("Could not connect to Redis server", ex); - } - - static DataAccessException convertJedisAccessException(TimeoutException ex) { - throw new RedisConnectionFailureException("Jedis pool timed out. Could not get Redis Connection", ex); - } - - static boolean isStatusOk(String status) { - return status != null && (OK_CODE.equals(status) || OK_MULTI_CODE.equals(status)); - } - - /** - * Deprecated. Use #{@link JedisConverters#toBoolean(Long)} - */ - @Deprecated - static Boolean convertCodeReply(Number code) { - return (code != null ? code.intValue() == 1 : null); - } - - /** - * Deprecated. Use #{@link JedisConverters#toTupleSet(Set)} - */ - @Deprecated - static Set convertJedisTuple(Set tuples) { - Set value = new LinkedHashSet<>(tuples.size()); - for (redis.clients.jedis.Tuple tuple : tuples) { - value.add(new DefaultTuple(tuple.getBinaryElement(), tuple.getScore())); - } - - return value; - } - - static byte[][] convert(Map hgetAll) { - byte[][] result = new byte[hgetAll.size() * 2][]; - - int index = 0; - for (Map.Entry entry : hgetAll.entrySet()) { - result[index++] = entry.getKey(); - result[index++] = entry.getValue(); - } - return result; - } - - /** - * Deprecated. Implement a method in {@link JedisConverters} instead - */ - @Deprecated - static Map convert(String[] fields, String[] values) { - Map result = new LinkedHashMap<>(fields.length); - - for (int i = 0; i < values.length; i++) { - result.put(fields[i], values[i]); - } - return result; - } - - /** - * Deprecated. Implement a method in {@link JedisConverters} instead - */ - @Deprecated - static String[] arrange(String[] keys, String[] values) { - String[] result = new String[keys.length * 2]; - - for (int i = 0; i < keys.length; i++) { - int index = i << 1; - result[index] = keys[i]; - result[index + 1] = values[i]; - - } - return result; - } - - static SortingParams convertSortParams(SortParameters params) { - SortingParams jedisParams = null; - - if (params != null) { - jedisParams = new SortingParams(); - - byte[] byPattern = params.getByPattern(); - if (byPattern != null) { - jedisParams.by(params.getByPattern()); - } - - byte[][] getPattern = params.getGetPattern(); - if (getPattern != null) { - jedisParams.get(getPattern); - } - - Range limit = params.getLimit(); - if (limit != null) { - jedisParams.limit((int) limit.getStart(), (int) limit.getCount()); - } - Order order = params.getOrder(); - if (order != null && order.equals(Order.DESC)) { - jedisParams.desc(); - } - Boolean isAlpha = params.isAlphabetic(); - if (isAlpha != null && isAlpha) { - jedisParams.alpha(); - } - } - - return jedisParams; - } - - /** - * Deprecated. Use #{@link JedisConverters#toBit(Boolean)} - */ - @Deprecated - static byte[] asBit(boolean value) { - return (value ? ONE : ZERO); - } - - static ListPosition convertPosition(Position where) { - Assert.notNull(where, "list positions are mandatory"); - return (Position.AFTER.equals(where) ? ListPosition.AFTER : ListPosition.BEFORE); - } - - /** - * Deprecated. Use #{@link JedisConverters#toProperties(String)} - */ - @Deprecated - static Properties info(String string) { - Properties info = new Properties(); - StringReader stringReader = new StringReader(string); - try { - info.load(stringReader); - } catch (Exception ex) { - throw new RedisSystemException("Cannot read Redis info", ex); - } finally { - stringReader.close(); - } - return info; - } - - static BinaryJedisPubSub adaptPubSub(MessageListener listener) { - return new JedisMessageListener(listener); - } - - /** - * Deprecated. Use #{@link JedisConverters#toStrings(byte[][])} - */ - @Deprecated - static String[] convert(byte[]... raw) { - String[] result = new String[raw.length]; - - for (int i = 0; i < raw.length; i++) { - result[i] = SafeEncoder.encode(raw[i]); - } - - return result; - } - - static byte[][] bXPopArgs(int timeout, byte[]... keys) { - List args = new ArrayList<>(); - for (byte[] arg : keys) { - args.add(arg); - } - args.add(Protocol.toByteArray(timeout)); - return args.toArray(new byte[args.size()][]); - } - - /** - * Deprecated. Use #{@link JedisConverters#toBytes(Integer)} - */ - @Deprecated - static byte[] asBytes(int number) { - return String.valueOf(number).getBytes(); - } - - /** - * Deprecated. Use #{@link JedisConverters#toString(byte[])} - */ - @Deprecated - static String asString(byte[] raw) { - return SafeEncoder.encode(raw); - } - - @SuppressWarnings("unchecked") - static Object convertScriptReturn(ReturnType returnType, Object result) { - if (result instanceof String) { - // evalsha converts byte[] to String. Convert back for consistency - return SafeEncoder.encode((String) result); - } - if (returnType == ReturnType.STATUS) { - return JedisUtils.asString((byte[]) result); - } - if (returnType == ReturnType.BOOLEAN) { - // Lua false comes back as a null bulk reply - if (result == null) { - return Boolean.FALSE; - } - return ((Long) result == 1); - } - if (returnType == ReturnType.MULTI) { - List resultList = (List) result; - List convertedResults = new ArrayList<>(); - for (Object res : resultList) { - if (res instanceof String) { - // evalsha converts byte[] to String. Convert back for consistency - convertedResults.add(SafeEncoder.encode((String) res)); - } else { - convertedResults.add(res); - } - } - return convertedResults; - } - return result; - } - -} diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisVersionUtil.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisVersionUtil.java deleted file mode 100644 index 06149f6e8..000000000 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisVersionUtil.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2014-2022 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 - * - * https://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.jedis; - -import redis.clients.jedis.Jedis; - -import java.io.IOException; -import java.util.Properties; - -import org.springframework.core.io.support.PropertiesLoaderUtils; -import org.springframework.data.util.Version; -import org.springframework.util.StringUtils; - -/** - * @author Christoph Strobl - * @since 1.3 - */ -public class JedisVersionUtil { - - private static Version jedisVersion = parseVersion(resolveJedisVersion()); - - /** - * @return current {@link redis.clients.jedis.Jedis} version. - */ - public static Version jedisVersion() { - return jedisVersion; - } - - /** - * Parse version string {@literal eg. 1.1.1} to {@link Version}. - * - * @param version - * @return - */ - static Version parseVersion(String version) { - return Version.parse(version); - } - - /** - * @return true if used jedis version is at minimum {@literal 2.4}. - */ - public static boolean atLeastJedis24() { - return atLeast("2.4"); - } - - private static String resolveJedisVersion() { - - String version = Jedis.class.getPackage().getImplementationVersion(); - - if (!StringUtils.hasText(version)) { - try { - Properties props = PropertiesLoaderUtils.loadAllProperties("META-INF/maven/redis.clients/jedis/pom.properties"); - if (props.containsKey("version")) { - version = props.getProperty("version"); - } - } catch (IOException e) { - // ignore this one - } - } - return version; - } - - /** - * Compares given version string against current jedis version. - * - * @param version - * @return true in case given version is greater than equal to current one. - */ - public static boolean atLeast(String version) { - return jedisVersion.compareTo(parseVersion(version)) >= 0; - } - - /** - * Compares given version string against current jedis version. - * - * @param version - * @return true in case given version is less than equal to current one. - */ - public static boolean atMost(String version) { - return jedisVersion.compareTo(parseVersion(version)) <= 0; - } - -} diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java index 1180def27..f2322f042 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java @@ -51,7 +51,6 @@ import org.springframework.data.redis.connection.RedisStringCommands.SetOption; import org.springframework.data.redis.connection.RedisZSetCommands.Range.Boundary; import org.springframework.data.redis.connection.SortParameters.Order; import org.springframework.data.redis.connection.convert.Converters; -import org.springframework.data.redis.connection.convert.LongToBooleanConverter; import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter; import org.springframework.data.redis.connection.zset.DefaultTuple; import org.springframework.data.redis.connection.zset.Tuple; @@ -124,12 +123,16 @@ public abstract class LettuceConverters extends Converters { }; } + public static boolean toBoolean(long value) { + return value == 1; + } + /** * @return * @sice 1.3 */ public static Converter longToBooleanConverter() { - return LongToBooleanConverter.INSTANCE; + return Converters::toBoolean; } public static Long toLong(@Nullable Date source) { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java index 15902f657..6298a1b44 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java @@ -97,13 +97,13 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null."); - Assert.notNull(command.getNewName(), "NewName must not be null!"); + Assert.notNull(command.getNewKey(), "NewName must not be null!"); - if (ClusterSlotHashUtil.isSameSlotForAllKeys(command.getKey(), command.getNewName())) { + if (ClusterSlotHashUtil.isSameSlotForAllKeys(command.getKey(), command.getNewKey())) { return super.renameNX(Mono.just(command)); } - Mono result = cmd.exists(command.getNewName()).flatMap(exists -> { + Mono result = cmd.exists(command.getNewKey()).flatMap(exists -> { if (exists == 1) { return Mono.just(Boolean.FALSE); @@ -112,8 +112,8 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple return cmd.dump(command.getKey()) .switchIfEmpty(Mono.error(new RedisSystemException("Cannot rename key that does not exist", new RedisException("ERR no such key.")))) - .flatMap(value -> cmd.restore(command.getNewName(), 0, value).flatMap(res -> cmd.del(command.getKey()))) - .map(LettuceConverters.longToBooleanConverter()::convert); + .flatMap(value -> cmd.restore(command.getNewKey(), 0, value).flatMap(res -> cmd.del(command.getKey()))) + .map(LettuceConverters::toBoolean); }); return result.map(val -> new BooleanResponse<>(command, val)); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java index e2fb09dc6..01c22986d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java @@ -142,9 +142,9 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); - Assert.notNull(command.getNewName(), "New name must not be null!"); + Assert.notNull(command.getNewKey(), "New name must not be null!"); - return cmd.rename(command.getKey(), command.getNewName()).map(LettuceConverters::stringToBoolean) + return cmd.rename(command.getKey(), command.getNewKey()).map(LettuceConverters::stringToBoolean) .map(value -> new BooleanResponse<>(command, value)); })); } @@ -155,9 +155,9 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); - Assert.notNull(command.getNewName(), "New name must not be null!"); + Assert.notNull(command.getNewKey(), "New name must not be null!"); - return cmd.renamenx(command.getKey(), command.getNewName()).map(value -> new BooleanResponse<>(command, value)); + return cmd.renamenx(command.getKey(), command.getNewKey()).map(value -> new BooleanResponse<>(command, value)); })); } diff --git a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java index da6a56d0f..f1eba8d4b 100644 --- a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java +++ b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java @@ -191,7 +191,7 @@ abstract class AbstractOperations { byte[][] rawKeys = new byte[2][]; rawKeys[0] = rawKey(key); - rawKeys[1] = rawKey(key); + rawKeys[1] = rawKey(otherKey); return rawKeys; } diff --git a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java index 73c69f58a..f2810a4f3 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java @@ -52,21 +52,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Long add(Point point, M member); - /** - * Add {@link Point} with given member {@literal name} to {@literal key}. - * - * @param point must not be {@literal null}. - * @param member must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Point, Object)}. - */ - @Deprecated - @Nullable - default Long geoAdd(Point point, M member) { - return add(point, member); - } - /** * Add {@link GeoLocation} to {@literal key}. * @@ -78,20 +63,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Long add(GeoLocation location); - /** - * Add {@link GeoLocation} to {@literal key}. - * - * @param location must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(GeoLocation)}. - */ - @Deprecated - @Nullable - default Long geoAdd(GeoLocation location) { - return add(location); - } - /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. * @@ -103,20 +74,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Long add(Map memberCoordinateMap); - /** - * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * - * @param memberCoordinateMap must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Map)}. - */ - @Deprecated - @Nullable - default Long geoAdd(Map memberCoordinateMap) { - return add(memberCoordinateMap); - } - /** * Add {@link GeoLocation}s to {@literal key} * @@ -128,20 +85,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Long add(Iterable> locations); - /** - * Add {@link GeoLocation}s to {@literal key} - * - * @param locations must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Iterable)}. - */ - @Deprecated - @Nullable - default Long geoAdd(Iterable> locations) { - return add(locations); - } - /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. * @@ -154,21 +97,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Distance distance(M member1, M member2); - /** - * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * - * @param member1 must not be {@literal null}. - * @param member2 must not be {@literal null}. - * @return can be {@literal null}. - * @see Redis Documentation: GEODIST - * @deprecated since 2.0, use {@link #distance(Object, Object)}. - */ - @Deprecated - @Nullable - default Distance geoDist(M member1, M member2) { - return distance(member1, member2); - } - /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. * @@ -182,22 +110,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Distance distance(M member1, M member2, Metric metric); - /** - * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * - * @param member1 must not be {@literal null}. - * @param member2 must not be {@literal null}. - * @param metric must not be {@literal null}. - * @return can be {@literal null}. - * @see Redis Documentation: GEODIST - * @deprecated since 2.0, use {@link #distance(Object, Object, Metric)}. - */ - @Deprecated - @Nullable - default Distance geoDist(M member1, M member2, Metric metric) { - return distance(member1, member2, metric); - } - /** * Get Geohash representation of the position for one or more {@literal member}s. * @@ -209,20 +121,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable List hash(M... members); - /** - * Get Geohash representation of the position for one or more {@literal member}s. - * - * @param members must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEOHASH - * @deprecated since 2.0, use {@link #hash(Object[])}. - */ - @Deprecated - @Nullable - default List geoHash(M... members) { - return hash(members); - } - /** * Get the {@link Point} representation of positions for one or more {@literal member}s. * @@ -234,19 +132,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable List position(M... members); - /** - * Get the {@link Point} representation of positions for one or more {@literal member}s. - * - * @param members must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEOPOS - * @deprecated since 2.0, use {@link #position(Object[])}. - */ - @Deprecated - @Nullable - default List geoPos(M... members) { - return position(members); - } /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. @@ -259,20 +144,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable GeoResults> radius(Circle within); - /** - * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * - * @param within must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUS - * @deprecated since 2.0, use {@link #radius(Circle)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadius(Circle within) { - return radius(within); - } - /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. * @@ -285,23 +156,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable GeoResults> radius(Circle within, GeoRadiusCommandArgs args); - /** - * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * - * @param within must not be {@literal null}. - * @param args must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUS - * @deprecated since 2.0, use {@link #radius(Circle, GeoRadiusCommandArgs)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadius(Circle within, GeoRadiusCommandArgs args) { - return radius(within, args); - } - - // TODO: Bound ops should not accept K key - /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. @@ -313,23 +167,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { * @see Redis Documentation: GEORADIUSBYMEMBER */ @Nullable - GeoResults> radius(K key, M member, double radius); - - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius}. - * - * @param member must not be {@literal null}. - * @param radius - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Object, double)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(K key, M member, double radius) { - return radius(key, member, radius); - } + GeoResults> radius(M member, double radius); /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given @@ -344,22 +182,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable GeoResults> radius(M member, Distance distance); - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius} applying {@link Metric}. - * - * @param member must not be {@literal null}. - * @param distance must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Distance)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(M member, Distance distance) { - return radius(member, distance); - } - /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. @@ -374,23 +196,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable GeoResults> radius(M member, Distance distance, GeoRadiusCommandArgs args); - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * - * @param member must not be {@literal null}. - * @param distance must not be {@literal null}. - * @param args must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Distance, GeoRadiusCommandArgs)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(M member, Distance distance, GeoRadiusCommandArgs args) { - return radius(member, distance, args); - } - /** * Remove the {@literal member}s. * @@ -401,19 +206,6 @@ public interface BoundGeoOperations extends BoundKeyOperations { @Nullable Long remove(M... members); - /** - * Remove the {@literal member}s. - * - * @param members must not be {@literal null}. - * @return Number of elements removed. {@literal null} when used in pipeline / transaction. - * @deprecated since 2.0, use {@link #remove(Object[])}. - */ - @Deprecated - @Nullable - default Long geoRemove(M... members) { - return remove(members); - } - /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. * diff --git a/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java index 46d98756b..191ead24f 100644 --- a/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java +++ b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java @@ -31,8 +31,8 @@ import org.springframework.util.Assert; */ public class ConvertingCursor implements Cursor { - private Cursor delegate; - private Converter converter; + private final Cursor delegate; + private final Converter converter; /** * @param cursor Cursor must not be {@literal null}. @@ -77,12 +77,6 @@ public class ConvertingCursor implements Cursor { return delegate.isClosed(); } - @Override - public Cursor open() { - this.delegate = delegate.open(); - return this; - } - @Override public long getPosition() { return delegate.getPosition(); diff --git a/src/main/java/org/springframework/data/redis/core/Cursor.java b/src/main/java/org/springframework/data/redis/core/Cursor.java index ab27df8cd..9f865303c 100644 --- a/src/main/java/org/springframework/data/redis/core/Cursor.java +++ b/src/main/java/org/springframework/data/redis/core/Cursor.java @@ -48,16 +48,6 @@ public interface Cursor extends CloseableIterator { */ boolean isClosed(); - /** - * Opens cursor and returns itself. This method is intended to be called by components constructing a {@link Cursor} - * and should not be called externally. - * - * @return the opened cursor. - * @deprecated to be removed from the interface in the next major version. - */ - @Deprecated - Cursor open(); - /** * @return the current position of the cursor. */ diff --git a/src/main/java/org/springframework/data/redis/core/DefaultBoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultBoundGeoOperations.java index ad88d8025..d78ecd845 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultBoundGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultBoundGeoOperations.java @@ -105,7 +105,7 @@ class DefaultBoundGeoOperations extends DefaultBoundKeyOperations imple } @Override - public GeoResults> radius(K key, M member, double radius) { + public GeoResults> radius(M member, double radius) { return ops.radius(getKey(), member, radius); } diff --git a/src/main/java/org/springframework/data/redis/core/GeoOperations.java b/src/main/java/org/springframework/data/redis/core/GeoOperations.java index 27af3a805..88b0b9e64 100644 --- a/src/main/java/org/springframework/data/redis/core/GeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/GeoOperations.java @@ -56,22 +56,6 @@ public interface GeoOperations { @Nullable Long add(K key, Point point, M member); - /** - * Add {@link Point} with given member {@literal name} to {@literal key}. - * - * @param key must not be {@literal null}. - * @param point must not be {@literal null}. - * @param member must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Object, Point, Object)}. - */ - @Deprecated - @Nullable - default Long geoAdd(K key, Point point, M member) { - return add(key, point, member); - } - /** * Add {@link GeoLocation} to {@literal key}. * @@ -84,21 +68,6 @@ public interface GeoOperations { @Nullable Long add(K key, GeoLocation location); - /** - * Add {@link GeoLocation} to {@literal key}. - * - * @param key must not be {@literal null}. - * @param location must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Object, GeoLocation)}. - */ - @Deprecated - @Nullable - default Long geoAdd(K key, GeoLocation location) { - return add(key, location); - } - /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. * @@ -111,21 +80,6 @@ public interface GeoOperations { @Nullable Long add(K key, Map memberCoordinateMap); - /** - * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * - * @param key must not be {@literal null}. - * @param memberCoordinateMap must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Object, Map)}. - */ - @Deprecated - @Nullable - default Long geoAdd(K key, Map memberCoordinateMap) { - return add(key, memberCoordinateMap); - } - /** * Add {@link GeoLocation}s to {@literal key} * @@ -138,21 +92,6 @@ public interface GeoOperations { @Nullable Long add(K key, Iterable> locations); - /** - * Add {@link GeoLocation}s to {@literal key} - * - * @param key must not be {@literal null}. - * @param locations must not be {@literal null}. - * @return Number of elements added. {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: GEOADD - * @deprecated since 2.0, use {@link #add(Object, Iterable)}. - */ - @Deprecated - @Nullable - default Long geoAdd(K key, Iterable> locations) { - return add(key, locations); - } - /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. * @@ -166,22 +105,6 @@ public interface GeoOperations { @Nullable Distance distance(K key, M member1, M member2); - /** - * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * - * @param key must not be {@literal null}. - * @param member1 must not be {@literal null}. - * @param member2 must not be {@literal null}. - * @return can be {@literal null}. - * @see Redis Documentation: GEODIST - * @deprecated since 2.0, use {@link #distance(Object, Object, Object)}. - */ - @Deprecated - @Nullable - default Distance geoDist(K key, M member1, M member2) { - return distance(key, member1, member2); - } - /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. * @@ -196,23 +119,6 @@ public interface GeoOperations { @Nullable Distance distance(K key, M member1, M member2, Metric metric); - /** - * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * - * @param key must not be {@literal null}. - * @param member1 must not be {@literal null}. - * @param member2 must not be {@literal null}. - * @param metric must not be {@literal null}. - * @return can be {@literal null}. - * @see Redis Documentation: GEODIST - * @deprecated since 2.0, use {@link #distance(Object, Object, Object, Metric)}. - */ - @Deprecated - @Nullable - default Distance geoDist(K key, M member1, M member2, Metric metric) { - return distance(key, member1, member2, metric); - } - /** * Get Geohash representation of the position for one or more {@literal member}s. * @@ -225,21 +131,6 @@ public interface GeoOperations { @Nullable List hash(K key, M... members); - /** - * Get Geohash representation of the position for one or more {@literal member}s. - * - * @param key must not be {@literal null}. - * @param members must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEOHASH - * @deprecated since 2.0, use {@link #hash(Object, Object[])}. - */ - @Deprecated - @Nullable - default List geoHash(K key, M... members) { - return hash(key, members); - } - /** * Get the {@link Point} representation of positions for one or more {@literal member}s. * @@ -252,21 +143,6 @@ public interface GeoOperations { @Nullable List position(K key, M... members); - /** - * Get the {@link Point} representation of positions for one or more {@literal member}s. - * - * @param key must not be {@literal null}. - * @param members must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEOPOS - * @deprecated since 2.0, use {@link #position(Object, Object[])}. - */ - @Deprecated - @Nullable - default List geoPos(K key, M... members) { - return position(key, members); - } - /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. * @@ -279,21 +155,6 @@ public interface GeoOperations { @Nullable GeoResults> radius(K key, Circle within); - /** - * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * - * @param key must not be {@literal null}. - * @param within must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUS - * @deprecated since 2.0, use {@link #radius(Object, Circle)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadius(K key, Circle within) { - return radius(key, within); - } - /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. * @@ -307,22 +168,6 @@ public interface GeoOperations { @Nullable GeoResults> radius(K key, Circle within, GeoRadiusCommandArgs args); - /** - * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * - * @param key must not be {@literal null}. - * @param within must not be {@literal null}. - * @param args must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUS - * @deprecated since 2.0, use {@link #radius(Object, Circle, GeoRadiusCommandArgs)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadius(K key, Circle within, GeoRadiusCommandArgs args) { - return radius(key, within, args); - } - /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. @@ -337,23 +182,6 @@ public interface GeoOperations { @Nullable GeoResults> radius(K key, M member, double radius); - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius}. - * - * @param key must not be {@literal null}. - * @param member must not be {@literal null}. - * @param radius - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Object, double)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(K key, M member, double radius) { - return radius(key, member, radius); - } - /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric}. @@ -368,23 +196,6 @@ public interface GeoOperations { @Nullable GeoResults> radius(K key, M member, Distance distance); - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius} applying {@link Metric}. - * - * @param key must not be {@literal null}. - * @param member must not be {@literal null}. - * @param distance must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Object, Distance)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(K key, M member, Distance distance) { - return radius(key, member, distance); - } - /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. @@ -400,24 +211,6 @@ public interface GeoOperations { @Nullable GeoResults> radius(K key, M member, Distance distance, GeoRadiusCommandArgs args); - /** - * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given - * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * - * @param key must not be {@literal null}. - * @param member must not be {@literal null}. - * @param distance must not be {@literal null}. - * @param args must not be {@literal null}. - * @return never {@literal null} unless used in pipeline / transaction. - * @see Redis Documentation: GEORADIUSBYMEMBER - * @deprecated since 2.0, use {@link #radius(Object, Object, Distance, GeoRadiusCommandArgs)}. - */ - @Deprecated - @Nullable - default GeoResults> geoRadiusByMember(K key, M member, Distance distance, GeoRadiusCommandArgs args) { - return radius(key, member, distance, args); - } - /** * Remove the {@literal member}s. * @@ -429,20 +222,6 @@ public interface GeoOperations { @Nullable Long remove(K key, M... members); - /** - * Remove the {@literal member}s. - * - * @param key must not be {@literal null}. - * @param members must not be {@literal null}. - * @return Number of elements removed. {@literal null} when used in pipeline / transaction. - * @deprecated since 2.0, use {@link #remove(Object, Object[])}. - */ - @Deprecated - @Nullable - default Long geoRemove(K key, M... members) { - return remove(key, members); - } - /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. * diff --git a/src/main/java/org/springframework/data/redis/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java index fb69f2c6e..4e959adaf 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java +++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.java @@ -141,8 +141,6 @@ public enum RedisCommand { // -- R RANDOMKEY("r", 0, 0), // - @Deprecated - RANAME("w", 2, 2), // RENAME("w", 2, 2), // RENAMENX("w", 2, 2), // REPLICAOF("w", 2), // diff --git a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java index 08d38d552..6970ba0e7 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java +++ b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java @@ -267,22 +267,6 @@ public abstract class RedisConnectionUtils { doCloseConnection(conn); } - /** - * Closes the given {@link RedisConnection}, created via the given factory if not managed externally (i.e. not bound - * to the transaction). - * - * @param conn the Redis connection to close. - * @param factory the Redis factory that the connection was created with. - * @param transactionSupport whether transaction support is enabled. - * @since 2.1.9 - * @deprecated since 2.4.2, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory)} - */ - @Deprecated - public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory, - boolean transactionSupport) { - releaseConnection(conn, factory); - } - /** * Determine whether the given two RedisConnections are equal, asking the target {@link RedisConnection} in case of a * proxy. Used to detect equality even if the user passed in a raw target Connection while the held one is a proxy. diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java index be3e237e7..922a3523d 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java +++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java @@ -44,7 +44,6 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.core.PartialUpdate.PropertyUpdate; import org.springframework.data.redis.core.PartialUpdate.UpdateCommand; import org.springframework.data.redis.core.RedisKeyValueAdapter.RedisUpdateObject.Index; -import org.springframework.data.redis.core.convert.CustomConversions; import org.springframework.data.redis.core.convert.GeoIndexedPropertyValue; import org.springframework.data.redis.core.convert.KeyspaceConfiguration; import org.springframework.data.redis.core.convert.MappingRedisConverter; @@ -140,21 +139,6 @@ public class RedisKeyValueAdapter extends AbstractKeyValueAdapter this(redisOps, mappingContext, new RedisCustomConversions()); } - /** - * Creates new {@link RedisKeyValueAdapter}. - * - * @param redisOps must not be {@literal null}. - * @param mappingContext must not be {@literal null}. - * @param customConversions can be {@literal null}. - * @deprecated since 2.0, use - * {@link #RedisKeyValueAdapter(RedisOperations, RedisMappingContext, org.springframework.data.convert.CustomConversions)}. - */ - @Deprecated - public RedisKeyValueAdapter(RedisOperations redisOps, RedisMappingContext mappingContext, - CustomConversions customConversions) { - this(redisOps, mappingContext, (org.springframework.data.convert.CustomConversions) customConversions); - } - /** * Creates new {@link RedisKeyValueAdapter}. * diff --git a/src/main/java/org/springframework/data/redis/core/RedisTemplate.java b/src/main/java/org/springframework/data/redis/core/RedisTemplate.java index 1ddc971e9..cc9b4af92 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisTemplate.java +++ b/src/main/java/org/springframework/data/redis/core/RedisTemplate.java @@ -222,7 +222,7 @@ public class RedisTemplate extends RedisAccessor implements RedisOperation return postProcessResult(result, connToUse, existingConnection); } finally { - RedisConnectionUtils.releaseConnection(conn, factory, enableTransactionSupport); + RedisConnectionUtils.releaseConnection(conn, factory); } } diff --git a/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java b/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java deleted file mode 100644 index d132bb7ae..000000000 --- a/src/main/java/org/springframework/data/redis/core/convert/CustomConversions.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011-2022 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 - * - * https://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.core.convert; - -import java.util.List; - -/** - * Value object to capture custom conversion. That is essentially a {@link List} of converters and some additional logic - * around them. - * - * @author Olivyer Gierke - * @author Thomas Darimont - * @author Christoph Strobl - * @author Mark Paluch - * @since 1.7 - * @deprecated since 2.0, use {@link RedisCustomConversions}. - */ -@Deprecated -public class CustomConversions extends RedisCustomConversions { - - /** - * Creates an empty {@link CustomConversions} object. - */ - public CustomConversions() {} - - /** - * Creates a new {@link CustomConversions} instance registering the given converters. - * - * @param converters - */ - public CustomConversions(List converters) { - super(converters); - } -} diff --git a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java index 1697c854f..8233e3496 100644 --- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java +++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java @@ -1195,12 +1195,6 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean { public static final String DELIMITER = ":"; public static final String PHANTOM_SUFFIX = DELIMITER + PHANTOM; - /** - * @deprecated since 2.6. Please use {@link #DELIMITER} instead. - */ - @Deprecated(/* since="2.6" */) - public static final String DELIMITTER = DELIMITER; - private final String keyspace; private final String id; private final boolean phantomKey; @@ -1281,12 +1275,6 @@ public class MappingRedisConverter implements RedisConverter, InitializingBean { public static final byte DELIMITER = ':'; public static final byte[] PHANTOM_SUFFIX = ByteUtils.concat(new byte[] { DELIMITER }, PHANTOM); - /** - * @deprecated since 2.6. Please use {@link #DELIMITER} instead. - */ - @Deprecated(/* since="2.6" */) - public static final byte DELIMITTER = DELIMITER; - private final byte[] keyspace; private final byte[] id; private final boolean phantomKey; diff --git a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java index 5ad27fcff..c0264d796 100644 --- a/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/ObjectHashMapper.java @@ -19,7 +19,7 @@ import java.util.Collections; import java.util.Map; import java.util.Set; -import org.springframework.data.redis.core.convert.CustomConversions; +import org.springframework.data.convert.CustomConversions; import org.springframework.data.redis.core.convert.IndexResolver; import org.springframework.data.redis.core.convert.IndexedData; import org.springframework.data.redis.core.convert.MappingRedisConverter; @@ -95,24 +95,13 @@ public class ObjectHashMapper implements HashMapper { this.converter = converter; } - /** - * Creates new {@link ObjectHashMapper}. - * - * @param customConversions can be {@literal null}. - * @deprecated since 2.0, use {@link #ObjectHashMapper(org.springframework.data.convert.CustomConversions)}. - */ - @Deprecated - public ObjectHashMapper(CustomConversions customConversions) { - this((org.springframework.data.convert.CustomConversions) customConversions); - } - /** * Creates new {@link ObjectHashMapper}. * * @param customConversions can be {@literal null}. * @since 2.0 */ - public ObjectHashMapper(@Nullable org.springframework.data.convert.CustomConversions customConversions) { + public ObjectHashMapper(@Nullable CustomConversions customConversions) { MappingRedisConverter mappingConverter = new MappingRedisConverter(new RedisMappingContext(), new NoOpIndexResolver(), new NoOpReferenceResolver()); diff --git a/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java index f48d36f19..62a9efa77 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamMessageListenerContainer.java @@ -316,15 +316,6 @@ public interface StreamMessageListenerContainer> exten return consumer; } - /** - * @return - * @deprecated since 2.3, use {@link #isAutoAcknowledge()} for improved readability instead. - */ - @Deprecated - public boolean isAutoAck() { - return isAutoAcknowledge(); - } - /** * @return * @since 2.3 @@ -453,19 +444,6 @@ public interface StreamMessageListenerContainer> exten return this; } - /** - * Configure auto-acknowledgement for stream message consumption. - * - * @param autoAck {@literal true} (default) to auto-acknowledge received messages or {@literal false} for external - * acknowledgement. - * @return {@code this} {@link ConsumerStreamReadRequestBuilder}. - * @deprecated since 2.3, use {@link #autoAcknowledge(boolean)} instead. - */ - @Deprecated - public ConsumerStreamReadRequestBuilder autoAck(boolean autoAck) { - return autoAcknowledge(autoAck); - } - /** * Configure auto-acknowledgement for stream message consumption. This method is an alias for * {@link #autoAck(boolean)} for improved readability. diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java b/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java index 50d06397a..f94122d32 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterCommandExecutorUnitTests.java @@ -235,8 +235,8 @@ class ClusterCommandExecutorUnitTests { executor.executeCommandOnAllNodes(COMMAND_CALLBACK); } catch (ClusterCommandExecutionFailureException e) { - assertThat(e.getCauses().size()).isEqualTo(1); - assertThat(e.getCauses().iterator().next()).isInstanceOf(DataAccessException.class); + assertThat(e.getSuppressed()).hasSize(1); + assertThat(e.getSuppressed()[0]).isInstanceOf(DataAccessException.class); } verify(con1, times(1)).theWheelWeavesAsTheWheelWills(); diff --git a/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java index 3c5948a69..b31c3d954 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisConnectionUnitTests.java @@ -162,10 +162,6 @@ class RedisConnectionUnitTests { return delegate.hSet(key, field, value); } - public void bgWriteAof() { - delegate.bgWriteAof(); - } - public Object execute(String command, byte[]... args) { return delegate.execute(command, args); } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java index 86a852028..73e04a75b 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactoryIntegrationTests.java @@ -17,8 +17,6 @@ package org.springframework.data.redis.connection.jedis; import static org.assertj.core.api.Assertions.*; -import redis.clients.jedis.JedisShardInfo; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; @@ -44,19 +42,6 @@ class JedisConnectionFactoryIntegrationTests { } } - @Test // DATAREDIS-574 - void shardInfoShouldOverrideFactorySettings() { - - factory = new JedisConnectionFactory(new JedisShardInfo(SettingsUtils.getHost(), SettingsUtils.getPort())); - factory.setUsePool(false); - factory.setPassword("foo"); - factory.setHostName("bar"); - factory.setPort(1234); - factory.afterPropertiesSet(); - - assertThat(factory.getConnection().ping()).isEqualTo("PONG"); - } - @Test // DATAREDIS-574 void shouldInitializeWithStandaloneConfiguration() { diff --git a/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java index 889e27387..433e7fc74 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisConnectionUtilsUnitTests.java @@ -60,7 +60,7 @@ class RedisConnectionUtilsUnitTests { Mockito.reset(connectionMock1); doThrow(new IllegalStateException()).when(connectionMock1).close(); - RedisConnectionUtils.releaseConnection(connectionMock1, factoryMock, false); + RedisConnectionUtils.releaseConnection(connectionMock1, factoryMock); verify(connectionMock1).close(); }