Top Description Constructors Methods
org.xnio.conduits

public final Class SynchronizedMessageSourceConduit

extends AbstractSynchronizedSourceConduit<MessageSourceConduit>
implements MessageSourceConduit
Class Inheritance
All Implemented Interfaces
org.xnio.conduits.MessageSourceConduit, org.xnio.conduits.SourceConduit, org.xnio.conduits.Conduit
Imports
java.io.IOException, java.nio.ByteBuffer

A synchronized message source conduit. All conduit operations are wrapped in synchronization blocks for simplified thread safety.
Author
David M. Lloyd

Constructor Summary

AccessConstructor and Description
public
SynchronizedMessageSourceConduit(final MessageSourceConduit
the next conduit in the chain
next
)

Construct a new instance.

public
SynchronizedMessageSourceConduit(final MessageSourceConduit
the next conduit in the chain
next
,
final Object
the lock object to use
lock
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public int
receive(final ByteBuffer
the buffer that will hold the message
dst
)

Implements org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

public long
receive(final ByteBuffer[]
the buffers that will hold the message
dsts
,
final int
the offset into the array of buffers of the first buffer to read into
offs
,
final int
the number of buffers to fill
len
)

Implements org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

Inherited from org.xnio.conduits.AbstractSynchronizedSourceConduit:
awaitReadableawaitReadablegetReadThreadisReadResumedisReadShutdownresumeReadssetReadReadyHandlersuspendReadsterminateReadswakeupReads

Constructor Detail

SynchronizedMessageSourceConduitback to summary
public SynchronizedMessageSourceConduit(final MessageSourceConduit next)

Construct a new instance. A new lock object is created.

Parameters
next:MessageSourceConduit

the next conduit in the chain

SynchronizedMessageSourceConduitback to summary
public SynchronizedMessageSourceConduit(final MessageSourceConduit next, final Object lock)

Construct a new instance.

Parameters
next:MessageSourceConduit

the next conduit in the chain

lock:Object

the lock object to use

Method Detail

receiveback to summary
public int receive(final ByteBuffer dst) throws IOException

Implements org.xnio.conduits.MessageSourceConduit.receive.

Doc from org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

Parameters
dst:ByteBuffer

the buffer that will hold the message

Returns:int

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

Exceptions
IOException:
if an I/O error occurs
receiveback to summary
public long receive(final ByteBuffer[] dsts, final int offs, final int len) throws IOException

Implements org.xnio.conduits.MessageSourceConduit.receive.

Doc from org.xnio.conduits.MessageSourceConduit.receive.

Receive a message.

Parameters
dsts:ByteBuffer[]

the buffers that will hold the message

offs:int

the offset into the array of buffers of the first buffer to read into

len:int

the number of buffers to fill

Returns:long

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

Exceptions
IOException:
if an I/O error occurs