Class Result

java.lang.Object
com.yahoo.documentapi.Result

public class Result extends Object
The synchronous result of submitting an asynchronous operation. A result is either a success or not. If it is not a success, it will contain an explanation of why. Document repositories may return subclasses which contain more information.
Author:
bratseth
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The types that a Result can have.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a successful result with requestId zero
    Result(long requestId)
    Creates a successful result
    Result(Result.ResultType type, com.yahoo.messagebus.Error error)
    Creates a unsuccessful result
    Deprecated, for removal: This API element is subject to removal in a future version.
    Will be removed on Vespa 8 due to incorrect java.lang.Error
  • Method Summary

    Modifier and Type
    Method
    Description
    com.yahoo.messagebus.Error
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    Will be removed on Vespa 8
    long
    Returns the id of this operation.
    boolean
    Returns whether this operation is a success.
    static com.yahoo.messagebus.Error
     
    Returns the type of result.

    Methods inherited from class java.lang.Object

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

    • Result

      public Result()
      Creates a successful result with requestId zero
    • Result

      public Result(long requestId)
      Creates a successful result
      Parameters:
      requestId - the ID of the request
    • Result

      @Deprecated(forRemoval=true, since="7") public Result(Result.ResultType type, Error error)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will be removed on Vespa 8 due to incorrect java.lang.Error
      Creates a unsuccessful result
    • Result

      public Result(Result.ResultType type, com.yahoo.messagebus.Error error)
      Creates a unsuccessful result
      Parameters:
      type - the type of failure
      error - the error to encapsulate in this Result
      See Also:
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns whether this operation is a success. If it is a success, the operation is accepted and one or more responses are guaranteed to arrive within this sessions timeout limit. If this is not a success, this operation has no further consequences.
      Returns:
      true if success
    • getError

      @Deprecated(forRemoval=true, since="7") public Error getError()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Will be removed on Vespa 8
      Returns the error causes by this. If this was not a success, this method always returns an error If this was a success, this method returns null.
      Returns:
      the Error, or null
    • error

      public com.yahoo.messagebus.Error error()
    • getRequestId

      public long getRequestId()
      Returns the id of this operation. The asynchronous response to this operation will contain the same id to allow clients who desire to, to match operations to responses.
      Returns:
      the id of this operation
    • type

      public Result.ResultType type()
      Returns the type of result.
      Returns:
      the type of result, typically if this is an error or a success, and what kind of error.
      See Also:
    • toError

      public static com.yahoo.messagebus.Error toError(Result.ResultType result)