Module 

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 class
W - 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

    Fields
    Modifier and Type
    Field
    Description
    protected final W
    Deprecated.
    The wrapped channel.

    Fields inherited from interface org.xnio.channels.Configurable

    EMPTY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Deprecated.
    Construct a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    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
    Deprecated.
    Indicate that the channel is no longer definitely immediately readable.
    protected void
    Deprecated.
    Indicate that the channel no longer requires writability for reads to proceed.
    protected void
    Deprecated.
    Indicate that the channel is no longer definitely immediately writable.
    protected void
    Deprecated.
    Indicate that the channel no longer requires writability for writes to proceed.
    void
    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.
    final boolean
    Deprecated.
    Perform channel flush.
    protected boolean
    flushAction(boolean shutDown)
    Deprecated.
    The action to perform when the channel is flushed.
    Deprecated.
    Get the channel which is wrapped by this object.
    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> T
    getOption(Option<T> option)
    Deprecated.
    Get the value of a channel option.
    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.
    Deprecated.
    Get the write listener.
    Deprecated.
    Get the setter which can be used to change the write listener for this channel.
    Deprecated.
    protected void
    Deprecated.
    Called when the underlying channel is closed.
    protected void
    Deprecated.
    Called when the underlying channel is readable.
    protected void
    Deprecated.
    Called when the underlying channel is writable.
    boolean
    Deprecated.
    Determine whether this channel is open.
    boolean
    Deprecated.
    Determine whether reads are resumed.
    protected boolean
    Deprecated.
    Determine whether the channel is shut down for reads.
    protected boolean
    Deprecated.
     
    boolean
    Deprecated.
    Determine whether writes are resumed.
    protected boolean
    Deprecated.
    Determine whether the channel is shut down for writes.
    protected boolean
    Deprecated.
    Indicate if the channel is not readable until the write handler is called.
    protected void
    Deprecated.
    Indicate that one external read task was completed.
    protected void
    Deprecated.
    Indicate that one external write task was completed.
    void
    Deprecated.
    Resume reads on this channel.
    void
    Deprecated.
    Resume writes on this channel.
    protected boolean
    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
    Deprecated.
    Indicate that the channel is definitely immediately readable, regardless of the underlying channel state.
    protected void
    Deprecated.
    Indicate that the channel will not be readable until the write handler is called.
    protected boolean
    Deprecated.
    Set the channel read shut down flag.
    void
    setWriteListener(ChannelListener<? super C> writeListener)
    Deprecated.
    Set the write listener.
    protected void
    Deprecated.
    Indicate that the channel is definitely immediately writable, regardless of the underlying channel state.
    protected void
    Deprecated.
    Indicate that the channel will not be writable until the read handler is called.
    protected boolean
    Deprecated.
    Set the channel write shut down flag.
    void
    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
    Deprecated.
    Perform the write shutdown action if it hasn't been performed already.
    protected void
    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
    Deprecated.
    Determine whether an option is supported on this channel.
    void
    Deprecated.
    Suspend further read notifications on this channel.
    void
    Deprecated.
    Suspend further write notifications on this channel.
    protected final C
    Deprecated.
    Get this channel, cast to the implemented channel type.
    Deprecated.
    protected boolean
    Deprecated.
    Indicate that read requires an external task to complete.
    protected boolean
    Deprecated.
    Indicate that write requires an external task to complete.
    void
    Deprecated.
    Resume reads on this channel, and force the read listener to be triggered even if the channel isn't actually readable.
    void
    Deprecated.
    Resume writes on this channel, and force the write listener to be triggered even if the channel isn't actually writable.
    protected boolean
    Deprecated.
    Indicate if the channel is not writable until the read handler is called.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • channel

      protected final W extends SuspendableChannel channel
      Deprecated.
      The wrapped channel.
  • Constructor Details

    • TranslatingSuspendableChannel

      protected TranslatingSuspendableChannel(W channel)
      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:
      true if the flag was set, false if 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 that tryAddReadRequiresExternal() returned true.
    • setReadShutDown

      protected boolean setReadShutDown()
      Deprecated.
      Set the channel read shut down flag.
      Returns:
      true if the channel has fully closed due to this call, false otherwise
    • 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:
      true if the flag was set, false if 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 that tryAddWriteRequiresExternal() returned true.
    • setWriteShutDown

      protected boolean setWriteShutDown()
      Deprecated.
      Set the channel write shut down flag.
      Returns:
      true if the channel has fully closed due to this call, false otherwise
    • setClosed

      protected boolean setClosed()
      Deprecated.
      Set both the channel read and write shut down flags.
      Returns:
      true if the channel has fully closed (for the first time) due to this call, false otherwise
    • thisTyped

      protected final C thisTyped()
      Deprecated.
      Get this channel, cast to the implemented channel type.
      Returns:
      this
    • setReadListener

      public void setReadListener(ChannelListener<? super C> readListener)
      Deprecated.
      Description copied from interface: ReadListenerSettable
      Set the read listener.
      Specified by:
      setReadListener in interface ReadListenerSettable<C extends SuspendableChannel>
      Parameters:
      readListener - the read listener
    • getReadListener

      public ChannelListener<? super C> getReadListener()
      Deprecated.
      Description copied from interface: ReadListenerSettable
      Get the read listener.
      Specified by:
      getReadListener in interface ReadListenerSettable<C extends SuspendableChannel>
      Returns:
      the read listener
    • setWriteListener

      public void setWriteListener(ChannelListener<? super C> writeListener)
      Deprecated.
      Description copied from interface: WriteListenerSettable
      Set the write listener.
      Specified by:
      setWriteListener in interface WriteListenerSettable<C extends SuspendableChannel>
      Parameters:
      writeListener - the write listener
    • getWriteListener

      public ChannelListener<? super C> getWriteListener()
      Deprecated.
      Description copied from interface: WriteListenerSettable
      Get the write listener.
      Specified by:
      getWriteListener in interface WriteListenerSettable<C extends SuspendableChannel>
      Returns:
      the write listener
    • setCloseListener

      public void setCloseListener(ChannelListener<? super C> closeListener)
      Deprecated.
      Description copied from interface: CloseListenerSettable
      Set the close listener.
      Specified by:
      setCloseListener in interface CloseListenerSettable<C extends SuspendableChannel>
      Parameters:
      closeListener - the close listener
    • getCloseListener

      public ChannelListener<? super C> getCloseListener()
      Deprecated.
      Description copied from interface: CloseListenerSettable
      Get the close listener.
      Specified by:
      getCloseListener in interface CloseListenerSettable<C extends SuspendableChannel>
      Returns:
      the close listener
    • getCloseSetter

      public ChannelListener.Setter<C> 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:
      getCloseSetter in interface CloseableChannel
      Specified by:
      getCloseSetter in interface SuspendableChannel
      Specified by:
      getCloseSetter in interface SuspendableReadChannel
      Specified by:
      getCloseSetter in interface SuspendableWriteChannel
      Returns:
      the setter
    • getReadSetter

      public ChannelListener.Setter<C> getReadSetter()
      Deprecated.
      Get the setter which can be used to change the read listener for this channel.
      Specified by:
      getReadSetter in interface SuspendableChannel
      Specified by:
      getReadSetter in interface SuspendableReadChannel
      Returns:
      the setter
    • getWriteSetter

      public ChannelListener.Setter<C> getWriteSetter()
      Deprecated.
      Get the setter which can be used to change the write listener for this channel.
      Specified by:
      getWriteSetter in interface SuspendableChannel
      Specified by:
      getWriteSetter in interface SuspendableWriteChannel
      Returns:
      the setter
    • suspendReads

      public void suspendReads()
      Deprecated.
      Suspend further read notifications on this channel.
      Specified by:
      suspendReads in interface SuspendableReadChannel
    • 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:
      resumeReads in interface SuspendableReadChannel
    • isReadResumed

      public boolean isReadResumed()
      Deprecated.
      Description copied from interface: SuspendableReadChannel
      Determine whether reads are resumed.
      Specified by:
      isReadResumed in interface SuspendableReadChannel
      Returns:
      true if reads are resumed, false if reads are suspended
    • wakeupReads

      public void wakeupReads()
      Deprecated.
      Resume reads on this channel, and force the read listener to be triggered even if the channel isn't actually readable.
      Specified by:
      wakeupReads in interface SuspendableReadChannel
    • suspendWrites

      public void suspendWrites()
      Deprecated.
      Suspend further write notifications on this channel.
      Specified by:
      suspendWrites in interface SuspendableWriteChannel
    • 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:
      resumeWrites in interface SuspendableWriteChannel
    • isWriteResumed

      public boolean isWriteResumed()
      Deprecated.
      Description copied from interface: SuspendableWriteChannel
      Determine whether writes are resumed.
      Specified by:
      isWriteResumed in interface SuspendableWriteChannel
      Returns:
      true if writes are resumed, false if writes are suspended
    • wakeupWrites

      public void wakeupWrites()
      Deprecated.
      Resume writes on this channel, and force the write listener to be triggered even if the channel isn't actually writable.
      Specified by:
      wakeupWrites in interface SuspendableWriteChannel
    • supportsOption

      public boolean supportsOption(Option<?> option)
      Deprecated.
      Determine whether an option is supported on this channel.
      Specified by:
      supportsOption in interface Configurable
      Parameters:
      option - the option
      Returns:
      true if it is supported
    • getOption

      public <T> T getOption(Option<T> option) throws IOException
      Deprecated.
      Get the value of a channel option.
      Specified by:
      getOption in interface Configurable
      Type Parameters:
      T - the type of the option value
      Parameters:
      option - the option to get
      Returns:
      the value of the option, or null if it is not set
      Throws:
      IOException - if an I/O error occurred when reading the option
    • setOption

      public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
      Deprecated.
      Set an option for this channel. Unsupported options are ignored.
      Specified by:
      setOption in interface Configurable
      Type Parameters:
      T - the type of the option value
      Parameters:
      option - the option to set
      value - the value of the option to set
      Returns:
      the previous option value, if any
      Throws:
      IllegalArgumentException - if the value is not acceptable for this option
      IOException - if an I/O error occurred when modifying the option
    • flush

      public final boolean flush() throws IOException
      Deprecated.
      Perform channel flush. To change the action taken to flush, subclasses should override flushAction(boolean).
      Specified by:
      flush in interface SuspendableWriteChannel
      Returns:
      true if the flush completed, or false if the operation would block
      Throws:
      IOException - if an error occurs
    • flushAction

      protected boolean flushAction(boolean shutDown) throws IOException
      Deprecated.
      The action to perform when the channel is flushed. By default, this method delegates to the underlying channel. If the 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).
      Parameters:
      shutDown - true if the channel's write side has been shut down, false otherwise
      Returns:
      true if the flush succeeded, false if it would block
      Throws:
      IOException - if an error occurs
    • shutdownWritesComplete

      protected void shutdownWritesComplete(boolean readShutDown) throws IOException
      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 - true if the read side was already shut down, false otherwise
      Throws:
      IOException - if an error occurs
    • shutdownReads

      public void shutdownReads() throws IOException
      Deprecated.
      Perform the read shutdown action if it hasn't been performed already.
      Specified by:
      shutdownReads in interface SuspendableReadChannel
      Throws:
      IOException - if an I/O error occurs
    • shutdownReadsAction

      protected void shutdownReadsAction(boolean writeComplete) throws IOException
      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

      public void shutdownWrites() throws IOException
      Deprecated.
      Perform the write shutdown action if it hasn't been performed already.
      Specified by:
      shutdownWrites in interface SuspendableWriteChannel
      Throws:
      IOException - if an I/O error occurs
    • shutdownWritesAction

      protected void shutdownWritesAction() throws IOException
      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

      public void awaitReadable() throws IOException
      Deprecated.
      Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.
      Specified by:
      awaitReadable in interface SuspendableReadChannel
      Throws:
      InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
      IOException - if an I/O error occurs
    • awaitReadable

      public void awaitReadable(long time, TimeUnit timeUnit) throws IOException
      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:
      awaitReadable in interface SuspendableReadChannel
      Parameters:
      time - the time to wait
      timeUnit - the time unit
      Throws:
      InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
      IOException - if an I/O error occurs
    • getReadThread

      @Deprecated public XnioExecutor getReadThread()
      Deprecated.
      Description copied from interface: SuspendableReadChannel
      Get the read thread for this channel.
      Specified by:
      getReadThread in interface SuspendableReadChannel
      Returns:
      the thread, or null if none is configured or available
    • awaitWritable

      public void awaitWritable() throws IOException
      Deprecated.
      Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.
      Specified by:
      awaitWritable in interface SuspendableWriteChannel
      Throws:
      InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
      IOException - if an I/O error occurs
    • awaitWritable

      public void awaitWritable(long time, TimeUnit timeUnit) throws IOException
      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:
      awaitWritable in interface SuspendableWriteChannel
      Parameters:
      time - the time to wait
      timeUnit - the time unit
      Throws:
      InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
      IOException - if an I/O error occurs
    • getWriteThread

      @Deprecated public XnioExecutor getWriteThread()
      Deprecated.
      Description copied from interface: SuspendableWriteChannel
      Get the write thread for this channel.
      Specified by:
      getWriteThread in interface SuspendableWriteChannel
      Returns:
      the thread, or null if none is configured or available
    • close

      public void close() throws IOException
      Deprecated.
      Close this channel. This method is idempotent.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface CloseableChannel
      Specified by:
      close in interface InterruptibleChannel
      Specified by:
      close in interface SuspendableWriteChannel
      Throws:
      IOException - if an I/O error occurs
    • closeAction

      protected void closeAction(boolean readShutDown, boolean writeShutDown) throws IOException
      Deprecated.
      The action to perform when the channel is closed via the close() method. By default, the underlying channel is closed.
      Parameters:
      readShutDown - if reads were previously shut down
      writeShutDown - 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 return false if all directions are shut down, even if there is unflushed write data pending.
      Specified by:
      isOpen in interface Channel
      Specified by:
      isOpen in interface SuspendableWriteChannel
      Returns:
      true if the channel is open, false otherwise
    • getChannel

      public W getChannel()
      Deprecated.
      Get the channel which is wrapped by this object.
      Specified by:
      getChannel in interface WrappedChannel<C extends SuspendableChannel>
      Returns:
      the wrapped channel
    • getWorker

      public XnioWorker getWorker()
      Deprecated.
      Get the worker for this channel.
      Specified by:
      getWorker in interface CloseableChannel
      Returns:
      the worker
    • getIoThread

      public XnioIoThread getIoThread()
      Deprecated.
      Get the I/O thread associated with this channel.
      Specified by:
      getIoThread in interface CloseableChannel
      Returns:
      the I/O thread associated with this channel
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object