Package com.yahoo.messagebus
Class Result
- java.lang.Object
-
- com.yahoo.messagebus.Result
-
public class Result extends java.lang.Object
Information on the outcome of initiating a send or forward on a session. The result will tell if the send/forward was accepted or not. If it was accepted, an (asynchroneous) reply is guaranteed to be delivered at some later time. If it was not accepted, a transient error has occured. In that case,
getError()
can be used to access the exact error.This class is immutable.
- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description Result(int code, java.lang.String message)
This constructor is a convencience function to allow simpler instantiation of a result that contains an error.Result(Error error)
This constructor assigns a given error to the member variable such that this result becomes unaccepted with a descriptive error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Error
getError()
The error resulting from this send/forward if the message was not accepted.boolean
isAccepted()
Returns whether this message was accepted.
-
-
-
Field Detail
-
ACCEPTED
public static final Result ACCEPTED
-
-
Constructor Detail
-
Result
public Result(Error error)
This constructor assigns a given error to the member variable such that this result becomes unaccepted with a descriptive error.- Parameters:
error
- The error to assign to this result.
-
Result
public Result(int code, java.lang.String message)
This constructor is a convencience function to allow simpler instantiation of a result that contains an error. It does nothing but proxy theResult(Error)
function with a new instance ofError
.- Parameters:
code
- The numerical code of the error.message
- The description of the error.
-
-
Method Detail
-
isAccepted
public boolean isAccepted()
Returns whether this message was accepted. If it was accepted, a Reply is guaranteed to be produced for this message at some later time. If it was not accepted, getError can be called to investigate why.- Returns:
- true if this message was accepted, false otherwise
-
getError
public Error getError()
The error resulting from this send/forward if the message was not accepted.- Returns:
- The error is not accepcted, null if accepted.
-
-