All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.blocks.RequestHandler Maven / Gradle / Ivy

Go to download

This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up with different versions on classes on the class path).

The newest version!

package org.jgroups.blocks;


import org.jgroups.Message;


public interface RequestHandler {

    /**
     * Processes a request synchronously, ie. on the thread invoking this handler
     * @param msg the message containing the request
     * @return the object, rceeived as result, or null (void method)
     */
    Object handle(Message msg) 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), {@link Response#send(Object,boolean)} should
     * be called.
     * @param request The request
     * @param 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,
     * {@link Response#send(Object,boolean)} must not be called
     */
    default void handle(Message request, Response response) throws Exception {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy