DATAREDIS-1027 - Dispose reactive LettuceConnectionProvider on connection factory shutdown.
LettuceConnectionFactory.destroy() now disposes also the reactive LettuceConnectionProvider to free resources of a connection pool. Original Pull Request: #470
This commit is contained in:
committed by
Christoph Strobl
parent
104dc8c625
commit
a704358885
@@ -291,16 +291,8 @@ public class LettuceConnectionFactory
|
||||
|
||||
resetConnection();
|
||||
|
||||
if (connectionProvider instanceof DisposableBean) {
|
||||
try {
|
||||
((DisposableBean) connectionProvider).destroy();
|
||||
} catch (Exception e) {
|
||||
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn(connectionProvider + " did not shut down gracefully.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
dispose(connectionProvider);
|
||||
dispose(reactiveConnectionProvider);
|
||||
|
||||
try {
|
||||
Duration timeout = clientConfiguration.getShutdownTimeout();
|
||||
@@ -323,6 +315,20 @@ public class LettuceConnectionFactory
|
||||
}
|
||||
}
|
||||
|
||||
private void dispose(LettuceConnectionProvider connectionProvider) {
|
||||
|
||||
if (connectionProvider instanceof DisposableBean) {
|
||||
try {
|
||||
((DisposableBean) connectionProvider).destroy();
|
||||
} catch (Exception e) {
|
||||
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn(connectionProvider + " did not shut down gracefully.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.redis.connection.RedisConnectionFactory#getConnection()
|
||||
|
||||
Reference in New Issue
Block a user