public class Transmission
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Transmission.Status
Describes the status of a transmission in terms that can be
presented in the GUI.
|
Modifier and Type | Field and Description |
---|---|
private long |
doneTime_ |
private java.lang.Throwable |
error_ |
private javax.swing.event.ChangeEvent |
evt_ |
private java.util.List |
listenerList_ |
private static java.util.logging.Logger |
logger_ |
private Message |
msg_ |
private java.lang.String |
msgId_ |
private java.lang.String |
msgTag_ |
private Client |
receiver_ |
private boolean |
receiverUnreg_ |
private Response |
response_ |
private Client |
sender_ |
private boolean |
senderUnreg_ |
Constructor and Description |
---|
Transmission(Client sender,
Client receiver,
Message msg,
java.lang.String msgTag,
java.lang.String msgId)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener listener)
Adds a listener which will be notified if the state of this transmission
changes (if a response or failure is signalled).
|
private void |
fireChange()
Notifies listeners of a state change.
|
long |
getDoneTime()
Returns the epoch at which this transmission was completed.
|
java.lang.Throwable |
getError()
Returns a Throwable which prevented normal resolution of this
transmission.
|
Message |
getMessage()
Returns the message which was sent.
|
java.lang.String |
getMessageId()
Returns the message ID associated with this message.
|
java.lang.String |
getMessageTag()
Returns the message tag corresponding to this transmission.
|
Client |
getReceiver()
Returns the client to which this transmission was sent.
|
Response |
getResponse()
Returns the response for this transmission.
|
Client |
getSender()
Returns the client which sent this transmission.
|
Transmission.Status |
getStatus()
Returns an object which describes the current status of this
transmission in terms which can be presented to the GUI.
|
boolean |
isDone()
Indicates whether further changes to the state of this object
are expected, that is if a response/failure is yet to be received.
|
void |
removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a listener previously added by
addChangeListener(javax.swing.event.ChangeListener) . |
void |
setError(java.lang.Throwable error)
Associates an error with this transmission.
|
void |
setReceiverUnregistered()
Indicates that the receiver of this transmission has unregistered.
|
void |
setResponse(Response response)
Sets the response for this transmission.
|
void |
setSenderUnregistered()
Indicates that the sender of this transmission has unregistered.
|
private final Client sender_
private final Client receiver_
private final Message msg_
private final java.lang.String msgId_
private final java.lang.String msgTag_
private final java.util.List listenerList_
private final javax.swing.event.ChangeEvent evt_
private Response response_
private java.lang.Throwable error_
private boolean senderUnreg_
private boolean receiverUnreg_
private long doneTime_
private static final java.util.logging.Logger logger_
public Client getSender()
public Client getReceiver()
public Message getMessage()
public java.lang.String getMessageTag()
public java.lang.String getMessageId()
public void setResponse(Response response)
response
- responsepublic Response getResponse()
public void setError(java.lang.Throwable error)
error
- throwable causing the failurepublic java.lang.Throwable getError()
public void setSenderUnregistered()
public void setReceiverUnregistered()
public long getDoneTime()
isDone()
==false),
the returned value will be (way) in the future.System.currentTimeMillis()
at which
isDone()
first returned truepublic boolean isDone()
public Transmission.Status getStatus()
public void addChangeListener(javax.swing.event.ChangeListener listener)
ChangeEvent
s sent to these listeners
will have a source which is this Transmission.listener
- listener to addpublic void removeChangeListener(javax.swing.event.ChangeListener listener)
addChangeListener(javax.swing.event.ChangeListener)
.listener
- listener to removeprivate void fireChange()