Interface IntReceivePort
-
- All Superinterfaces:
java.lang.AutoCloseable,Port<java.lang.Integer>,PortAutoCloseable,ReceivePort<java.lang.Integer>
- All Known Subinterfaces:
IntChannel
- All Known Implementing Classes:
QueueIntChannel
public interface IntReceivePort extends ReceivePort<java.lang.Integer>
A primitiveintchannel's consumer-side interface. All methods of this interface must only be called by the channel's owner.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface co.paralleluniverse.strands.channels.ReceivePort
ReceivePort.EOFException
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhasMessage()Tests whether a value is pending in the channel.intreceiveInt()Retrieves a message from the channels, possibly blocking until one becomes available.intreceiveInt(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.intreceiveInt(Timeout timeout)Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout.-
Methods inherited from interface co.paralleluniverse.strands.channels.PortAutoCloseable
close, isClosed
-
Methods inherited from interface co.paralleluniverse.strands.channels.ReceivePort
receive, receive, receive, tryReceive
-
-
-
-
Method Detail
-
receiveInt
int receiveInt() throws SuspendExecution, java.lang.InterruptedException, ReceivePort.EOFExceptionRetrieves a message from the channels, possibly blocking until one becomes available. If the channel has been closed and no more messages await, this method throws anReceivePort.EOFException.- Returns:
- a message.
- Throws:
ReceivePort.EOFException- if the channel has been closed and no more messages awaitjava.lang.InterruptedExceptionSuspendExecution
-
receiveInt
int receiveInt(long timeout, java.util.concurrent.TimeUnit unit) throws SuspendExecution, java.lang.InterruptedException, java.util.concurrent.TimeoutException, ReceivePort.EOFExceptionRetrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout. If the channel has been closed and no more messages await, this method throws anReceivePort.EOFException.- Parameters:
timeout- the maximum duration to block waiting for a message.unit- the time unit of the timeout.- Returns:
- a message. (see
PortAutoCloseable.isClosed()), or if the timeout has expired. - Throws:
java.util.concurrent.TimeoutException- if the timeout has expiredReceivePort.EOFException- if the channel has been closed and no more messages awaitjava.lang.InterruptedExceptionSuspendExecution
-
receiveInt
int receiveInt(Timeout timeout) throws SuspendExecution, java.lang.InterruptedException, java.util.concurrent.TimeoutException, ReceivePort.EOFException
Retrieves a message from the channels, possibly blocking until one becomes available, but no longer than the specified timeout. If the channel has been closed and no more messages await, this method throws anReceivePort.EOFException.- Parameters:
timeout- the method will not block for longer than the amount remaining in theTimeout- Returns:
- a message. (see
PortAutoCloseable.isClosed()), or if the timeout has expired. - Throws:
java.util.concurrent.TimeoutException- if the timeout has expiredReceivePort.EOFException- if the channel has been closed and no more messages awaitjava.lang.InterruptedExceptionSuspendExecution
-
hasMessage
boolean hasMessage()
Tests whether a value is pending in the channel. If it is, the next call toreceiveDoubleis guaranteed not to block.- Returns:
trueif a value is waiting in the channel;falseotherwise.
-
-