Interface ResultAccessor<RES,EXC extends Exception>

Type Parameters:
RES - The type of the result to be used.
EXC - The exception thrown in case no result is available. Use RuntimeException to prevent forcing a try/catch block.
All Known Subinterfaces:
ResultAccessor.ResultProperty<RES,EXC>

public interface ResultAccessor<RES,EXC extends Exception>
Provides access to a result property for e.g. key / result pair.
  • Method Details

    • getResult

      RES getResult() throws EXC
      Retrieves the result from the result property. This method may block or throw an exception in case there is none such result. Use hasResult() to test beforehand whether we already have a result.
      Returns:
      The result stored by the result property.
      Throws:
      EXC - Thrown in case an exception occurred instead of the expected result.
    • hasResult

      boolean hasResult()
      Tests whether there is already result. This method is special as it must not use getResult() to test whether there is a result as getResult() may block till we have a result or throw an exception in case there is none such result.
      Returns:
      True in case there is a HTTP-Response, else false.
    • waitForResult

      default void waitForResult()
      Waits for the result. This method may block in case there is none such result or an exception has been thrown. Use hasResult() to test beforehand whether we already have a result. The default implementation just calls getResult() (ignoring the return value or any thrown exception), depending on the actual implementation, this method should be overridden in case calling getResult() causes resource overhead or doesn't block.