public class ChannelApplicationLayer extends ApplicationLayer<Future<Channel>>
ApplicationLayer that produces a Channel.| Modifier and Type | Class and Description |
|---|---|
static interface |
ChannelApplicationLayer.ChannelDecorator
Callback for decorating the
ChannelBuilder before the Channel is created. |
static interface |
ChannelApplicationLayer.Listener
Callback interface for notification of the
Channel being created. |
ProtocolLayer.Recv, ProtocolLayer.SendEMPTY_BUFFER| Constructor and Description |
|---|
ChannelApplicationLayer(ExecutorService executorService,
ChannelApplicationLayer.Listener listener)
Creates a new
ChannelApplicationLayer |
ChannelApplicationLayer(ExecutorService executorService,
ChannelApplicationLayer.Listener listener,
String cookie)
Creates a new
ChannelApplicationLayer |
| Modifier and Type | Method and Description |
|---|---|
ChannelBuilder |
decorate(ChannelBuilder builder)
Allows subclasses to decorate the
ChannelBuilder |
Future<Channel> |
get()
SPI: Returns the application specific API instance.
|
boolean |
isReadOpen()
SPI: Implementations of
ApplicationLayer must ensure this method either returns true while the
application specific API instance (ApplicationLayer.get()) is accepting data via ApplicationLayer.onRead(ByteBuffer) or
returns false once it is permanently closed to incoming data. |
void |
onRead(ByteBuffer data)
SPI: Callback on data being received from the protocol stack.
|
void |
onReadClosed(IOException cause)
Callback on the lower layer's source of data being closed.
|
void |
start()
Starts this layer.
|
doCloseRead, doCloseWrite, init, isRecvOpen, isWriteOpen, onRecv, onRecvClosed, stack, writepublic ChannelApplicationLayer(@NonNull
ExecutorService executorService,
@CheckForNull
ChannelApplicationLayer.Listener listener)
ChannelApplicationLayerexecutorService - the ExecutorService to use for the Channel.listener - the ChannelApplicationLayer.Listener to notify when the Channel is available.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public ChannelApplicationLayer(@NonNull
ExecutorService executorService,
@CheckForNull
ChannelApplicationLayer.Listener listener,
String cookie)
ChannelApplicationLayerexecutorService - the ExecutorService to use for the Channel.listener - the ChannelApplicationLayer.Listener to notify when the Channel is available.cookie - a cookie to pass through the channel.public Future<Channel> get()
get in class ApplicationLayer<Future<Channel>>public boolean isReadOpen()
ApplicationLayer must ensure this method either returns true while the
application specific API instance (ApplicationLayer.get()) is accepting data via ApplicationLayer.onRead(ByteBuffer) or
returns false once it is permanently closed to incoming data. If the application specific API instance
is temporarily not accepting data then this method should return true and the implementation is
responsible for caching the data submitted in calls to ApplicationLayer.onRead(ByteBuffer)
Once this method returns false it must always return false and can be assumed to behave in
this way.isReadOpen in class ApplicationLayer<Future<Channel>>true if the application specific API instance (ApplicationLayer.get() is accepting data via
ApplicationLayer.onRead(ByteBuffer)public void onRead(@NonNull
ByteBuffer data)
throws IOException
onRead in class ApplicationLayer<Future<Channel>>data - the data received. Any data consumed from the ByteBuffer can be assumed as processed.
Any data not consumed from the ByteBuffer will be the responsibility of the caller
to resubmit in subsequent calls.IOException - if there was an error during processing of the received data.public void onReadClosed(IOException cause)
onReadClosed in class ApplicationLayer<Future<Channel>>cause - the cause of the lower layer being closed or null.public void start()
public ChannelBuilder decorate(ChannelBuilder builder)
ChannelBuilderbuilder - the ChannelBuilder to decorateChannelBuilder for method chaining.Copyright © 2004–2022. All rights reserved.