public class DefaultMessageFuture extends Object implements MessageFuture
MessageFuture
.MessageFuture.Result
Modifier and Type | Field and Description |
---|---|
protected Throwable |
cause |
protected OpenflowMessage |
reply |
protected OpenflowMessage |
request |
protected long |
xid |
Constructor and Description |
---|
DefaultMessageFuture(OpenflowMessage request)
Constructs a default message future for the given request.
|
Modifier and Type | Method and Description |
---|---|
MessageFuture |
await()
Waits for this future to be completed.
|
boolean |
await(long timeoutMs)
Waits for this future to be completed within the specified time limit.
|
MessageFuture |
awaitUninterruptibly()
Waits for this future to be completed without interruption.
|
boolean |
awaitUninterruptibly(long timeoutMs)
Waits for this future to be completed within the specified time limit
without interruption.
|
Throwable |
cause()
Returns the cause of failure if an exception was thrown.
|
String |
problemString()
Returns a string description of the problem if there was one.
|
OpenflowMessage |
reply()
Returns the reply resulting from the asynchronous request.
|
OpenflowMessage |
request()
Returns the original request message.
|
MessageFuture.Result |
result()
Returns the future's result.
|
protected void |
satisfied()
Invoked when the future is satisfied.
|
boolean |
setFailure(OfmError error)
Marks this future as a failure, attaching the specified error response
message, and notifies all listeners.
|
boolean |
setFailure(Throwable cause)
Marks this future as a failure, caused by the specified exception,
and notifies all listeners.
|
boolean |
setFailureTimeout()
Marks this future as a failure, caused by a timeout, and notifies all
listeners.
|
boolean |
setSuccess()
Marks this future as a success (with no expected reply) and notifies
all listeners.
|
boolean |
setSuccess(OpenflowMessage msg)
Marks this future as a success, attaching the specified reply message,
and notifies all listeners.
|
String |
toString() |
long |
xid()
Returns the xid (message sequence number) associated with this future.
|
protected final OpenflowMessage request
protected final long xid
protected OpenflowMessage reply
protected Throwable cause
public DefaultMessageFuture(OpenflowMessage request)
request
- the out-bound request associated with this futureIllegalArgumentException
- if the xid is 0 or negativepublic long xid()
MessageFuture
xid
in interface MessageFuture
public OpenflowMessage request()
MessageFuture
request
in interface MessageFuture
public OpenflowMessage reply()
MessageFuture
OfmError
message.
This will be null if the future has not yet been satisfied.
reply
in interface MessageFuture
public String problemString()
MessageFuture
OfmError
reply from
the switch, or the exception thrown (if the send failed), if the future
was satisfied as a failure; otherwise it will be the string
"(none)"
.problemString
in interface MessageFuture
public Throwable cause()
MessageFuture
cause
in interface MessageFuture
public MessageFuture.Result result()
MessageFuture
result
in interface MessageFuture
protected void satisfied()
public boolean setSuccess()
MessageFuture
true
is returned if this future is successfully
marked as a success; false
is returned if this future was
already marked as either success or failure.setSuccess
in interface MessageFuture
true
if successfully marked as a success;
false
otherwisepublic boolean setSuccess(OpenflowMessage msg)
MessageFuture
true
is returned if this future is
successfully marked as a success; false
is returned if this
future was already marked as either success or failure.setSuccess
in interface MessageFuture
msg
- the OpenFlow message reply to the original requesttrue
if successfully marked as a success;
false
otherwisepublic boolean setFailure(OfmError error)
MessageFuture
true
is returned if this
future is successfully marked as a failure; false
is returned
if this future was already marked as either success or failure.setFailure
in interface MessageFuture
error
- the OpenFlow error message resulting from the original
requesttrue
if successfully marked as a failure;
false
otherwisepublic boolean setFailure(Throwable cause)
MessageFuture
true
is returned if this future is
successfully marked as a failure; false
is returned if this
future was already marked as either success or failure.setFailure
in interface MessageFuture
cause
- the cause of the failuretrue
if successfully marked as a failure;
false
otherwisepublic boolean setFailureTimeout()
MessageFuture
true
is returned if this future is successfully
marked as a failure; false
is returned if this future was
already marked as either success or failure.setFailureTimeout
in interface MessageFuture
true
if successfully marked as a failure;
false
otherwisepublic MessageFuture await() throws InterruptedException
MessageFuture
await
in interface MessageFuture
InterruptedException
- if the current thread was interruptedpublic MessageFuture awaitUninterruptibly()
MessageFuture
InterruptedException
s and discards them silently.awaitUninterruptibly
in interface MessageFuture
public boolean await(long timeoutMs) throws InterruptedException
MessageFuture
true
is returned
if the future was satisfied within the time limit; false
is
returned if the timeout expired.await
in interface MessageFuture
timeoutMs
- timeout expressed in millisecondstrue
if the future was completed within the specified
time limit; false
otherwiseInterruptedException
- if the current thread was interruptedpublic boolean awaitUninterruptibly(long timeoutMs)
MessageFuture
true
is returned if the future was satisfied within the time
limit; false
is returned if the timeout expired. This method
catches InterruptedException
s and discards them silently.awaitUninterruptibly
in interface MessageFuture
timeoutMs
- timeout expressed in millisecondstrue
if the future was completed within the specified
time limit; false
otherwiseCopyright © 2015. All Rights Reserved.