AjpClientConnection(final AjpClientChannel connection, final OptionMap options, final ByteBufferPool bufferPool, ClientStatistics clientStatistics) { this.clientStatistics = clientStatistics; this.options = options; this.connection = connection; this.bufferPool = bufferPool; connection.addCloseTask(new ChannelListener<AjpClientChannel>() { @Override public void handleEvent(AjpClientChannel channel) { log.debugf("connection to %s closed", getPeerAddress()); AjpClientConnection.this.state |= CLOSED; ChannelListeners.invokeChannelListener(AjpClientConnection.this, closeSetter.get()); for(ChannelListener<ClientConnection> listener : closeListeners) { listener.handleEvent(AjpClientConnection.this); } AjpClientExchange pending = pendingQueue.poll(); while (pending != null) { pending.setFailed(new ClosedChannelException()); pending = pendingQueue.poll(); } if(currentRequest != null) { currentRequest.setFailed(new ClosedChannelException()); currentRequest = null; } } }); connection.getReceiveSetter().set(new ClientReceiveListener()); connection.resumeReceives(); }
AjpClientConnection(final AjpClientChannel connection, final OptionMap options, final ByteBufferPool bufferPool, ClientStatistics clientStatistics) { this.clientStatistics = clientStatistics; this.options = options; this.connection = connection; this.bufferPool = bufferPool; connection.addCloseTask(new ChannelListener<AjpClientChannel>() { @Override public void handleEvent(AjpClientChannel channel) { log.debugf("connection to %s closed", getPeerAddress()); AjpClientConnection.this.state |= CLOSED; ChannelListeners.invokeChannelListener(AjpClientConnection.this, closeSetter.get()); for(ChannelListener<ClientConnection> listener : closeListeners) { listener.handleEvent(AjpClientConnection.this); } AjpClientExchange pending = pendingQueue.poll(); while (pending != null) { pending.setFailed(new ClosedChannelException()); pending = pendingQueue.poll(); } if(currentRequest != null) { currentRequest.setFailed(new ClosedChannelException()); currentRequest = null; } } }); connection.getReceiveSetter().set(new ClientReceiveListener()); connection.resumeReceives(); }
AjpClientConnection(final AjpClientChannel connection, final OptionMap options, final ByteBufferPool bufferPool, ClientStatistics clientStatistics) { this.clientStatistics = clientStatistics; this.options = options; this.connection = connection; this.bufferPool = bufferPool; connection.addCloseTask(new ChannelListener<AjpClientChannel>() { @Override public void handleEvent(AjpClientChannel channel) { log.debugf("connection to %s closed", getPeerAddress()); AjpClientConnection.this.state |= CLOSED; ChannelListeners.invokeChannelListener(AjpClientConnection.this, closeSetter.get()); for(ChannelListener<ClientConnection> listener : closeListeners) { listener.handleEvent(AjpClientConnection.this); } AjpClientExchange pending = pendingQueue.poll(); while (pending != null) { pending.setFailed(new ClosedChannelException()); pending = pendingQueue.poll(); } if(currentRequest != null) { currentRequest.setFailed(new ClosedChannelException()); currentRequest = null; } } }); connection.getReceiveSetter().set(new ClientReceiveListener()); connection.resumeReceives(); }