public class QueueIntChannel extends QueuePrimitiveChannel<java.lang.Integer> implements IntChannel
ReceivePort.EOFExceptionRECORDER| Constructor and Description |
|---|
QueueIntChannel(BasicSingleConsumerIntQueue queue,
Channels.OverflowPolicy policy) |
| Modifier and Type | Method and Description |
|---|---|
protected BasicSingleConsumerIntQueue |
queue() |
int |
receiveInt()
Retrieves a message from the channels, possibly blocking until one becomes available.
|
int |
receiveInt(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.
|
int |
receiveInt(Timeout timeout)
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.
|
void |
send(int message)
Sends a message to the channel, possibly blocking until there's room available in the channel.
|
boolean |
send(int 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(int 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(int 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 QueueIntChannel(BasicSingleConsumerIntQueue queue, Channels.OverflowPolicy policy)
public int receiveInt()
throws SuspendExecution,
java.lang.InterruptedException,
ReceivePort.EOFException
IntReceivePortReceivePort.EOFException.receiveInt in interface IntReceivePortjava.lang.InterruptedExceptionReceivePort.EOFException - if the channel has been closed and no more messages awaitSuspendExecutionpublic int receiveInt(long timeout,
java.util.concurrent.TimeUnit unit)
throws SuspendExecution,
java.lang.InterruptedException,
java.util.concurrent.TimeoutException,
ReceivePort.EOFException
IntReceivePortReceivePort.EOFException.receiveInt in interface IntReceivePorttimeout - 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 int receiveInt(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException, java.util.concurrent.TimeoutException, ReceivePort.EOFException
IntReceivePortReceivePort.EOFException.receiveInt in interface IntReceivePorttimeout - 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(int message)
IntSendPorttrySend in interface IntSendPorttrue if the message has been sent; false otherwise.public void send(int message)
throws SuspendExecution,
java.lang.InterruptedException
IntSendPortOverflowPolicy, set at construction time.send in interface IntSendPortSuspendExecutionjava.lang.InterruptedExceptionpublic boolean send(int message,
long timeout,
java.util.concurrent.TimeUnit unit)
throws SuspendExecution,
java.lang.InterruptedException
IntSendPortOverflowPolicy, set at construction time.send in interface IntSendPorttimeout - 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(int message,
Timeout timeout)
throws SuspendExecution,
java.lang.InterruptedException
IntSendPortOverflowPolicy, set at construction time.send in interface IntSendPorttimeout - 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 BasicSingleConsumerIntQueue queue()
queue in class QueuePrimitiveChannel<java.lang.Integer>