public class SingleConsumerQueueChannel<Message> extends QueueChannel<Message> implements Stranded
ReceivePort.EOFExceptionRECORDER| Constructor and Description |
|---|
SingleConsumerQueueChannel(SingleConsumerQueue<Message> queue,
Channels.OverflowPolicy policy) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkClosed() |
java.lang.Object |
getOwner() |
Strand |
getStrand() |
boolean |
isOwnerAlive() |
protected void |
maybeSetCurrentStrandAsOwner() |
protected SingleConsumerQueue<Message> |
queue() |
Message |
receive()
Retrieves a message from the channels, possibly blocking until one becomes available.
|
Message |
receive(long timeout,
java.util.concurrent.TimeUnit unit)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
void |
setStrand(Strand strand) |
java.lang.String |
toString() |
Message |
tryReceive()
Retrieves a message from the channel if one is available.
|
capacity, close, close, equals, getCloseException, getOverflowPolicy, getQueueLength, isClosed, isSingleConsumer, isSingleProducer, receive, receiveFromThread, receiveFromThread, register, register, send, send, send, send0, sendNonSuspendable, sendSync, signalAndWait, signalReceivers, sync, tryNow, trySend, unregister, writeReplacepublic SingleConsumerQueueChannel(SingleConsumerQueue<Message> queue, Channels.OverflowPolicy policy)
public java.lang.Object getOwner()
public boolean isOwnerAlive()
protected void maybeSetCurrentStrandAsOwner()
protected void checkClosed()
throws ReceivePort.EOFException
ReceivePort.EOFExceptionpublic Message tryReceive()
ReceivePorttryReceive in interface ReceivePort<Message>tryReceive in class QueueChannel<Message>null if one is not immediately available.public Message receive() throws SuspendExecution, java.lang.InterruptedException
ReceivePortreceive in interface ReceivePort<Message>receive in class QueueChannel<Message>null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()).java.lang.InterruptedExceptionSuspendExecutionpublic Message receive(long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException
ReceivePortreceive in interface ReceivePort<Message>receive in class QueueChannel<Message>timeout - the maximum duration to block waiting for a message.unit - the time unit of the timeout.null if the channel has been closed and no more messages await (see PortAutoCloseable.isClosed()), or if the timeout has expired.java.lang.InterruptedExceptionSuspendExecutionprotected SingleConsumerQueue<Message> queue()
public java.lang.String toString()
toString in class QueueChannel<Message>