Interface IRequest

All Known Subinterfaces:
IDebugCommandRequest, IEnabledStateRequest

public interface IRequest
Common base interface for an asynchronously processed request. A request may succeed, fail or be canceled as indicated by the request's status. When a request is complete the client fulfilling the request must call done() on the request whether the operation succeeds, fails, or is canceled.

Specific requests (sub types of this interface) often include data pertaining to the request and usually contain results of the request.

Clients are expected to poll a request (using isCanceled) periodically and abort at their earliest convenience calling done(). A request can be canceled by the originator of the request or a client fulfilling a request.

Clients that invoke request handlers may implement this interface.

Since:
3.3
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cancels this request.
    void
    Indicates this request is complete.
    Returns the status of this request, or null.
    boolean
    Returns whether this request has been canceled.
    void
    Sets the status for this request indicating whether this request succeeded, failed, or was canceled.
  • Method Details

    • setStatus

      void setStatus(IStatus status)
      Sets the status for this request indicating whether this request succeeded, failed, or was canceled. When a request fails, the status indicates why the request failed. A null status is considered to be successful. Only clients fulfilling a request should call this method. Clients making a request are not intended to call this method.
      Parameters:
      status - request status or null
    • getStatus

      IStatus getStatus()
      Returns the status of this request, or null.
      Returns:
      request status - null is equivalent to an OK status
    • done

      void done()
      Indicates this request is complete. Clients must call this method whether the request succeeds, fails, or is cancelled to indicate that processing is complete. Only clients fulfilling a request should call this method. Clients making a request are not intended to call this method.
    • cancel

      void cancel()
      Cancels this request. A request may be canceled by the originator of request or a client fulfilling a request. Optionally a canceled status may be set on this request with more details. A client fulfilling a request must still call done() to indicate the request is complete.
    • isCanceled

      boolean isCanceled()
      Returns whether this request has been canceled.

      Clients fulfilling a request are expected to poll a request (using isCanceled) periodically and abort at their earliest convenience calling done(). A request can be canceled by the originator of the request or a processor fulfilling a request.

      Returns:
      whether this request has been canceled