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

org.apache.activemq.artemis.shaded.org.jgroups.blocks.RspFilter Maven / Gradle / Ivy

There is a newer version: 2.33.0
Show newest version
package org.apache.activemq.artemis.shaded.org.jgroups.blocks;

import org.apache.activemq.artemis.shaded.org.jgroups.Address;

/**
 * Interface defining when a group request is done. This allows for termination of a group request based on
 * logic implemented by the caller. Example: caller uses mode GET_FIRST plus a RspFilter implementation. Here, the
 * request will not return (assuming timeout is 0) when the first response has been received, but when the filter
 * passed
 * @author Bela Ban
 */
public interface RspFilter {


    /**
     * Determines whether a response from a given sender should be added to the response list of the request
     * @param response The response (usually a serializable value)
     * @param sender The sender of response
     * @return True if we should add the response to the response list ({@link org.apache.activemq.artemis.shaded.org.jgroups.util.RspList}) of a request,
     * otherwise false. In the latter case, we don't add the response to the response list.
     */
    boolean isAcceptable(Object response, Address sender);

    /**
     * Right after calling {@link #isAcceptable(Object, org.apache.activemq.artemis.shaded.org.jgroups.Address)}, this method is called to see whether
     * we are done with the request and can unblock the caller
     * @return False if the request is done, otherwise true
     */
    boolean needMoreResponses();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy