-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Lines 545 to 570 in 1475069
| public RedisClusterCommands<byte[], byte[]> getResourceForSpecificNode(RedisClusterNode node) { | |
| Assert.notNull(node, "Node must not be null!"); | |
| if (connection == null) { | |
| synchronized (this) { | |
| if (connection == null) { | |
| this.connection = connectionProvider.getConnection(StatefulRedisClusterConnection.class); | |
| } | |
| } | |
| } | |
| return connection.getConnection(node.getHost(), node.getPort()).sync(); | |
| } | |
| @Override | |
| @SuppressWarnings("unchecked") | |
| public void returnResourceForSpecificNode(RedisClusterNode node, Object resource) {} | |
| @Override | |
| public void destroy() throws Exception { | |
| if (connection != null) { | |
| connectionProvider.release(connection); | |
| } | |
| } | |
| } |
if i execute RedisConnectionCommands::ping command via a redistemplate, then should this connection variable to be reset to null in the callback method returnResourceForSpecificNode ?
if not, then when the destroy callback was called druing spring exit , the connectionProvider was already closed, calling connectionProvider.release(connection); would result in exception :
Returned connection io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl@2d3456b was either previously returned or does not belong to this connection provider, did i understand right?
Lines 145 to 165 in 1475069
| public void release(StatefulConnection<?, ?> connection) { | |
| GenericObjectPool<StatefulConnection<?, ?>> pool = poolRef.remove(connection); | |
| if (pool == null) { | |
| AsyncPool<StatefulConnection<?, ?>> asyncPool = asyncPoolRef.remove(connection); | |
| if (asyncPool == null) { | |
| throw new PoolException("Returned connection " + connection | |
| + " was either previously returned or does not belong to this connection provider"); | |
| } | |
| discardIfNecessary(connection); | |
| asyncPool.release(connection).join(); | |
| return; | |
| } | |
| discardIfNecessary(connection); | |
| pool.returnObject(connection); | |
| } |
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug