public class QueueLongChannel extends QueuePrimitiveChannel<java.lang.Long> implements LongChannel
ReceivePort.EOFExceptionRECORDER| Constructor and Description |
|---|
QueueLongChannel(BasicSingleConsumerLongQueue queue,
Channels.OverflowPolicy policy) |
| Modifier and Type | Method and Description |
|---|---|
protected BasicSingleConsumerLongQueue |
queue() |
long |
receiveLong()
Retrieves a message from the channels, possibly blocking until one becomes available.
|
long |
receiveLong(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.
|
long |
receiveLong(Timeout timeout)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
void |
send(long message)
Sends a message to the channel, possibly blocking until there's room available in the channel.
|
boolean |
send(long message,
long timeout,
java.util.concurrent.TimeUnit unit)
Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the
specified timeout.
|
boolean |
send(long message,
Timeout timeout)
Sends a message to the channel, possibly blocking until there's room available in the channel, but never longer than the
specified timeout.
|
boolean |
trySend(long message)
Sends a message to the channel if the channel has room available.
|
checkClosed, getStrand, hasMessage, maybeSetCurrentStrandAsOwner, setStrandcapacity, close, close, equals, getCloseException, getOverflowPolicy, getQueueLength, isClosed, isSingleConsumer, isSingleProducer, receive, receive, receive, receiveFromThread, receiveFromThread, register, register, send, send, send, send0, sendNonSuspendable, sendSync, signalAndWait, signalReceivers, sync, toString, tryNow, tryReceive, trySend, unregister, writeReplaceclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, send, send, send, trySendhasMessagereceive, receive, receive, tryReceiveclose, isClosedpublic QueueLongChannel(BasicSingleConsumerLongQueue queue, Channels.OverflowPolicy policy)
public long receiveLong()
throws SuspendExecution,
java.lang.InterruptedException,
ReceivePort.EOFException
LongReceivePortReceivePort.EOFException.receiveLong in interface LongReceivePortjava.lang.InterruptedExceptionReceivePort.EOFException - if the channel has been closed and no more messages awaitSuspendExecutionpublic long receiveLong(long timeout,
java.util.concurrent.TimeUnit unit)
throws SuspendExecution,
java.lang.InterruptedException,
java.util.concurrent.TimeoutException,
ReceivePort.EOFException
LongReceivePortReceivePort.EOFException.receiveLong in interface LongReceivePorttimeout - the maximum duration to block waiting for a message.unit - the time unit of the timeout.PortAutoCloseable.isClosed()), or if the timeout has expired.java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException - if the timeout has expiredReceivePort.EOFException - if the channel has been closed and no more messages awaitSuspendExecutionpublic long receiveLong(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException, java.util.concurrent.TimeoutException, ReceivePort.EOFException
LongReceivePortReceivePort.EOFException.receiveLong in interface LongReceivePorttimeout - the method will not block for longer than the amount remaining in the TimeoutPortAutoCloseable.isClosed()), or if the timeout has expired.java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException - if the timeout has expiredReceivePort.EOFException - if the channel has been closed and no more messages awaitSuspendExecutionpublic boolean trySend(long message)
LongSendPorttrySend in interface LongSendPorttrue if the message has been sent; false otherwise.public void send(long message)
throws SuspendExecution,
java.lang.InterruptedException
LongSendPortOverflowPolicy, set at construction time.send in interface LongSendPortSuspendExecutionjava.lang.InterruptedExceptionpublic boolean send(long message,
long timeout,
java.util.concurrent.TimeUnit unit)
throws SuspendExecution,
java.lang.InterruptedException
LongSendPortOverflowPolicy, set at construction time.send in interface LongSendPorttimeout - the maximum duration this method is allowed to wait.unit - the timeout's time unittrue if the message has been sent successfully; false if the timeout has expired.SuspendExecutionjava.lang.InterruptedExceptionpublic boolean send(long message,
Timeout timeout)
throws SuspendExecution,
java.lang.InterruptedException
LongSendPortOverflowPolicy, set at construction time.send in interface LongSendPorttimeout - the method will not block for longer than the amount remaining in the Timeouttrue if the message has been sent successfully; false if the timeout has expired.SuspendExecutionjava.lang.InterruptedExceptionprotected BasicSingleConsumerLongQueue queue()
queue in class QueuePrimitiveChannel<java.lang.Long>