DATAREDIS-507 - Do not destroy RedisConnectionFactory in RedisKeyValueAdapter.destroy.
Do not destroy RedisConnectionFactory which is likely managed outside of RedisKeyValueAdapter. This change makes sure to retain a working connection factory while shutting down message listeners as those try to unsubscribe on shutdown. Original Pull Request: #195
This commit is contained in:
committed by
Christoph Strobl
parent
c1476b701b
commit
ebbcd95c6d
@@ -84,6 +84,7 @@ import org.springframework.util.Assert;
|
||||
* Please use {@link RedisTemplate} for this purpose.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @since 1.7
|
||||
*/
|
||||
public class RedisKeyValueAdapter extends AbstractKeyValueAdapter
|
||||
@@ -447,13 +448,6 @@ public class RedisKeyValueAdapter extends AbstractKeyValueAdapter
|
||||
*/
|
||||
public void destroy() throws Exception {
|
||||
|
||||
if (redisOps instanceof RedisTemplate) {
|
||||
RedisConnectionFactory connectionFactory = ((RedisTemplate<?, ?>) redisOps).getConnectionFactory();
|
||||
if (connectionFactory instanceof DisposableBean) {
|
||||
((DisposableBean) connectionFactory).destroy();
|
||||
}
|
||||
}
|
||||
|
||||
this.expirationListener.destroy();
|
||||
this.messageListenerContainer.destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user