- java.lang.Object
-
- org.xnio.conduits.AbstractConduit<D>
-
- org.xnio.conduits.AbstractSourceConduit<D>
-
- All Implemented Interfaces:
Conduit,SourceConduit
- Direct Known Subclasses:
AbstractMessageSourceConduit,AbstractStreamSourceConduit,FramingMessageSourceConduit,MessageStreamSourceConduit
public abstract class AbstractSourceConduit<D extends SourceConduit> extends AbstractConduit<D> implements SourceConduit
An abstract base class for filtering source conduits.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from class org.xnio.conduits.AbstractConduit
next
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSourceConduit(D next)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitReadable()Block until this channel becomes readable again.voidawaitReadable(long time, java.util.concurrent.TimeUnit timeUnit)Block until this conduit becomes readable again, or until the timeout expires.XnioIoThreadgetReadThread()Get the XNIO read thread.booleanisReadResumed()Determine whether read notifications are currently enabled.booleanisReadShutdown()Determine whether reads have been shut down on this conduit.voidresumeReads()Indicate that the conduit'sReadReadyHandlershould be invoked as soon as data can be read without blocking.voidsetReadReadyHandler(ReadReadyHandler handler)Set the handler which should receive readiness notifications.voidsuspendReads()Indicate that calling the conduit'sReadReadyHandlershould be suspended.voidterminateReads()Indicate that no more data will be read from this conduit.voidwakeupReads()Indicate that the conduit'sReadReadyHandlershould be invoked immediately, and then again as soon as data can be read without blocking.-
Methods inherited from class org.xnio.conduits.AbstractConduit
getWorker
-
-
-
-
Constructor Detail
-
AbstractSourceConduit
protected AbstractSourceConduit(D next)
Construct a new instance.- Parameters:
next- the delegate conduit to set
-
-
Method Detail
-
terminateReads
public void terminateReads() throws java.io.IOExceptionDescription copied from interface:SourceConduitIndicate that no more data will be read from this conduit. If unread data exists, an exception may be thrown.- Specified by:
terminateReadsin interfaceSourceConduit- Throws:
java.io.IOException- if there was a problem
-
isReadShutdown
public boolean isReadShutdown()
Description copied from interface:SourceConduitDetermine whether reads have been shut down on this conduit.- Specified by:
isReadShutdownin interfaceSourceConduit- Returns:
trueif writes are shut down,falseotherwise
-
resumeReads
public void resumeReads()
Description copied from interface:SourceConduitIndicate that the conduit'sReadReadyHandlershould be invoked as soon as data can be read without blocking.- Specified by:
resumeReadsin interfaceSourceConduit
-
suspendReads
public void suspendReads()
Description copied from interface:SourceConduitIndicate that calling the conduit'sReadReadyHandlershould be suspended.- Specified by:
suspendReadsin interfaceSourceConduit
-
wakeupReads
public void wakeupReads()
Description copied from interface:SourceConduitIndicate that the conduit'sReadReadyHandlershould be invoked immediately, and then again as soon as data can be read without blocking.- Specified by:
wakeupReadsin interfaceSourceConduit
-
isReadResumed
public boolean isReadResumed()
Description copied from interface:SourceConduitDetermine whether read notifications are currently enabled.- Specified by:
isReadResumedin interfaceSourceConduit- Returns:
trueif read notifications are enabled
-
awaitReadable
public void awaitReadable() throws java.io.IOExceptionDescription copied from interface:SourceConduitBlock until this channel becomes readable again. This method may return spuriously before the channel becomes readable.- Specified by:
awaitReadablein interfaceSourceConduit- Throws:
java.io.InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException- if an I/O error occurs
-
awaitReadable
public void awaitReadable(long time, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOExceptionDescription copied from interface:SourceConduitBlock until this conduit becomes readable again, or until the timeout expires. This method may return spuriously before the conduit becomes readable or the timeout expires.- Specified by:
awaitReadablein interfaceSourceConduit- Parameters:
time- the time to waittimeUnit- the time unit- Throws:
java.io.InterruptedIOException- if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException- if an I/O error occurs
-
getReadThread
public XnioIoThread getReadThread()
Description copied from interface:SourceConduitGet the XNIO read thread.- Specified by:
getReadThreadin interfaceSourceConduit- Returns:
- the XNIO read thread
-
setReadReadyHandler
public void setReadReadyHandler(ReadReadyHandler handler)
Description copied from interface:SourceConduitSet the handler which should receive readiness notifications. A filter may pass this invocation on to the filter it wraps, or it may substitute itself.- Specified by:
setReadReadyHandlerin interfaceSourceConduit
-
-