File tree 2 files changed +14
-1
lines changed
src/main/java/com/ning/http/client/providers/grizzly 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 32
32
import org .glassfish .grizzly .Grizzly ;
33
33
import org .glassfish .grizzly .GrizzlyFuture ;
34
34
import org .glassfish .grizzly .attributes .Attribute ;
35
+ import org .glassfish .grizzly .connectionpool .ConnectionInfo ;
35
36
import org .glassfish .grizzly .connectionpool .Endpoint ;
36
37
import org .glassfish .grizzly .connectionpool .MultiEndpointPool ;
37
38
import org .glassfish .grizzly .connectionpool .SingleEndpointPool ;
@@ -209,6 +210,11 @@ void destroy() {
209
210
pool .close ();
210
211
}
211
212
213
+ boolean isReadyInPool (final Connection c ) {
214
+ final ConnectionInfo <SocketAddress > ci = pool .getConnectionInfo (c );
215
+ return ci != null && ci .isReady ();
216
+ }
217
+
212
218
static boolean isKeepAlive (final Connection connection ) {
213
219
return !IS_NOT_KEEP_ALIVE .isSet (connection );
214
220
}
Original file line number Diff line number Diff line change @@ -253,8 +253,15 @@ protected void initializeTransport(final AsyncHttpClientConfig clientConfig) {
253
253
new IdleTimeoutFilter .TimeoutResolver () {
254
254
@ Override
255
255
public long getTimeout (final FilterChainContext ctx ) {
256
+ final Connection connection = ctx .getConnection ();
257
+
258
+ if (connectionManager .isReadyInPool (connection )) {
259
+ // if the connection is in pool - let ConnectionManager take care of its life cycle
260
+ return IdleTimeoutFilter .FOREVER ;
261
+ }
262
+
256
263
final HttpTransactionContext context
257
- = HttpTransactionContext .currentTransaction (ctx . getConnection () );
264
+ = HttpTransactionContext .currentTransaction (connection );
258
265
if (context != null ) {
259
266
if (context .isWSRequest ) {
260
267
return clientConfig .getWebSocketTimeout ();
You can’t perform that action at this time.
0 commit comments