public class ThreadSendPort<Message>
extends java.lang.Object
SendPort that can be used by threads (as opposed to fibers). Its methods do not
declare they throw SuspendExecution.| Constructor and Description |
|---|
ThreadSendPort(SendPort<Message> p)
Creates a new convenience wrapper for using a
SendPort in a thread. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the channel so that no more messages could be sent to it.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
void |
send(Message message)
Sends a message to the channel, possibly blocking until there's room available in the channel.
|
boolean |
send(Message 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.
|
java.lang.String |
toString() |
boolean |
trySend(Message message)
Sends a message to the channel if the channel has room available.
|
public void send(Message message) throws java.lang.InterruptedException
OverflowPolicy, set at construction time.message - SuspendExecutionjava.lang.InterruptedExceptionpublic boolean send(Message message, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
OverflowPolicy, set at construction time.message - timeout - 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 trySend(Message message)
message - true if the message has been sent; false otherwise.public void close()
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Object