Package org.xnio.conduits
Class SynchronizedMessageSourceConduit
java.lang.Object
org.xnio.conduits.AbstractConduit<D>
org.xnio.conduits.AbstractSynchronizedConduit<D>
org.xnio.conduits.AbstractSynchronizedSourceConduit<MessageSourceConduit>
org.xnio.conduits.SynchronizedMessageSourceConduit
- All Implemented Interfaces:
Conduit,MessageSourceConduit,SourceConduit
public final class SynchronizedMessageSourceConduit
extends AbstractSynchronizedSourceConduit<MessageSourceConduit>
implements MessageSourceConduit
A synchronized message source conduit. All conduit operations are wrapped in synchronization blocks for simplified
thread safety.
- Author:
- David M. Lloyd
-
Field Summary
Fields inherited from class org.xnio.conduits.AbstractSynchronizedConduit
lockFields inherited from class org.xnio.conduits.AbstractConduit
next -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionintreceive(ByteBuffer dst) Receive a message.longreceive(ByteBuffer[] dsts, int offs, int len) Receive a message.Methods inherited from class org.xnio.conduits.AbstractSynchronizedSourceConduit
awaitReadable, awaitReadable, getReadThread, isReadResumed, isReadShutdown, resumeReads, setReadReadyHandler, suspendReads, terminateReads, wakeupReadsMethods inherited from class org.xnio.conduits.AbstractConduit
getWorkerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xnio.conduits.SourceConduit
awaitReadable, awaitReadable, getReadThread, isReadResumed, isReadShutdown, resumeReads, setReadReadyHandler, suspendReads, terminateReads, wakeupReads
-
Constructor Details
-
SynchronizedMessageSourceConduit
Construct a new instance. A new lock object is created.- Parameters:
next- the next conduit in the chain
-
SynchronizedMessageSourceConduit
Construct a new instance.- Parameters:
next- the next conduit in the chainlock- the lock object to use
-
-
Method Details
-
receive
Description copied from interface:MessageSourceConduitReceive a message.- Specified by:
receivein interfaceMessageSourceConduit- Returns:
- the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition
- Throws:
IOException- if an I/O error occurs
-
receive
Description copied from interface:MessageSourceConduitReceive a message.- Specified by:
receivein interfaceMessageSourceConduitoffs- the offset into the array of buffers of the first buffer to read intolen- the number of buffers to fill- Returns:
- the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition
- Throws:
IOException- if an I/O error occurs
-