Package org.xnio.channels
Class TranslatingSuspendableChannel<C extends SuspendableChannel,W extends SuspendableChannel>
java.lang.Object
org.xnio.channels.TranslatingSuspendableChannel<C,W>
- Type Parameters:
C- the channel type implemented by this classW- the channel type being wrapped by this class
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,CloseableChannel,CloseListenerSettable<C>,Configurable,ReadListenerSettable<C>,SuspendableChannel,SuspendableReadChannel,SuspendableWriteChannel,WrappedChannel<W>,WriteListenerSettable<C>
- Direct Known Subclasses:
FramedMessageChannel
@Deprecated
public abstract class TranslatingSuspendableChannel<C extends SuspendableChannel,W extends SuspendableChannel>
extends Object
implements SuspendableChannel, WrappedChannel<W>, ReadListenerSettable<C>, WriteListenerSettable<C>, CloseListenerSettable<C>
Deprecated.
This class is deprecated; use conduits instead.
An abstract wrapped channel.
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.xnio.channels.CloseListenerSettable
CloseListenerSettable.Setter<C extends Channel>Nested classes/interfaces inherited from interface org.xnio.channels.ReadListenerSettable
ReadListenerSettable.Setter<C extends Channel>Nested classes/interfaces inherited from interface org.xnio.channels.WriteListenerSettable
WriteListenerSettable.Setter<C extends Channel> -
Field Summary
FieldsFields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTranslatingSuspendableChannel(W channel) Deprecated.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Block until this channel becomes readable again.voidawaitReadable(long time, TimeUnit timeUnit) Deprecated.Block until this channel becomes readable again, or until the timeout expires.voidDeprecated.Block until this channel becomes writable again.voidawaitWritable(long time, TimeUnit timeUnit) Deprecated.Block until this channel becomes writable again, or until the timeout expires.protected voidDeprecated.Indicate that the channel is no longer definitely immediately readable.protected voidDeprecated.Indicate that the channel no longer requires writability for reads to proceed.protected voidDeprecated.Indicate that the channel is no longer definitely immediately writable.protected voidDeprecated.Indicate that the channel no longer requires writability for writes to proceed.voidclose()Deprecated.Close this channel.protected voidcloseAction(boolean readShutDown, boolean writeShutDown) Deprecated.The action to perform when the channel is closed via theclose()method.final booleanflush()Deprecated.Perform channel flush.protected booleanflushAction(boolean shutDown) Deprecated.The action to perform when the channel is flushed.Deprecated.Get the channel which is wrapped by this object.ChannelListener<? super C>Deprecated.Get the close listener.Deprecated.Get the setter which can be used to change the close listener for this channel.Deprecated.Get the I/O thread associated with this channel.<T> TDeprecated.Get the value of a channel option.ChannelListener<? super C>Deprecated.Get the read listener.Deprecated.Get the setter which can be used to change the read listener for this channel.Deprecated.Deprecated.Get the worker for this channel.ChannelListener<? super C>Deprecated.Get the write listener.Deprecated.Get the setter which can be used to change the write listener for this channel.Deprecated.protected voidDeprecated.Called when the underlying channel is closed.protected voidDeprecated.Called when the underlying channel is readable.protected voidDeprecated.Called when the underlying channel is writable.booleanisOpen()Deprecated.Determine whether this channel is open.booleanDeprecated.Determine whether reads are resumed.protected booleanDeprecated.Determine whether the channel is shut down for reads.protected booleanDeprecated.booleanDeprecated.Determine whether writes are resumed.protected booleanDeprecated.Determine whether the channel is shut down for writes.protected booleanDeprecated.Indicate if the channel is not readable until the write handler is called.protected voidDeprecated.Indicate that one external read task was completed.protected voidDeprecated.Indicate that one external write task was completed.voidDeprecated.Resume reads on this channel.voidDeprecated.Resume writes on this channel.protected booleanDeprecated.Set both the channel read and write shut down flags.voidsetCloseListener(ChannelListener<? super C> closeListener) Deprecated.Set the close listener.<T> TDeprecated.Set an option for this channel.voidsetReadListener(ChannelListener<? super C> readListener) Deprecated.Set the read listener.protected voidDeprecated.Indicate that the channel is definitely immediately readable, regardless of the underlying channel state.protected voidDeprecated.Indicate that the channel will not be readable until the write handler is called.protected booleanDeprecated.Set the channel read shut down flag.voidsetWriteListener(ChannelListener<? super C> writeListener) Deprecated.Set the write listener.protected voidDeprecated.Indicate that the channel is definitely immediately writable, regardless of the underlying channel state.protected voidDeprecated.Indicate that the channel will not be writable until the read handler is called.protected booleanDeprecated.Set the channel write shut down flag.voidDeprecated.Perform the read shutdown action if it hasn't been performed already.protected voidshutdownReadsAction(boolean writeComplete) Deprecated.The action to perform when reads are shut down.voidDeprecated.Perform the write shutdown action if it hasn't been performed already.protected voidDeprecated.The action to perform when writes are requested to be shut down.protected voidshutdownWritesComplete(boolean readShutDown) Deprecated.Notification that the channel has successfully flushed after having shut down writes.booleansupportsOption(Option<?> option) Deprecated.Determine whether an option is supported on this channel.voidDeprecated.Suspend further read notifications on this channel.voidDeprecated.Suspend further write notifications on this channel.protected final CDeprecated.Get this channel, cast to the implemented channel type.toString()Deprecated.protected booleanDeprecated.Indicate that read requires an external task to complete.protected booleanDeprecated.Indicate that write requires an external task to complete.voidDeprecated.Resume readson this channel, and force the read listener to be triggered even if the channel isn't actually readable.voidDeprecated.Resume writeson this channel, and force the write listener to be triggered even if the channel isn't actually writable.protected booleanDeprecated.Indicate if the channel is not writable until the read handler is called.
-
Field Details
-
channel
Deprecated.The wrapped channel.
-
-
Constructor Details
-
TranslatingSuspendableChannel
Deprecated.Construct a new instance.- Parameters:
channel- the channel being wrapped
-
-
Method Details
-
handleReadable
protected void handleReadable()Deprecated.Called when the underlying channel is readable. -
handleWritable
protected void handleWritable()Deprecated.Called when the underlying channel is writable. -
handleClosed
protected void handleClosed()Deprecated.Called when the underlying channel is closed. -
setReadReady
protected void setReadReady()Deprecated.Indicate that the channel is definitely immediately readable, regardless of the underlying channel state. -
clearReadReady
protected void clearReadReady()Deprecated.Indicate that the channel is no longer definitely immediately readable. -
setReadRequiresWrite
protected void setReadRequiresWrite()Deprecated.Indicate that the channel will not be readable until the write handler is called. -
readRequiresWrite
protected boolean readRequiresWrite()Deprecated.Indicate if the channel is not readable until the write handler is called. -
clearReadRequiresWrite
protected void clearReadRequiresWrite()Deprecated.Indicate that the channel no longer requires writability for reads to proceed. -
tryAddReadRequiresExternal
protected boolean tryAddReadRequiresExternal()Deprecated.Indicate that read requires an external task to complete.- Returns:
trueif the flag was set,falseif too many tasks are already outstanding
-
removeReadRequiresExternal
protected void removeReadRequiresExternal()Deprecated.Indicate that one external read task was completed. This method should be called once for every time thattryAddReadRequiresExternal()returnedtrue. -
setReadShutDown
protected boolean setReadShutDown()Deprecated.Set the channel read shut down flag.- Returns:
trueif the channel has fully closed due to this call,falseotherwise
-
setWriteReady
protected void setWriteReady()Deprecated.Indicate that the channel is definitely immediately writable, regardless of the underlying channel state. -
clearWriteReady
protected void clearWriteReady()Deprecated.Indicate that the channel is no longer definitely immediately writable. -
setWriteRequiresRead
protected void setWriteRequiresRead()Deprecated.Indicate that the channel will not be writable until the read handler is called. -
writeRequiresRead
protected boolean writeRequiresRead()Deprecated.Indicate if the channel is not writable until the read handler is called. -
clearWriteRequiresRead
protected void clearWriteRequiresRead()Deprecated.Indicate that the channel no longer requires writability for writes to proceed. -
tryAddWriteRequiresExternal
protected boolean tryAddWriteRequiresExternal()Deprecated.Indicate that write requires an external task to complete.- Returns:
trueif the flag was set,falseif too many tasks are already outstanding
-
removeWriteRequiresExternal
protected void removeWriteRequiresExternal()Deprecated.Indicate that one external write task was completed. This method should be called once for every time thattryAddWriteRequiresExternal()returnedtrue. -
setWriteShutDown
protected boolean setWriteShutDown()Deprecated.Set the channel write shut down flag.- Returns:
trueif the channel has fully closed due to this call,falseotherwise
-
setClosed
protected boolean setClosed()Deprecated.Set both the channel read and write shut down flags.- Returns:
trueif the channel has fully closed (for the first time) due to this call,falseotherwise
-
thisTyped
Deprecated.Get this channel, cast to the implemented channel type.- Returns:
this
-
setReadListener
Deprecated.Description copied from interface:ReadListenerSettableSet the read listener.- Specified by:
setReadListenerin interfaceReadListenerSettable<C extends SuspendableChannel>- Parameters:
readListener- the read listener
-
getReadListener
Deprecated.Description copied from interface:ReadListenerSettableGet the read listener.- Specified by:
getReadListenerin interfaceReadListenerSettable<C extends SuspendableChannel>- Returns:
- the read listener
-
setWriteListener
Deprecated.Description copied from interface:WriteListenerSettableSet the write listener.- Specified by:
setWriteListenerin interfaceWriteListenerSettable<C extends SuspendableChannel>- Parameters:
writeListener- the write listener
-
getWriteListener
Deprecated.Description copied from interface:WriteListenerSettableGet the write listener.- Specified by:
getWriteListenerin interfaceWriteListenerSettable<C extends SuspendableChannel>- Returns:
- the write listener
-
setCloseListener
Deprecated.Description copied from interface:CloseListenerSettableSet the close listener.- Specified by:
setCloseListenerin interfaceCloseListenerSettable<C extends SuspendableChannel>- Parameters:
closeListener- the close listener
-
getCloseListener
Deprecated.Description copied from interface:CloseListenerSettableGet the close listener.- Specified by:
getCloseListenerin interfaceCloseListenerSettable<C extends SuspendableChannel>- Returns:
- the close listener
-
getCloseSetter
Deprecated.Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.- Specified by:
getCloseSetterin interfaceCloseableChannel- Specified by:
getCloseSetterin interfaceSuspendableChannel- Specified by:
getCloseSetterin interfaceSuspendableReadChannel- Specified by:
getCloseSetterin interfaceSuspendableWriteChannel- Returns:
- the setter
-
getReadSetter
Deprecated.Get the setter which can be used to change the read listener for this channel.- Specified by:
getReadSetterin interfaceSuspendableChannel- Specified by:
getReadSetterin interfaceSuspendableReadChannel- Returns:
- the setter
-
getWriteSetter
Deprecated.Get the setter which can be used to change the write listener for this channel.- Specified by:
getWriteSetterin interfaceSuspendableChannel- Specified by:
getWriteSetterin interfaceSuspendableWriteChannel- Returns:
- the setter
-
suspendReads
public void suspendReads()Deprecated.Suspend further read notifications on this channel.- Specified by:
suspendReadsin interfaceSuspendableReadChannel
-
resumeReads
public void resumeReads()Deprecated.Resume reads on this channel. The read listener will be called as soon as there is data available to be read.- Specified by:
resumeReadsin interfaceSuspendableReadChannel
-
isReadResumed
public boolean isReadResumed()Deprecated.Description copied from interface:SuspendableReadChannelDetermine whether reads are resumed.- Specified by:
isReadResumedin interfaceSuspendableReadChannel- Returns:
trueif reads are resumed,falseif reads are suspended
-
wakeupReads
public void wakeupReads()Deprecated.Resume readson this channel, and force the read listener to be triggered even if the channel isn't actually readable.- Specified by:
wakeupReadsin interfaceSuspendableReadChannel
-
suspendWrites
public void suspendWrites()Deprecated.Suspend further write notifications on this channel.- Specified by:
suspendWritesin interfaceSuspendableWriteChannel
-
resumeWrites
public void resumeWrites()Deprecated.Resume writes on this channel. The write listener will be called as soon as the channel becomes writable.- Specified by:
resumeWritesin interfaceSuspendableWriteChannel
-
isWriteResumed
public boolean isWriteResumed()Deprecated.Description copied from interface:SuspendableWriteChannelDetermine whether writes are resumed.- Specified by:
isWriteResumedin interfaceSuspendableWriteChannel- Returns:
trueif writes are resumed,falseif writes are suspended
-
wakeupWrites
public void wakeupWrites()Deprecated.Resume writeson this channel, and force the write listener to be triggered even if the channel isn't actually writable.- Specified by:
wakeupWritesin interfaceSuspendableWriteChannel
-
supportsOption
Deprecated.Determine whether an option is supported on this channel.- Specified by:
supportsOptionin interfaceConfigurable- Parameters:
option- the option- Returns:
trueif it is supported
-
getOption
Deprecated.Get the value of a channel option.- Specified by:
getOptionin interfaceConfigurable- Type Parameters:
T- the type of the option value- Parameters:
option- the option to get- Returns:
- the value of the option, or
nullif it is not set - Throws:
IOException- if an I/O error occurred when reading the option
-
setOption
Deprecated.Set an option for this channel. Unsupported options are ignored.- Specified by:
setOptionin interfaceConfigurable- Type Parameters:
T- the type of the option value- Parameters:
option- the option to setvalue- the value of the option to set- Returns:
- the previous option value, if any
- Throws:
IllegalArgumentException- if the value is not acceptable for this optionIOException- if an I/O error occurred when modifying the option
-
flush
Deprecated.Perform channel flush. To change the action taken to flush, subclasses should overrideflushAction(boolean).- Specified by:
flushin interfaceSuspendableWriteChannel- Returns:
trueif the flush completed, orfalseif the operation would block- Throws:
IOException- if an error occurs
-
flushAction
Deprecated.The action to perform when the channel is flushed. By default, this method delegates to the underlying channel. If theshutDownparameter is set, and this method returnstrue, the underlying channel will be shut down and this method will never be called again (future calls toflush()will flush the underlying channel until it returnstrue).- Parameters:
shutDown-trueif the channel's write side has been shut down,falseotherwise- Returns:
trueif the flush succeeded,falseif it would block- Throws:
IOException- if an error occurs
-
shutdownWritesComplete
Deprecated.Notification that the channel has successfully flushed after having shut down writes. The underlying channel may not yet be fully flushed at this time.- Parameters:
readShutDown-trueif the read side was already shut down,falseotherwise- Throws:
IOException- if an error occurs
-
shutdownReads
Deprecated.Perform the read shutdown action if it hasn't been performed already.- Specified by:
shutdownReadsin interfaceSuspendableReadChannel- Throws:
IOException- if an I/O error occurs
-
shutdownReadsAction
Deprecated.The action to perform when reads are shut down. By default, this method delegates to the underlying channel.- Parameters:
writeComplete-- Throws:
IOException- if an error occurs
-
isReadShutDown
protected boolean isReadShutDown()Deprecated.Determine whether the channel is shut down for reads.- Returns:
- whether the channel is shut down for reads
-
shutdownWrites
Deprecated.Perform the write shutdown action if it hasn't been performed already.- Specified by:
shutdownWritesin interfaceSuspendableWriteChannel- Throws:
IOException- if an I/O error occurs
-
shutdownWritesAction
Deprecated.The action to perform when writes are requested to be shut down. By default, this method delegates to the underlying channel.- Throws:
IOException- if an error occurs
-
isWriteShutDown
protected boolean isWriteShutDown()Deprecated.Determine whether the channel is shut down for writes.- Returns:
- whether the channel is shut down for writes
-
isWriteComplete
protected boolean isWriteComplete()Deprecated. -
awaitReadable
Deprecated.Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.- Specified by:
awaitReadablein interfaceSuspendableReadChannel- Throws:
InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException- if an I/O error occurs
-
awaitReadable
Deprecated.Block until this channel becomes readable again, or until the timeout expires. This method may return spuriously before the channel becomes readable or the timeout expires.- Specified by:
awaitReadablein interfaceSuspendableReadChannel- Parameters:
time- the time to waittimeUnit- the time unit- Throws:
InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException- if an I/O error occurs
-
getReadThread
Deprecated.Description copied from interface:SuspendableReadChannelGet the read thread for this channel.- Specified by:
getReadThreadin interfaceSuspendableReadChannel- Returns:
- the thread, or
nullif none is configured or available
-
awaitWritable
Deprecated.Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.- Specified by:
awaitWritablein interfaceSuspendableWriteChannel- Throws:
InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException- if an I/O error occurs
-
awaitWritable
Deprecated.Block until this channel becomes writable again, or until the timeout expires. This method may return spuriously before the channel becomes writable or the timeout expires.- Specified by:
awaitWritablein interfaceSuspendableWriteChannel- Parameters:
time- the time to waittimeUnit- the time unit- Throws:
InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException- if an I/O error occurs
-
getWriteThread
Deprecated.Description copied from interface:SuspendableWriteChannelGet the write thread for this channel.- Specified by:
getWriteThreadin interfaceSuspendableWriteChannel- Returns:
- the thread, or
nullif none is configured or available
-
close
Deprecated.Close this channel. This method is idempotent.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableChannel- Specified by:
closein interfaceInterruptibleChannel- Specified by:
closein interfaceSuspendableWriteChannel- Throws:
IOException- if an I/O error occurs
-
closeAction
Deprecated.The action to perform when the channel is closed via theclose()method. By default, the underlying channel is closed.- Parameters:
readShutDown- if reads were previously shut downwriteShutDown- if writes were previously shut down- Throws:
IOException- if an error occurs
-
isOpen
public boolean isOpen()Deprecated.Determine whether this channel is open. This method will returnfalseif all directions are shut down, even if there is unflushed write data pending.- Specified by:
isOpenin interfaceChannel- Specified by:
isOpenin interfaceSuspendableWriteChannel- Returns:
trueif the channel is open,falseotherwise
-
getChannel
Deprecated.Get the channel which is wrapped by this object.- Specified by:
getChannelin interfaceWrappedChannel<C extends SuspendableChannel>- Returns:
- the wrapped channel
-
getWorker
Deprecated.Get the worker for this channel.- Specified by:
getWorkerin interfaceCloseableChannel- Returns:
- the worker
-
getIoThread
Deprecated.Get the I/O thread associated with this channel.- Specified by:
getIoThreadin interfaceCloseableChannel- Returns:
- the I/O thread associated with this channel
-
toString
Deprecated.
-