Class Result

java.lang.Object
com.yahoo.messagebus.Result

public class Result extends 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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Result
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Result(int code, 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

    Modifier and Type
    Method
    Description
    The error resulting from this send/forward if the message was not accepted.
    boolean
    Returns whether this message was accepted.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ACCEPTED

      public static final Result ACCEPTED
  • Constructor Details

    • 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, String message)
      This constructor is a convencience function to allow simpler instantiation of a result that contains an error. It does nothing but proxy the Result(Error) function with a new instance of Error.
      Parameters:
      code - The numerical code of the error.
      message - The description of the error.
  • Method Details

    • 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.