public class Transmission
extends java.lang.Object
MendelMessage
).
Apart from managing the data associated with a network transmission, this
class also acts like a Future: the finish() method will cause the calling
thread to block until the transmission has been completed (either
successfully or unsuccessfully). This allows transmissions to be carried out
asynchronously, but gives clients a means to ensure the transmission
finished. This class also allows clients to retrieve Exceptions that may
have occurred while sending the message.Modifier | Constructor and Description |
---|---|
protected |
Transmission(java.nio.ByteBuffer payload) |
Modifier and Type | Method and Description |
---|---|
protected void |
addException(java.lang.Exception e)
Associates an Exception with this Tranmission to indicate errors or
other information specific to the Tranmission.
|
boolean |
finish()
Causes the calling thread to wait until this transmission has completed.
|
java.util.Queue<java.lang.Exception> |
getExceptions() |
protected java.nio.ByteBuffer |
getPayload() |
boolean |
hasException() |
protected void |
setFinished()
Updates the status of this transmission to completed and notifies any
waiting threads.
|
protected java.nio.ByteBuffer getPayload()
public boolean finish() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void setFinished()
protected void addException(java.lang.Exception e)
public boolean hasException()
public java.util.Queue<java.lang.Exception> getExceptions()