public final class ConduitReadableMessageChannel extends java.lang.Object implements ReadableMessageChannel, ReadListenerSettable<ConduitReadableMessageChannel>, CloseListenerSettable<ConduitReadableMessageChannel>, java.lang.Cloneable
ReadListenerSettable.Setter<C extends java.nio.channels.Channel>CloseListenerSettable.Setter<C extends java.nio.channels.Channel>EMPTY| Constructor and Description |
|---|
ConduitReadableMessageChannel(Configurable configurable,
MessageSourceConduit conduit)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
awaitReadable()
Block until this channel becomes readable again.
|
void |
awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit)
Block until this channel becomes readable again, or until the timeout expires.
|
ConduitReadableMessageChannel |
clone()
Duplicate this channel.
|
void |
close()
Close this channel.
|
ChannelListener<? super ConduitReadableMessageChannel> |
getCloseListener()
Get the close listener.
|
ChannelListener.Setter<ConduitReadableMessageChannel> |
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.
|
MessageSourceConduit |
getConduit()
Get the underlying conduit for this channel.
|
XnioIoThread |
getIoThread()
Get the I/O thread associated with this channel.
|
<T> T |
getOption(Option<T> option)
Get the value of a channel option.
|
ChannelListener<? super ConduitReadableMessageChannel> |
getReadListener()
Get the read listener.
|
ChannelListener.Setter<ConduitReadableMessageChannel> |
getReadSetter()
Get the setter which can be used to change the read listener for this channel.
|
XnioExecutor |
getReadThread()
Deprecated.
|
XnioWorker |
getWorker()
Get the worker for this channel.
|
boolean |
isOpen() |
boolean |
isReadResumed()
Determine whether reads are resumed.
|
int |
receive(java.nio.ByteBuffer dst)
Receive a message.
|
long |
receive(java.nio.ByteBuffer[] dsts)
Receive a message.
|
long |
receive(java.nio.ByteBuffer[] dsts,
int offset,
int length)
Receive a message.
|
void |
resumeReads()
Resume reads on this channel.
|
void |
setCloseListener(ChannelListener<? super ConduitReadableMessageChannel> closeListener)
Set the close listener.
|
void |
setConduit(MessageSourceConduit conduit)
Set the underlying conduit for this channel.
|
<T> T |
setOption(Option<T> option,
T value)
Set an option for this channel.
|
void |
setReadListener(ChannelListener<? super ConduitReadableMessageChannel> readListener)
Set the read listener.
|
void |
shutdownReads()
Places this readable channel at "end of stream".
|
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
void |
suspendReads()
Suspend further read notifications on this channel.
|
void |
wakeupReads()
Resume reads on this channel, and force the read listener to be triggered even if the
channel isn't actually readable. |
public ConduitReadableMessageChannel(Configurable configurable, MessageSourceConduit conduit)
configurable - the configurable to delegate configuration requests toconduit - the initial conduit to use for data transportpublic MessageSourceConduit getConduit()
public void setConduit(MessageSourceConduit conduit)
conduit - the underlying conduit for this channelpublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void setReadListener(ChannelListener<? super ConduitReadableMessageChannel> readListener)
ReadListenerSettablesetReadListener in interface ReadListenerSettable<ConduitReadableMessageChannel>readListener - the read listenerpublic ChannelListener<? super ConduitReadableMessageChannel> getReadListener()
ReadListenerSettablegetReadListener in interface ReadListenerSettable<ConduitReadableMessageChannel>public void setCloseListener(ChannelListener<? super ConduitReadableMessageChannel> closeListener)
CloseListenerSettablesetCloseListener in interface CloseListenerSettable<ConduitReadableMessageChannel>closeListener - the close listenerpublic ChannelListener<? super ConduitReadableMessageChannel> getCloseListener()
CloseListenerSettablegetCloseListener in interface CloseListenerSettable<ConduitReadableMessageChannel>public ChannelListener.Setter<ConduitReadableMessageChannel> getReadSetter()
ReadableMessageChannelgetReadSetter in interface ReadableMessageChannelgetReadSetter in interface SuspendableReadChannelpublic ChannelListener.Setter<ConduitReadableMessageChannel> getCloseSetter()
ReadableMessageChannelgetCloseSetter in interface CloseableChannelgetCloseSetter in interface ReadableMessageChannelgetCloseSetter in interface SuspendableReadChannelpublic XnioWorker getWorker()
CloseableChannelgetWorker in interface CloseableChannelpublic long receive(java.nio.ByteBuffer[] dsts,
int offset,
int length)
throws java.io.IOException
ReadableMessageChannelreceive in interface ReadableMessageChanneldsts - the buffers that will hold the messageoffset - the offset into the array of buffers of the first buffer to read intolength - the number of buffers to filljava.io.IOException - if an I/O error occurspublic long receive(java.nio.ByteBuffer[] dsts)
throws java.io.IOException
ReadableMessageChannelreceive in interface ReadableMessageChanneldsts - the buffers that will hold the messagejava.io.IOException - if an I/O error occurspublic int receive(java.nio.ByteBuffer dst)
throws java.io.IOException
ReadableMessageChannelreceive in interface ReadableMessageChanneldst - the buffer that will hold the messagejava.io.IOException - if an I/O error occurspublic void suspendReads()
SuspendableReadChannelsuspendReads in interface SuspendableReadChannelpublic void resumeReads()
SuspendableReadChannelresumeReads in interface SuspendableReadChannelpublic boolean isReadResumed()
SuspendableReadChannelisReadResumed in interface SuspendableReadChanneltrue if reads are resumed, false if reads are suspendedpublic void wakeupReads()
SuspendableReadChannelResume reads on this channel, and force the read listener to be triggered even if the
channel isn't actually readable.wakeupReads in interface SuspendableReadChannelpublic void shutdownReads()
throws java.io.IOException
SuspendableReadChannelCloseableChannel.close() to be called automatically.shutdownReads in interface SuspendableReadChanneljava.io.IOException - if an I/O error occurspublic void awaitReadable()
throws java.io.IOException
SuspendableReadChannelawaitReadable in interface SuspendableReadChanneljava.io.InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException - if an I/O error occurspublic void awaitReadable(long time,
java.util.concurrent.TimeUnit timeUnit)
throws java.io.IOException
SuspendableReadChannelawaitReadable in interface SuspendableReadChanneltime - the time to waittimeUnit - the time unitjava.io.InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException - if an I/O error occurs@Deprecated public XnioExecutor getReadThread()
SuspendableReadChannelgetReadThread in interface SuspendableReadChannelnull if none is configured or availablepublic XnioIoThread getIoThread()
CloseableChannelgetIoThread in interface CloseableChannelpublic void close()
throws java.io.IOException
CloseableChannelclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in interface java.nio.channels.InterruptibleChannelclose in interface CloseableChanneljava.io.IOException - if the close failedpublic boolean supportsOption(Option<?> option)
ConfigurablesupportsOption in interface Configurableoption - the optiontrue if it is supportedpublic <T> T getOption(Option<T> option) throws java.io.IOException
ConfigurablegetOption in interface ConfigurableT - the type of the option valueoption - the option to getnull if it is not setjava.io.IOException - if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws java.lang.IllegalArgumentException, java.io.IOException
ConfigurablesetOption in interface ConfigurableT - the type of the option valueoption - the option to setvalue - the value of the option to setjava.lang.IllegalArgumentException - if the value is not acceptable for this optionjava.io.IOException - if an I/O error occurred when modifying the optionpublic ConduitReadableMessageChannel clone()
clone in class java.lang.ObjectCopyright © 2016 JBoss, a division of Red Hat, Inc.