public final class ConduitWritableMessageChannel extends Object implements WritableMessageChannel, WriteListenerSettable<ConduitWritableMessageChannel>, CloseListenerSettable<ConduitWritableMessageChannel>, Cloneable
WriteListenerSettable.Setter<C extends Channel>CloseListenerSettable.Setter<C extends Channel>EMPTY| Constructor and Description |
|---|
ConduitWritableMessageChannel(Configurable configurable,
MessageSinkConduit conduit)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
awaitWritable()
Block until this channel becomes writable again.
|
void |
awaitWritable(long time,
TimeUnit timeUnit)
Block until this channel becomes writable again, or until the timeout expires.
|
ConduitWritableMessageChannel |
clone()
Duplicate this channel.
|
void |
close()
Close this channel.
|
boolean |
flush()
Flush any waiting partial send or write.
|
ChannelListener<? super ConduitWritableMessageChannel> |
getCloseListener()
Get the close listener.
|
ChannelListener.Setter<ConduitWritableMessageChannel> |
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.
|
MessageSinkConduit |
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.
|
XnioWorker |
getWorker()
Get the worker for this channel.
|
ChannelListener<? super ConduitWritableMessageChannel> |
getWriteListener()
Get the write listener.
|
ChannelListener.Setter<ConduitWritableMessageChannel> |
getWriteSetter()
Get the setter which can be used to change the write listener for this channel.
|
XnioExecutor |
getWriteThread()
Deprecated.
|
boolean |
isOpen()
Determine whether this channel is open.
|
boolean |
isWriteResumed()
Determine whether writes are resumed.
|
void |
resumeWrites()
Resume writes on this channel.
|
boolean |
send(ByteBuffer dst)
Send a complete message.
|
boolean |
send(ByteBuffer[] srcs)
Send a complete message.
|
boolean |
send(ByteBuffer[] dsts,
int offs,
int len)
Send a complete message.
|
boolean |
sendFinal(ByteBuffer buffer)
Send a complete message.
|
boolean |
sendFinal(ByteBuffer[] buffers)
Send a complete message.
|
boolean |
sendFinal(ByteBuffer[] buffers,
int offs,
int len)
Send a complete message.
|
void |
setCloseListener(ChannelListener<? super ConduitWritableMessageChannel> closeListener)
Set the close listener.
|
void |
setConduit(MessageSinkConduit conduit)
Set the underlying conduit for this channel.
|
<T> T |
setOption(Option<T> option,
T value)
Set an option for this channel.
|
void |
setWriteListener(ChannelListener<? super ConduitWritableMessageChannel> writeListener)
Set the write listener.
|
void |
shutdownWrites()
Indicate that writing is complete for this channel.
|
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
void |
suspendWrites()
Suspend further write notifications on this channel.
|
void |
wakeupWrites()
Resume writes on this channel, and force the write listener to be triggered even if the
channel isn't actually writable. |
public ConduitWritableMessageChannel(Configurable configurable, MessageSinkConduit conduit)
configurable - the configurable to delegate configuration requests toconduit - the initial conduit to use for data transportpublic MessageSinkConduit getConduit()
public void setConduit(MessageSinkConduit conduit)
conduit - the underlying conduit for this channelpublic ChannelListener<? super ConduitWritableMessageChannel> getWriteListener()
WriteListenerSettablegetWriteListener in interface WriteListenerSettable<ConduitWritableMessageChannel>public void setWriteListener(ChannelListener<? super ConduitWritableMessageChannel> writeListener)
WriteListenerSettablesetWriteListener in interface WriteListenerSettable<ConduitWritableMessageChannel>writeListener - the write listenerpublic ChannelListener<? super ConduitWritableMessageChannel> getCloseListener()
CloseListenerSettablegetCloseListener in interface CloseListenerSettable<ConduitWritableMessageChannel>public void setCloseListener(ChannelListener<? super ConduitWritableMessageChannel> closeListener)
CloseListenerSettablesetCloseListener in interface CloseListenerSettable<ConduitWritableMessageChannel>closeListener - the close listenerpublic ChannelListener.Setter<ConduitWritableMessageChannel> getWriteSetter()
WritableMessageChannelgetWriteSetter in interface SuspendableWriteChannelgetWriteSetter in interface WritableMessageChannelpublic ChannelListener.Setter<ConduitWritableMessageChannel> getCloseSetter()
WritableMessageChannelgetCloseSetter in interface CloseableChannelgetCloseSetter in interface SuspendableWriteChannelgetCloseSetter in interface WritableMessageChannelpublic void suspendWrites()
SuspendableWriteChannelsuspendWrites in interface SuspendableWriteChannelpublic void resumeWrites()
SuspendableWriteChannelresumeWrites in interface SuspendableWriteChannelpublic void wakeupWrites()
SuspendableWriteChannelResume writes on this channel, and force the write listener to be triggered even if the
channel isn't actually writable.wakeupWrites in interface SuspendableWriteChannelpublic boolean isWriteResumed()
SuspendableWriteChannelisWriteResumed in interface SuspendableWriteChanneltrue if writes are resumed, false if writes are suspendedpublic void awaitWritable()
throws IOException
SuspendableWriteChannelawaitWritable in interface SuspendableWriteChannelInterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as wellIOException - if an I/O error occurspublic void awaitWritable(long time,
TimeUnit timeUnit)
throws IOException
SuspendableWriteChannelawaitWritable in interface SuspendableWriteChanneltime - the time to waittimeUnit - the time unitInterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as wellIOException - if an I/O error occurspublic boolean send(ByteBuffer dst) throws IOException
WritableMessageChannelsend in interface WritableMessageChanneldst - the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] srcs) throws IOException
WritableMessageChannelsend in interface WritableMessageChannelsrcs - the buffers holding the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean send(ByteBuffer[] dsts, int offs, int len) throws IOException
WritableMessageChannelsend in interface WritableMessageChanneldsts - the buffers holding the message to sendoffs - the offset into the buffer array of the first bufferlen - the number of buffers that contain data to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean sendFinal(ByteBuffer buffer) throws IOException
WritableMessageChannelsendFinal in interface WritableMessageChannelbuffer - the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean sendFinal(ByteBuffer[] buffers) throws IOException
WritableMessageChannelsendFinal in interface WritableMessageChannelbuffers - the buffers holding the message to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean sendFinal(ByteBuffer[] buffers, int offs, int len) throws IOException
WritableMessageChannelsendFinal in interface WritableMessageChannelbuffers - the buffers holding the message to sendoffs - the offset into the buffer array of the first bufferlen - the number of buffers that contain data to sendtrue if the message was sent, or false if it would blockIOException - if an I/O error occurspublic boolean flush()
throws IOException
SuspendableWriteChanneltrue. If there is data to flush which cannot be immediately written, this method
will return false. If this method returns true after SuspendableWriteChannel.shutdownWrites() was called on
this channel, the write listener will no longer be invoked on this channel. If this is case and additionally
this is a write-only channel or the read side was previously shut down, then the channel will
automatically be closed.flush in interface SuspendableWriteChanneltrue if the message was flushed, or false if the result would blockIOException - if an I/O error occurspublic boolean supportsOption(Option<?> option)
ConfigurablesupportsOption in interface Configurableoption - the optiontrue if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
ConfigurablegetOption in interface ConfigurableT - the type of the option valueoption - the option to getnull if it is not setIOException - if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
ConfigurablesetOption in interface ConfigurableT - the type of the option valueoption - the option to setvalue - the value of the option to setIllegalArgumentException - if the value is not acceptable for this optionIOException - if an I/O error occurred when modifying the optionpublic void shutdownWrites()
throws IOException
SuspendableWriteChannelSuspendableWriteChannel.flush() method; once this is done, if the read side of the channel was shut down, the channel will
automatically close.shutdownWrites in interface SuspendableWriteChannelIOException - if an I/O error occurspublic boolean isOpen()
SuspendableWriteChannelfalse if all directions are shut down,
even if there is unflushed write data pending.isOpen in interface ChannelisOpen in interface SuspendableWriteChanneltrue if the channel is open, false otherwisepublic void close()
throws IOException
SuspendableWriteChannelclose in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in interface CloseableChannelclose in interface SuspendableWriteChannelIOException - if the close failed@Deprecated public XnioExecutor getWriteThread()
SuspendableWriteChannelgetWriteThread in interface SuspendableWriteChannelnull if none is configured or availablepublic XnioIoThread getIoThread()
CloseableChannelgetIoThread in interface CloseableChannelpublic XnioWorker getWorker()
CloseableChannelgetWorker in interface CloseableChannelpublic ConduitWritableMessageChannel clone()
Copyright © 2017 JBoss by Red Hat. All rights reserved.