Interface RequestHandler

All Known Implementing Classes:
MessageDispatcher, MessageDispatcherSpeedTest, RpcDispatcher

public interface RequestHandler
  • Method Summary

    Modifier and Type
    Method
    Description
    Processes a request synchronously, ie.
    default void
    handle(Message request, Response response)
    Processes a request asynchronously.
  • Method Details

    • handle

      Object handle(Message msg) throws Exception
      Processes a request synchronously, ie. on the thread invoking this handler
      Parameters:
      msg - the message containing the request
      Returns:
      the object, rceeived as result, or null (void method)
      Throws:
      Exception
    • handle

      default void handle(Message request, Response response) throws Exception
      Processes a request asynchronously. This could be done (for example) by dispatching this to a thread pool. When done, if a response is needed (e.g. in case of a sync RPC), Response.send(Object,boolean) should be called.
      Parameters:
      request - The request
      response - The response implementation. Contains information needed to send the reply (e.g. a request ID). If no response is required, e.g. because this is an asynchronous RPC, then response will be null.
      Throws:
      Exception - If an exception is thrown (e.g. in case of an issue submitting the request to a thread pool, the exception will be taken as return value and will be sent as a response. In this case, Response.send(Object,boolean) must not be called