@Override public ChannelListener.Setter<? extends StreamSinkChannel> getWriteSetter() { if (writeSetter == null) { writeSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setWriteListener(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } else { delegate.getWriteSetter().set(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } } } return writeSetter; }
public void responseDone() { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setCloseListener(null); ((ConduitStreamSinkChannel) delegate).setWriteListener(null); } else { delegate.getCloseSetter().set(null); delegate.getWriteSetter().set(null); } if (delegate.isWriteResumed()) { delegate.suspendWrites(); } }
private void handleAccepted(final StreamConnection accepted, final SslChannel sslChannel, final OptionMap serverOptionMap, final SaslAuthenticationFactory saslAuthenticationFactory) { final RemoteConnection connection = new RemoteConnection(accepted, sslChannel, serverOptionMap, RemoteConnectionProvider.this); final ServerConnectionOpenListener openListener = new ServerConnectionOpenListener(connection, connectionProviderContext, saslAuthenticationFactory, serverOptionMap); accepted.getSinkChannel().setWriteListener(connection.getWriteListener()); log.tracef("Accepted connection from %s to %s", connection.getPeerAddress(), connection.getLocalAddress()); openListener.handleEvent(accepted.getSourceChannel()); } }
res = underlyingChannel.getSinkChannel().write(buffer); if (res == 0) { underlyingChannel.getSinkChannel().setWriteListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel channel) {
channel.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(null, null)); channel.getSinkChannel().resumeWrites();
@Override public void handleEvent(Channel c) { try { if (flushPipelinedData()) { channel.getSinkChannel().setWriteListener(null); channel.getSinkChannel().suspendWrites(); connection.restoreChannel(oldState); connection.getReadListener().exchangeComplete(exchange); } } catch (IOException e) { UndertowLogger.REQUEST_IO_LOGGER.ioException(e); IoUtils.safeClose(channel); } catch (Throwable t) { UndertowLogger.REQUEST_IO_LOGGER.handleUnexpectedFailure(t); IoUtils.safeClose(channel); } } });
public void handleEvent(final StreamConnection connection) { try { connection.setOption(Options.TCP_NODELAY, Boolean.TRUE); } catch (IOException e) { // ignore } final SslChannel sslChannel = connection instanceof SslChannel ? (SslChannel) connection : null; final RemoteConnection remoteConnection = new RemoteConnection(connection, sslChannel, connectOptions, RemoteConnectionProvider.this); cancellableResult.addCancelHandler(new Cancellable() { @Override public Cancellable cancel() { RemoteConnectionHandler.sendCloseRequestBody(remoteConnection); remoteConnection.handlePreAuthCloseRequest(); return this; } }); if (connection.isOpen()) { remoteConnection.setResult(cancellableResult); connection.getSinkChannel().setWriteListener(remoteConnection.getWriteListener()); final ClientConnectionOpenListener openListener = new ClientConnectionOpenListener(destination, remoteConnection, connectionProviderContext, authenticationConfiguration, saslClientFactoryOperator, serverMechs, connectOptions); openListener.handleEvent(connection.getSourceChannel()); } } };
sink.write(pri); if(pri.hasRemaining()) { sink.setWriteListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel channel) {
connection.getSinkChannel().shutdownWrites(); if (!connection.getSinkChannel().flush()) { connection.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel channel) {
public void accept(final StreamConnection channel) { if (channel.getWorker() != getXnioWorker()) { throw conn.invalidWorker(); } try { channel.setOption(Options.TCP_NODELAY, Boolean.TRUE); } catch (IOException e) { // ignore } final SslChannel sslChannel = channel instanceof SslConnection ? (SslConnection) channel : null; final RemoteConnection connection = new RemoteConnection(channel, sslChannel, optionMap, HttpUpgradeConnectionProvider.this); final ServerConnectionOpenListener openListener = new ServerConnectionOpenListener(connection, getConnectionProviderContext(), saslAuthenticationFactory, optionMap); channel.getSinkChannel().setWriteListener(connection.getWriteListener()); conn.tracef("Accepted connection from %s to %s", channel.getPeerAddress(), channel.getLocalAddress()); openListener.handleEvent(channel.getSourceChannel()); } }
connection.getSourceChannel().setConduit(pushBackStreamSourceConduit); connection.getSinkChannel().suspendWrites(); connection.getSinkChannel().setWriteListener(null);
if (!flushPipelinedData()) { final StreamConnection channel = connection.getChannel(); channel.getSinkChannel().setWriteListener(new ChannelListener<Channel>() { @Override public void handleEvent(Channel c) {
sinkChannel.shutdownWrites(); if(!sinkChannel.flush()) { sinkChannel.setWriteListener(ChannelListeners.flushingChannelListener(null, null)); sinkChannel.resumeWrites();
sinkChannel.shutdownWrites(); if (!sinkChannel.flush()) { sinkChannel.setWriteListener(ChannelListeners.flushingChannelListener(null, new ChannelExceptionHandler<ConduitStreamSinkChannel>() { @Override public void handleException(ConduitStreamSinkChannel channel, IOException exception) {
connection.getChannel().getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(new ChannelListener<ConduitStreamSinkChannel>() { @Override public void handleEvent(ConduitStreamSinkChannel conduitStreamSinkChannel) {
@Override public ChannelListener.Setter<? extends StreamSinkChannel> getWriteSetter() { if (writeSetter == null) { writeSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setWriteListener(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } else { delegate.getWriteSetter().set(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } } } return writeSetter; }
public void responseDone() { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setCloseListener(null); ((ConduitStreamSinkChannel) delegate).setWriteListener(null); } else { delegate.getCloseSetter().set(null); delegate.getWriteSetter().set(null); } if (delegate.isWriteResumed()) { delegate.suspendWrites(); } }
@Override public ChannelListener.Setter<? extends StreamSinkChannel> getWriteSetter() { if (writeSetter == null) { writeSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setWriteListener(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } else { delegate.getWriteSetter().set(new SetterDelegatingListener((ChannelListener.SimpleSetter)writeSetter, this)); } } } return writeSetter; }
public void responseDone() { if(delegate instanceof ConduitStreamSinkChannel) { ((ConduitStreamSinkChannel) delegate).setCloseListener(null); ((ConduitStreamSinkChannel) delegate).setWriteListener(null); } else { delegate.getCloseSetter().set(null); delegate.getWriteSetter().set(null); } if (delegate.isWriteResumed()) { delegate.suspendWrites(); } }
private void handleAccepted(final StreamConnection accepted, final SslChannel sslChannel, final OptionMap serverOptionMap, final SaslAuthenticationFactory saslAuthenticationFactory) { final RemoteConnection connection = new RemoteConnection(accepted, sslChannel, serverOptionMap, RemoteConnectionProvider.this); final ServerConnectionOpenListener openListener = new ServerConnectionOpenListener(connection, connectionProviderContext, saslAuthenticationFactory, serverOptionMap); accepted.getSinkChannel().setWriteListener(connection.getWriteListener()); log.tracef("Accepted connection from %s to %s", connection.getPeerAddress(), connection.getLocalAddress()); openListener.handleEvent(accepted.getSourceChannel()); } }