private void onRequestFailure ( HttpServerExchange serverExchange , PooledConnection connection , IOException e , boolean retry ) { log . debug ( "Client request failure" , e ) ; IoUtils . safeClose ( connection ) ; ConnectionPool connectionPool = connectionPools . get ( serverExchange . getIoThread ( ) ) ; connectionPool . release ( connection ) ; AuthContext context = serverExchange . getAttachment ( AUTH_CONTEXT_KEY ) ; if ( context . retries < MAX_RETRY && retry ) { context . retries ++ ; PooledConnectionWaiter waiter = createWaiter ( serverExchange ) ; if ( ! connectionPool . offer ( waiter ) ) { endExchange ( serverExchange , INTERNAL_SERVER_ERROR , TOO_MANY_PENDING_REQUESTS ) ; } } else { endExchange ( serverExchange , INTERNAL_SERVER_ERROR , CLIENT_REQUEST_FAILURE ) ; } }
Called if an exception occurs at any stage in the process .