Java Code Examples for org.xnio.ChannelListener#SimpleSetter
The following examples show how to use
org.xnio.ChannelListener#SimpleSetter .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFramedChannel.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a new {@link io.undertow.server.protocol.framed.AbstractFramedChannel} * 8 * @param connectedStreamChannel The {@link org.xnio.channels.ConnectedStreamChannel} over which the Frames should get send and received. * Be aware that it already must be "upgraded". * @param bufferPool The {@link ByteBufferPool} which will be used to acquire {@link ByteBuffer}'s from. * @param framePriority * @param settings The settings */ protected AbstractFramedChannel(final StreamConnection connectedStreamChannel, ByteBufferPool bufferPool, FramePriority<C, R, S> framePriority, final PooledByteBuffer readData, OptionMap settings) { this.framePriority = framePriority; this.maxQueuedBuffers = settings.get(UndertowOptions.MAX_QUEUED_READ_BUFFERS, 10); this.settings = settings; if (readData != null) { if(readData.getBuffer().hasRemaining()) { this.readData = new ReferenceCountedPooled(readData, 1); } else { readData.close(); } } if(bufferPool == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("bufferPool"); } if(connectedStreamChannel == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("connectedStreamChannel"); } IdleTimeoutConduit idle = createIdleTimeoutChannel(connectedStreamChannel); connectedStreamChannel.getSourceChannel().setConduit(idle); connectedStreamChannel.getSinkChannel().setConduit(idle); this.idleTimeoutConduit = idle; this.channel = connectedStreamChannel; this.bufferPool = bufferPool; closeSetter = new ChannelListener.SimpleSetter<>(); receiveSetter = new ChannelListener.SimpleSetter<>(); channel.getSourceChannel().getReadSetter().set(null); channel.getSourceChannel().suspendReads(); channel.getSourceChannel().getReadSetter().set(new FrameReadListener()); connectedStreamChannel.getSinkChannel().getWriteSetter().set(new FrameWriteListener()); FrameCloseListener closeListener = new FrameCloseListener(); connectedStreamChannel.getSinkChannel().getCloseSetter().set(closeListener); connectedStreamChannel.getSourceChannel().getCloseSetter().set(closeListener); }
Example 2
Source File: DetachableStreamSinkChannel.java From lams with GNU General Public License v2.0 | 5 votes |
@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; }
Example 3
Source File: DetachableStreamSinkChannel.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public ChannelListener.Setter<? extends StreamSinkChannel> getCloseSetter() { if (closeSetter == null) { closeSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { delegate.getCloseSetter().set(ChannelListeners.delegatingChannelListener(this, closeSetter)); } } return closeSetter; }
Example 4
Source File: DetachableStreamSourceChannel.java From lams with GNU General Public License v2.0 | 5 votes |
public ChannelListener.Setter<? extends StreamSourceChannel> getReadSetter() { if (readSetter == null) { readSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { if(delegate instanceof ConduitStreamSourceChannel) { ((ConduitStreamSourceChannel)delegate).setReadListener(new SetterDelegatingListener((ChannelListener.SimpleSetter)readSetter, this)); } else { delegate.getReadSetter().set(new SetterDelegatingListener((ChannelListener.SimpleSetter)readSetter, this)); } } } return readSetter; }
Example 5
Source File: DetachableStreamSourceChannel.java From lams with GNU General Public License v2.0 | 5 votes |
public ChannelListener.Setter<? extends StreamSourceChannel> getCloseSetter() { if (closeSetter == null) { closeSetter = new ChannelListener.SimpleSetter<>(); if (!isFinished()) { if(delegate instanceof ConduitStreamSourceChannel) { ((ConduitStreamSourceChannel)delegate).setCloseListener(ChannelListeners.delegatingChannelListener(this, closeSetter)); } else { delegate.getCloseSetter().set(ChannelListeners.delegatingChannelListener(this, closeSetter)); } } } return closeSetter; }