Package convex.net

Class ResultConsumer

java.lang.Object
convex.net.ResultConsumer
All Implemented Interfaces:
Consumer<Message>

public abstract class ResultConsumer extends Object implements Consumer<Message>
Consumer abstract base class for awaiting results. Provides basic buffering of: - Missing data until all data is available.
  • Constructor Details

    • ResultConsumer

      public ResultConsumer()
  • Method Details

    • accept

      public void accept(Message m)
      Specified by:
      accept in interface Consumer<Message>
    • handleResult

      protected void handleResult(long id, Result result)
      Handler for a fully received Result. May be overridden.
      Parameters:
      id - ID of message received
      result - Result value
    • handleError

      protected void handleError(long id, ACell code, ACell errorMessage)
      Method called when an error result is received. May be overriden. Default behaviour is simply to log the error. If this method throws a MissingDataException, missing data is requested and the result handling may be retried later.
      Parameters:
      id - The ID of the original message to which this result corresponds
      code - The error code received. May not be null, and is usually a Keyword
      errorMessage - The error message associated with the result (may be null)
    • handleNormalResult

      protected void handleNormalResult(long id, ACell value)
      Method called when a normal (non-error) result is received. If this method throws a MissingDataException, missing data is requested and the result handling may be retried later.
      Parameters:
      id - The ID of the original message to which this result corresponds
      value - The result value