Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions core/src/main/java/io/undertow/client/ajp/AjpClientConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void handleEvent(AjpClientResponseStreamSourceChannel channel) {
private AjpClientExchange currentRequest;

private final OptionMap options;
private final AjpClientChannel connection;
private final AjpClientChannel ajpClientChannel;

private final ByteBufferPool bufferPool;

Expand All @@ -109,13 +109,13 @@ public void handleEvent(AjpClientResponseStreamSourceChannel channel) {
private final ClientStatistics clientStatistics;
private final List<ChannelListener<ClientConnection>> closeListeners = new CopyOnWriteArrayList<>();

AjpClientConnection(final AjpClientChannel connection, final OptionMap options, final ByteBufferPool bufferPool, ClientStatistics clientStatistics) {
AjpClientConnection(final AjpClientChannel ajpClientChannel, final OptionMap options, final ByteBufferPool bufferPool, ClientStatistics clientStatistics) {
this.clientStatistics = clientStatistics;
this.options = options;
this.connection = connection;
this.ajpClientChannel = ajpClientChannel;
this.bufferPool = bufferPool;

connection.addCloseTask(new ChannelListener<AjpClientChannel>() {
ajpClientChannel.addCloseTask(new ChannelListener<AjpClientChannel>() {
@Override
public void handleEvent(AjpClientChannel channel) {
log.debugf("connection to %s closed", getPeerAddress());
Expand All @@ -135,8 +135,8 @@ public void handleEvent(AjpClientChannel channel) {
}
}
});
connection.getReceiveSetter().set(new ClientReceiveListener());
connection.resumeReceives();
ajpClientChannel.getReceiveSetter().set(new ClientReceiveListener());
ajpClientChannel.resumeReceives();
}

@Override
Expand All @@ -147,12 +147,12 @@ public ByteBufferPool getBufferPool() {

@Override
public SocketAddress getPeerAddress() {
return connection.getPeerAddress();
return ajpClientChannel.getPeerAddress();
}

@Override
public <A extends SocketAddress> A getPeerAddress(Class<A> type) {
return connection.getPeerAddress(type);
return ajpClientChannel.getPeerAddress(type);
}

@Override
Expand All @@ -162,43 +162,43 @@ public ChannelListener.Setter<? extends AjpClientConnection> getCloseSetter() {

@Override
public SocketAddress getLocalAddress() {
return connection.getLocalAddress();
return ajpClientChannel.getLocalAddress();
}

@Override
public <A extends SocketAddress> A getLocalAddress(Class<A> type) {
return connection.getLocalAddress(type);
return ajpClientChannel.getLocalAddress(type);
}

@Override
public XnioWorker getWorker() {
return connection.getWorker();
return ajpClientChannel.getWorker();
}

@Override
public XnioIoThread getIoThread() {
return connection.getIoThread();
return ajpClientChannel.getIoThread();
}

@Override
public boolean isOpen() {
return connection.isOpen();
return ajpClientChannel.isOpen();
}

@Override
public boolean supportsOption(Option<?> option) {
return connection.supportsOption(option);
return ajpClientChannel.supportsOption(option);
}


@Override
public <T> T getOption(Option<T> option) throws IOException {
return connection.getOption(option);
return ajpClientChannel.getOption(option);
}

@Override
public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException {
return connection.setOption(option, value);
return ajpClientChannel.setOption(option, value);
}

@Override
Expand Down Expand Up @@ -255,7 +255,7 @@ public boolean isPingSupported() {

@Override
public void sendPing(PingListener listener, long timeout, TimeUnit timeUnit) {
connection.sendPing(listener, timeout, timeUnit);
ajpClientChannel.sendPing(listener, timeout, timeUnit);

}

Expand Down Expand Up @@ -285,7 +285,7 @@ private void initiateRequest(AjpClientExchange AjpClientExchange) {
length = -1;
}

AjpClientRequestClientStreamSinkChannel sinkChannel = connection.sendRequest(request.getMethod(), request.getPath(), request.getProtocol(), request.getRequestHeaders(), request, requestFinishListener);
AjpClientRequestClientStreamSinkChannel sinkChannel = ajpClientChannel.sendRequest(request.getMethod(), request.getPath(), request.getProtocol(), request.getRequestHeaders(), request, requestFinishListener);
currentRequest.setRequestChannel(sinkChannel);

AjpClientExchange.invokeReadReadyCallback(AjpClientExchange);
Expand Down Expand Up @@ -315,7 +315,7 @@ public void handleException(StreamSinkChannel channel, IOException exception) {

private void handleError(IOException exception) {
currentRequest.setFailed(exception);
safeClose(connection);
safeClose(ajpClientChannel);
}

public StreamConnection performUpgrade() throws IOException {
Expand All @@ -328,7 +328,7 @@ public void close() throws IOException {
return;
}
state |= CLOSED | CLOSE_REQ;
connection.close();
ajpClientChannel.close();
}

/**
Expand All @@ -338,9 +338,9 @@ public void requestDone() {
currentRequest = null;

if (anyAreSet(state, CLOSE_REQ)) {
safeClose(connection);
safeClose(ajpClientChannel);
} else if (anyAreSet(state, UPGRADE_REQUESTED)) {
safeClose(connection); //we don't support upgrade, just close the connection to be safe
safeClose(ajpClientChannel); //we don't support upgrade, just close the connection to be safe
return;
}

Expand Down Expand Up @@ -394,7 +394,7 @@ public void run() {

} catch (Throwable e) {
UndertowLogger.CLIENT_LOGGER.exceptionProcessingRequest(e);
safeClose(connection);
safeClose(ajpClientChannel);
if(currentRequest != null) {
currentRequest.setFailed(e instanceof IOException ? (IOException) e : new IOException(e));
}
Expand Down
Loading