@@ -38,24 +38,30 @@ public class NettyConnectionsPool implements ConnectionsPool<String, Channel> {
38
38
private final ConcurrentHashMap <Channel , IdleChannel > channel2IdleChannel = new ConcurrentHashMap <Channel , IdleChannel >();
39
39
private final ConcurrentHashMap <Channel , Long > channel2CreationDate = new ConcurrentHashMap <Channel , Long >();
40
40
private final AtomicBoolean isClosed = new AtomicBoolean (false );
41
- private final Timer idleConnectionDetector = new Timer ( true ) ;
41
+ private final Timer idleConnectionDetector ;
42
42
private final boolean sslConnectionPoolEnabled ;
43
43
private final int maxTotalConnections ;
44
44
private final int maxConnectionPerHost ;
45
45
private final int maxConnectionLifeTimeInMs ;
46
46
private final long maxIdleTime ;
47
47
48
48
public NettyConnectionsPool (NettyAsyncHttpProvider provider ) {
49
- this (provider .getConfig ().getMaxTotalConnections (), provider .getConfig ().getMaxConnectionPerHost (), provider .getConfig ().getIdleConnectionInPoolTimeoutInMs (), provider .getConfig ().getMaxConnectionLifeTimeInMs (), provider .getConfig ().isSslConnectionPoolEnabled ());
49
+ this (provider .getConfig ().getMaxTotalConnections (),//
50
+ provider .getConfig ().getMaxConnectionPerHost (),//
51
+ provider .getConfig ().getIdleConnectionInPoolTimeoutInMs (),//
52
+ provider .getConfig ().getMaxConnectionLifeTimeInMs (),//
53
+ provider .getConfig ().isSslConnectionPoolEnabled (),//
54
+ new Timer (true ));
50
55
}
51
56
52
- public NettyConnectionsPool (int maxTotalConnections , int maxConnectionPerHost , long maxIdleTime , int maxConnectionLifeTimeInMs , boolean sslConnectionPoolEnabled ) {
57
+ public NettyConnectionsPool (int maxTotalConnections , int maxConnectionPerHost , long maxIdleTime , int maxConnectionLifeTimeInMs , boolean sslConnectionPoolEnabled , Timer idleConnectionDetector ) {
53
58
this .maxTotalConnections = maxTotalConnections ;
54
59
this .maxConnectionPerHost = maxConnectionPerHost ;
55
60
this .sslConnectionPoolEnabled = sslConnectionPoolEnabled ;
56
61
this .maxIdleTime = maxIdleTime ;
57
62
this .maxConnectionLifeTimeInMs = maxConnectionLifeTimeInMs ;
58
63
this .idleConnectionDetector .schedule (new IdleChannelDetector (), maxIdleTime , maxIdleTime );
64
+ this .idleConnectionDetector = idleConnectionDetector ;
59
65
}
60
66
61
67
private static class IdleChannel {
0 commit comments