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
595c0796c4
commit
3fad6e5adc
@@ -299,16 +299,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 quietPeriod = clientConfiguration.getShutdownQuietPeriod();
|
||||
@@ -332,6 +324,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