Class IdleTimeoutConduit

  • All Implemented Interfaces:
    org.xnio.conduits.Conduit, org.xnio.conduits.SinkConduit, org.xnio.conduits.SourceConduit, org.xnio.conduits.StreamSinkConduit, org.xnio.conduits.StreamSourceConduit

    public class IdleTimeoutConduit
    extends Object
    implements org.xnio.conduits.StreamSinkConduit, org.xnio.conduits.StreamSourceConduit
    Conduit that adds support to close a channel once for a specified time no reads and no writes were performed.
    Author:
    Norman Maurer
    • Constructor Detail

      • IdleTimeoutConduit

        public IdleTimeoutConduit​(org.xnio.StreamConnection connection)
    • Method Detail

      • doClose

        protected void doClose()
      • write

        public long write​(ByteBuffer[] srcs,
                          int offset,
                          int length)
                   throws IOException
        Specified by:
        write in interface org.xnio.conduits.StreamSinkConduit
        Throws:
        IOException
      • writeFinal

        public int writeFinal​(ByteBuffer src)
                       throws IOException
        Specified by:
        writeFinal in interface org.xnio.conduits.StreamSinkConduit
        Throws:
        IOException
      • writeFinal

        public long writeFinal​(ByteBuffer[] srcs,
                               int offset,
                               int length)
                        throws IOException
        Specified by:
        writeFinal in interface org.xnio.conduits.StreamSinkConduit
        Throws:
        IOException
      • transferTo

        public long transferTo​(long position,
                               long count,
                               FileChannel target)
                        throws IOException
        Specified by:
        transferTo in interface org.xnio.conduits.StreamSourceConduit
        Throws:
        IOException
      • transferTo

        public long transferTo​(long count,
                               ByteBuffer throughBuffer,
                               org.xnio.channels.StreamSinkChannel target)
                        throws IOException
        Specified by:
        transferTo in interface org.xnio.conduits.StreamSourceConduit
        Throws:
        IOException
      • read

        public long read​(ByteBuffer[] dsts,
                         int offset,
                         int length)
                  throws IOException
        Specified by:
        read in interface org.xnio.conduits.StreamSourceConduit
        Throws:
        IOException
      • transferFrom

        public long transferFrom​(FileChannel src,
                                 long position,
                                 long count)
                          throws IOException
        Specified by:
        transferFrom in interface org.xnio.conduits.StreamSinkConduit
        Throws:
        IOException
      • transferFrom

        public long transferFrom​(org.xnio.channels.StreamSourceChannel source,
                                 long count,
                                 ByteBuffer throughBuffer)
                          throws IOException
        Specified by:
        transferFrom in interface org.xnio.conduits.StreamSinkConduit
        Throws:
        IOException
      • suspendReads

        public void suspendReads()
        Specified by:
        suspendReads in interface org.xnio.conduits.SourceConduit
      • terminateReads

        public void terminateReads()
                            throws IOException
        Specified by:
        terminateReads in interface org.xnio.conduits.SourceConduit
        Throws:
        IOException
      • isReadShutdown

        public boolean isReadShutdown()
        Specified by:
        isReadShutdown in interface org.xnio.conduits.SourceConduit
      • resumeReads

        public void resumeReads()
        Specified by:
        resumeReads in interface org.xnio.conduits.SourceConduit
      • isReadResumed

        public boolean isReadResumed()
        Specified by:
        isReadResumed in interface org.xnio.conduits.SourceConduit
      • wakeupReads

        public void wakeupReads()
        Specified by:
        wakeupReads in interface org.xnio.conduits.SourceConduit
      • awaitReadable

        public void awaitReadable()
                           throws IOException
        Specified by:
        awaitReadable in interface org.xnio.conduits.SourceConduit
        Throws:
        IOException
      • awaitReadable

        public void awaitReadable​(long time,
                                  TimeUnit timeUnit)
                           throws IOException
        Specified by:
        awaitReadable in interface org.xnio.conduits.SourceConduit
        Throws:
        IOException
      • getReadThread

        public org.xnio.XnioIoThread getReadThread()
        Specified by:
        getReadThread in interface org.xnio.conduits.SourceConduit
      • setReadReadyHandler

        public void setReadReadyHandler​(org.xnio.conduits.ReadReadyHandler handler)
        Specified by:
        setReadReadyHandler in interface org.xnio.conduits.SourceConduit
      • terminateWrites

        public void terminateWrites()
                             throws IOException
        Specified by:
        terminateWrites in interface org.xnio.conduits.SinkConduit
        Throws:
        IOException
      • isWriteShutdown

        public boolean isWriteShutdown()
        Specified by:
        isWriteShutdown in interface org.xnio.conduits.SinkConduit
      • resumeWrites

        public void resumeWrites()
        Specified by:
        resumeWrites in interface org.xnio.conduits.SinkConduit
      • suspendWrites

        public void suspendWrites()
        Specified by:
        suspendWrites in interface org.xnio.conduits.SinkConduit
      • wakeupWrites

        public void wakeupWrites()
        Specified by:
        wakeupWrites in interface org.xnio.conduits.SinkConduit
      • isWriteResumed

        public boolean isWriteResumed()
        Specified by:
        isWriteResumed in interface org.xnio.conduits.SinkConduit
      • awaitWritable

        public void awaitWritable()
                           throws IOException
        Specified by:
        awaitWritable in interface org.xnio.conduits.SinkConduit
        Throws:
        IOException
      • awaitWritable

        public void awaitWritable​(long time,
                                  TimeUnit timeUnit)
                           throws IOException
        Specified by:
        awaitWritable in interface org.xnio.conduits.SinkConduit
        Throws:
        IOException
      • getWriteThread

        public org.xnio.XnioIoThread getWriteThread()
        Specified by:
        getWriteThread in interface org.xnio.conduits.SinkConduit
      • setWriteReadyHandler

        public void setWriteReadyHandler​(org.xnio.conduits.WriteReadyHandler handler)
        Specified by:
        setWriteReadyHandler in interface org.xnio.conduits.SinkConduit
      • truncateWrites

        public void truncateWrites()
                            throws IOException
        Specified by:
        truncateWrites in interface org.xnio.conduits.SinkConduit
        Throws:
        IOException
      • flush

        public boolean flush()
                      throws IOException
        Specified by:
        flush in interface org.xnio.conduits.SinkConduit
        Throws:
        IOException
      • getWorker

        public org.xnio.XnioWorker getWorker()
        Specified by:
        getWorker in interface org.xnio.conduits.Conduit
      • getIdleTimeout

        public long getIdleTimeout()
      • setIdleTimeout

        public void setIdleTimeout​(long idleTimeout)