C
- the channel type implemented by this classW
- the channel type being wrapped by this class@Deprecated public abstract class TranslatingSuspendableChannel<C extends SuspendableChannel,W extends SuspendableChannel> extends Object implements SuspendableChannel, WrappedChannel<W>, ReadListenerSettable<C>, WriteListenerSettable<C>, CloseListenerSettable<C>
ReadListenerSettable.Setter<C extends Channel>
WriteListenerSettable.Setter<C extends Channel>
CloseListenerSettable.Setter<C extends Channel>
Modifier and Type | Field and Description |
---|---|
protected W |
channel
Deprecated.
The wrapped channel.
|
EMPTY
Modifier | Constructor and Description |
---|---|
protected |
TranslatingSuspendableChannel(W channel)
Deprecated.
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
awaitReadable()
Deprecated.
Block until this channel becomes readable again.
|
void |
awaitReadable(long time,
TimeUnit timeUnit)
Deprecated.
Block until this channel becomes readable again, or until the timeout expires.
|
void |
awaitWritable()
Deprecated.
Block until this channel becomes writable again.
|
void |
awaitWritable(long time,
TimeUnit timeUnit)
Deprecated.
Block until this channel becomes writable again, or until the timeout expires.
|
protected void |
clearReadReady()
Deprecated.
Indicate that the channel is no longer definitely immediately readable.
|
protected void |
clearReadRequiresWrite()
Deprecated.
Indicate that the channel no longer requires writability for reads to proceed.
|
protected void |
clearWriteReady()
Deprecated.
Indicate that the channel is no longer definitely immediately writable.
|
protected void |
clearWriteRequiresRead()
Deprecated.
Indicate that the channel no longer requires writability for writes to proceed.
|
void |
close()
Deprecated.
Close this channel.
|
protected void |
closeAction(boolean readShutDown,
boolean writeShutDown)
Deprecated.
The action to perform when the channel is closed via the
close() method. |
boolean |
flush()
Deprecated.
Perform channel flush.
|
protected boolean |
flushAction(boolean shutDown)
Deprecated.
The action to perform when the channel is flushed.
|
W |
getChannel()
Deprecated.
Get the channel which is wrapped by this object.
|
ChannelListener<? super C> |
getCloseListener()
Deprecated.
Get the close listener.
|
ChannelListener.Setter<C> |
getCloseSetter()
Deprecated.
Get the setter which can be used to change the close listener for this channel.
|
XnioIoThread |
getIoThread()
Deprecated.
Get the I/O thread associated with this channel.
|
<T> T |
getOption(Option<T> option)
Deprecated.
Get the value of a channel option.
|
ChannelListener<? super C> |
getReadListener()
Deprecated.
Get the read listener.
|
ChannelListener.Setter<C> |
getReadSetter()
Deprecated.
Get the setter which can be used to change the read listener for this channel.
|
XnioExecutor |
getReadThread()
Deprecated.
|
XnioWorker |
getWorker()
Deprecated.
Get the worker for this channel.
|
ChannelListener<? super C> |
getWriteListener()
Deprecated.
Get the write listener.
|
ChannelListener.Setter<C> |
getWriteSetter()
Deprecated.
Get the setter which can be used to change the write listener for this channel.
|
XnioExecutor |
getWriteThread()
Deprecated.
|
protected void |
handleClosed()
Deprecated.
Called when the underlying channel is closed.
|
protected void |
handleReadable()
Deprecated.
Called when the underlying channel is readable.
|
protected void |
handleWritable()
Deprecated.
Called when the underlying channel is writable.
|
boolean |
isOpen()
Deprecated.
Determine whether this channel is open.
|
boolean |
isReadResumed()
Deprecated.
Determine whether reads are resumed.
|
protected boolean |
isReadShutDown()
Deprecated.
Determine whether the channel is shut down for reads.
|
protected boolean |
isWriteComplete()
Deprecated.
|
boolean |
isWriteResumed()
Deprecated.
Determine whether writes are resumed.
|
protected boolean |
isWriteShutDown()
Deprecated.
Determine whether the channel is shut down for writes.
|
protected boolean |
readRequiresWrite()
Deprecated.
Indicate if the channel is not readable until the write handler is called.
|
protected void |
removeReadRequiresExternal()
Deprecated.
Indicate that one external read task was completed.
|
protected void |
removeWriteRequiresExternal()
Deprecated.
Indicate that one external write task was completed.
|
void |
resumeReads()
Deprecated.
Resume reads on this channel.
|
void |
resumeWrites()
Deprecated.
Resume writes on this channel.
|
protected boolean |
setClosed()
Deprecated.
Set both the channel read and write shut down flags.
|
void |
setCloseListener(ChannelListener<? super C> closeListener)
Deprecated.
Set the close listener.
|
<T> T |
setOption(Option<T> option,
T value)
Deprecated.
Set an option for this channel.
|
void |
setReadListener(ChannelListener<? super C> readListener)
Deprecated.
Set the read listener.
|
protected void |
setReadReady()
Deprecated.
Indicate that the channel is definitely immediately readable, regardless of the underlying channel state.
|
protected void |
setReadRequiresWrite()
Deprecated.
Indicate that the channel will not be readable until the write handler is called.
|
protected boolean |
setReadShutDown()
Deprecated.
Set the channel read shut down flag.
|
void |
setWriteListener(ChannelListener<? super C> writeListener)
Deprecated.
Set the write listener.
|
protected void |
setWriteReady()
Deprecated.
Indicate that the channel is definitely immediately writable, regardless of the underlying channel state.
|
protected void |
setWriteRequiresRead()
Deprecated.
Indicate that the channel will not be writable until the read handler is called.
|
protected boolean |
setWriteShutDown()
Deprecated.
Set the channel write shut down flag.
|
void |
shutdownReads()
Deprecated.
Perform the read shutdown action if it hasn't been performed already.
|
protected void |
shutdownReadsAction(boolean writeComplete)
Deprecated.
The action to perform when reads are shut down.
|
void |
shutdownWrites()
Deprecated.
Perform the write shutdown action if it hasn't been performed already.
|
protected void |
shutdownWritesAction()
Deprecated.
The action to perform when writes are requested to be shut down.
|
protected void |
shutdownWritesComplete(boolean readShutDown)
Deprecated.
Notification that the channel has successfully flushed after having shut down writes.
|
boolean |
supportsOption(Option<?> option)
Deprecated.
Determine whether an option is supported on this channel.
|
void |
suspendReads()
Deprecated.
Suspend further read notifications on this channel.
|
void |
suspendWrites()
Deprecated.
Suspend further write notifications on this channel.
|
protected C |
thisTyped()
Deprecated.
Get this channel, cast to the implemented channel type.
|
String |
toString()
Deprecated.
|
protected boolean |
tryAddReadRequiresExternal()
Deprecated.
Indicate that read requires an external task to complete.
|
protected boolean |
tryAddWriteRequiresExternal()
Deprecated.
Indicate that write requires an external task to complete.
|
void |
wakeupReads()
Deprecated.
Resume reads on this channel, and force the read listener to be triggered even if the
channel isn't actually readable. |
void |
wakeupWrites()
Deprecated.
Resume writes on this channel, and force the write listener to be triggered even if the
channel isn't actually writable. |
protected boolean |
writeRequiresRead()
Deprecated.
Indicate if the channel is not writable until the read handler is called.
|
protected final W extends SuspendableChannel channel
protected TranslatingSuspendableChannel(W channel)
channel
- the channel being wrappedprotected void handleReadable()
protected void handleWritable()
protected void handleClosed()
protected void setReadReady()
protected void clearReadReady()
protected void setReadRequiresWrite()
protected boolean readRequiresWrite()
protected void clearReadRequiresWrite()
protected boolean tryAddReadRequiresExternal()
true
if the flag was set, false
if too many tasks are already outstandingprotected void removeReadRequiresExternal()
tryAddReadRequiresExternal()
returned true
.protected boolean setReadShutDown()
true
if the channel has fully closed due to this call, false
otherwiseprotected void setWriteReady()
protected void clearWriteReady()
protected void setWriteRequiresRead()
protected boolean writeRequiresRead()
protected void clearWriteRequiresRead()
protected boolean tryAddWriteRequiresExternal()
true
if the flag was set, false
if too many tasks are already outstandingprotected void removeWriteRequiresExternal()
tryAddWriteRequiresExternal()
returned true
.protected boolean setWriteShutDown()
true
if the channel has fully closed due to this call, false
otherwiseprotected boolean setClosed()
true
if the channel has fully closed (for the first time) due to this call, false
otherwiseprotected final C thisTyped()
this
public void setReadListener(ChannelListener<? super C> readListener)
ReadListenerSettable
setReadListener
in interface ReadListenerSettable<C extends SuspendableChannel>
readListener
- the read listenerpublic ChannelListener<? super C> getReadListener()
ReadListenerSettable
getReadListener
in interface ReadListenerSettable<C extends SuspendableChannel>
public void setWriteListener(ChannelListener<? super C> writeListener)
WriteListenerSettable
setWriteListener
in interface WriteListenerSettable<C extends SuspendableChannel>
writeListener
- the write listenerpublic ChannelListener<? super C> getWriteListener()
WriteListenerSettable
getWriteListener
in interface WriteListenerSettable<C extends SuspendableChannel>
public void setCloseListener(ChannelListener<? super C> closeListener)
CloseListenerSettable
setCloseListener
in interface CloseListenerSettable<C extends SuspendableChannel>
closeListener
- the close listenerpublic ChannelListener<? super C> getCloseListener()
CloseListenerSettable
getCloseListener
in interface CloseListenerSettable<C extends SuspendableChannel>
public ChannelListener.Setter<C> getCloseSetter()
getCloseSetter
in interface CloseableChannel
getCloseSetter
in interface SuspendableChannel
getCloseSetter
in interface SuspendableReadChannel
getCloseSetter
in interface SuspendableWriteChannel
public ChannelListener.Setter<C> getReadSetter()
getReadSetter
in interface SuspendableChannel
getReadSetter
in interface SuspendableReadChannel
public ChannelListener.Setter<C> getWriteSetter()
getWriteSetter
in interface SuspendableChannel
getWriteSetter
in interface SuspendableWriteChannel
public void suspendReads()
suspendReads
in interface SuspendableReadChannel
public void resumeReads()
resumeReads
in interface SuspendableReadChannel
public boolean isReadResumed()
SuspendableReadChannel
isReadResumed
in interface SuspendableReadChannel
true
if reads are resumed, false
if reads are suspendedpublic void wakeupReads()
Resume reads
on this channel, and force the read listener to be triggered even if the
channel isn't actually readable.wakeupReads
in interface SuspendableReadChannel
public void suspendWrites()
suspendWrites
in interface SuspendableWriteChannel
public void resumeWrites()
resumeWrites
in interface SuspendableWriteChannel
public boolean isWriteResumed()
SuspendableWriteChannel
isWriteResumed
in interface SuspendableWriteChannel
true
if writes are resumed, false
if writes are suspendedpublic void wakeupWrites()
Resume writes
on this channel, and force the write listener to be triggered even if the
channel isn't actually writable.wakeupWrites
in interface SuspendableWriteChannel
public boolean supportsOption(Option<?> option)
supportsOption
in interface Configurable
option
- the optiontrue
if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
getOption
in interface Configurable
T
- 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
setOption
in interface Configurable
T
- 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 final boolean flush() throws IOException
flushAction(boolean)
.flush
in interface SuspendableWriteChannel
true
if the flush completed, or false
if the operation would blockIOException
- if an error occursprotected boolean flushAction(boolean shutDown) throws IOException
shutDown
parameter is set, and this method returns true
, the underlying channel will be
shut down and this method will never be called again (future calls to flush()
will flush the underlying
channel until it returns true
).shutDown
- true
if the channel's write side has been shut down, false
otherwisetrue
if the flush succeeded, false
if it would blockIOException
- if an error occursprotected void shutdownWritesComplete(boolean readShutDown) throws IOException
readShutDown
- true
if the read side was already shut down, false
otherwiseIOException
- if an error occurspublic void shutdownReads() throws IOException
shutdownReads
in interface SuspendableReadChannel
IOException
- if an I/O error occursprotected void shutdownReadsAction(boolean writeComplete) throws IOException
writeComplete
- IOException
- if an error occursprotected boolean isReadShutDown()
public void shutdownWrites() throws IOException
shutdownWrites
in interface SuspendableWriteChannel
IOException
- if an I/O error occursprotected void shutdownWritesAction() throws IOException
IOException
- if an error occursprotected boolean isWriteShutDown()
protected boolean isWriteComplete()
public void awaitReadable() throws IOException
awaitReadable
in interface SuspendableReadChannel
InterruptedIOException
- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException
- if an I/O error occurspublic void awaitReadable(long time, TimeUnit timeUnit) throws IOException
awaitReadable
in interface SuspendableReadChannel
time
- 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 occurs@Deprecated public XnioExecutor getReadThread()
SuspendableReadChannel
getReadThread
in interface SuspendableReadChannel
null
if none is configured or availablepublic void awaitWritable() throws IOException
awaitWritable
in interface SuspendableWriteChannel
InterruptedIOException
- 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
awaitWritable
in interface SuspendableWriteChannel
time
- 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 occurs@Deprecated public XnioExecutor getWriteThread()
SuspendableWriteChannel
getWriteThread
in interface SuspendableWriteChannel
null
if none is configured or availablepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface CloseableChannel
close
in interface SuspendableWriteChannel
IOException
- if an I/O error occursprotected void closeAction(boolean readShutDown, boolean writeShutDown) throws IOException
close()
method. By default, the underlying
channel is closed.readShutDown
- if reads were previously shut downwriteShutDown
- if writes were previously shut downIOException
- if an error occurspublic boolean isOpen()
false
if all directions are shut down,
even if there is unflushed write data pending.isOpen
in interface Channel
isOpen
in interface SuspendableWriteChannel
true
if the channel is open, false
otherwisepublic W getChannel()
getChannel
in interface WrappedChannel<W extends SuspendableChannel>
public XnioWorker getWorker()
getWorker
in interface CloseableChannel
public XnioIoThread getIoThread()
getIoThread
in interface CloseableChannel
Copyright © 2019 JBoss by Red Hat. All rights reserved.