You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the updated netty pool,
`ChannelPoolHandler#channelCreated` is called at channel creation, and then `ChannelPoolHandler#channelAcquired` is called when the connection is borrowed out of the pool. When acquiring a connection from a newly created pool, a new connection will be created and then acquired. In previous netty version, when a connection is created, then it is directly lent out of the pool without being acquired. Thus we need to change some logic regarding how to count in use and idle connections.
Copy file name to clipboardExpand all lines: driver/src/test/java/org/neo4j/driver/internal/cluster/loadbalancing/RoutingTableAndConnectionPoolTest.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -407,7 +407,10 @@ private static class PooledConnection implements Connection
407
407
this.channel = channel;
408
408
this.pool = pool;
409
409
410
-
this.channel.attr( AttributeKey.valueOf( "channelPool" ) ).setIfAbsent( pool );
410
+
// This is needed to make netty connection pool to believe this channel is created by the pool.
411
+
// Otherwise the netty connection pool will refuse to release the channel back to the pool.
412
+
AttributeKey<ExtendedChannelPool> poolKey = AttributeKey.valueOf( "channelPool." + System.identityHashCode( pool ) );
0 commit comments