Package org.xnio.conduits
Class SynchronizedMessageSinkConduit
java.lang.Object
org.xnio.conduits.AbstractConduit<D>
org.xnio.conduits.AbstractSynchronizedConduit<D>
org.xnio.conduits.AbstractSynchronizedSinkConduit<MessageSinkConduit>
org.xnio.conduits.SynchronizedMessageSinkConduit
- All Implemented Interfaces:
Conduit,MessageSinkConduit,SinkConduit
public final class SynchronizedMessageSinkConduit
extends AbstractSynchronizedSinkConduit<MessageSinkConduit>
implements MessageSinkConduit
A synchronized message sink 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.SynchronizedMessageSinkConduit(MessageSinkConduit next, Object lock) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleansend(ByteBuffer src) Send a complete message.booleansend(ByteBuffer[] srcs, int offs, int len) Send a complete message.booleansendFinal(ByteBuffer src) Send a complete message.booleansendFinal(ByteBuffer[] srcs, int offs, int len) Send a complete message.Methods inherited from class org.xnio.conduits.AbstractSynchronizedSinkConduit
awaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, terminateWrites, truncateWrites, wakeupWritesMethods 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.SinkConduit
awaitWritable, awaitWritable, flush, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, terminateWrites, truncateWrites, wakeupWrites
-
Constructor Details
-
SynchronizedMessageSinkConduit
Construct a new instance. A new lock object is created.- Parameters:
next- the next conduit in the chain
-
SynchronizedMessageSinkConduit
Construct a new instance.- Parameters:
next- the next conduit in the chainlock- the lock object to use
-
-
Method Details
-
send
Description copied from interface:MessageSinkConduitSend a complete message.- Specified by:
sendin interfaceMessageSinkConduit- Parameters:
src- the message to send- Returns:
- the result of the send operation;
trueif the message was sent, orfalseif it would block - Throws:
IOException- if an I/O error occurs
-
send
Description copied from interface:MessageSinkConduitSend a complete message.- Specified by:
sendin interfaceMessageSinkConduit- Parameters:
srcs- the buffers holding the message to sendoffs- the offset into the buffer array of the first bufferlen- the number of buffers that contain data to send- Returns:
- the result of the send operation;
trueif the message was sent, orfalseif it would block - Throws:
IOException- if an I/O error occurs
-
sendFinal
Description copied from interface:MessageSinkConduitSend a complete message. If the message is successfully sent then the sink will have its writes terminated.- Specified by:
sendFinalin interfaceMessageSinkConduit- Parameters:
src- the message to send- Returns:
- the result of the send operation;
trueif the message was sent, orfalseif it would block - Throws:
IOException- if an I/O error occurs
-
sendFinal
Description copied from interface:MessageSinkConduitSend a complete message. If the message is successfully sent then the sink will have its writes terminated.- Specified by:
sendFinalin interfaceMessageSinkConduit- Parameters:
srcs- the buffers holding the message to sendoffs- the offset into the buffer array of the first bufferlen- the number of buffers that contain data to send- Returns:
- the result of the send operation;
trueif the message was sent, orfalseif it would block - Throws:
IOException- if an I/O error occurs
-