Interface Execution<IN,​OUT,​AGG>

  • Type Parameters:
    IN - The type of the argument passed into the function, if any
    OUT - The type of results sent by the function
    AGG - The type of the aggregated result returned by the ResultCollector

    public interface Execution<IN,​OUT,​AGG>
    Provides methods to build the context for the execution of a Function . A Context describes the environment in which the Execution will take place.

    This interface is implemented by GemFire. To obtain an instance of it use FunctionService.

    Since:
    GemFire 6.0
    See Also:
    FunctionService, Function
    • Method Detail

      • withFilter

        Execution<IN,​OUT,​AGG> withFilter​(java.util.Set<?> filter)
        Specifies a data filter of routing objects for selecting the GemFire members to execute the function on.

        Applicable only for regions with DataPolicy.PARTITION DataPolicy. If the filter is null, it will execute on all data of the region.

        Parameters:
        filter - Set defining the data filter to be used for executing the function
        Returns:
        an Execution with the filter
        Throws:
        java.lang.IllegalArgumentException - if filter passed is null.
        java.lang.UnsupportedOperationException - if not called after FunctionService.onRegion(org.apache.geode.cache.Region)
        Since:
        GemFire 6.0
      • setArguments

        Execution<IN,​OUT,​AGG> setArguments​(IN args)
        Specifies the user data passed to the function when it is executed. The function can retrieve these arguments using FunctionContext.getArguments()
        Parameters:
        args - user data passed to the function execution
        Returns:
        an Execution with args
        Throws:
        java.lang.IllegalArgumentException - if the input parameter is null
        Since:
        Geode 1.2
      • withArgs

        @Deprecated
        Execution<IN,​OUT,​AGG> withArgs​(IN args)
        Deprecated.
        Specifies the user data passed to the function when it is executed. The function can retrieve these arguments using FunctionContext.getArguments()
        Parameters:
        args - user data passed to the function execution
        Returns:
        an Execution with args
        Throws:
        java.lang.IllegalArgumentException - if the input parameter is null
        Since:
        GemFire 6.0
      • execute

        ResultCollector<OUT,​AGG> execute​(java.lang.String functionId,
                                               long timeout,
                                               java.util.concurrent.TimeUnit unit)
                                        throws FunctionException
        Executes the function using its id with the specified timeout. It blocks until all results have been received or the timeout has expired.

        Function.execute(FunctionContext) is called on the instance retrieved using FunctionService.getFunction(String) on the executing member.

        Parameters:
        functionId - id of the function to execute
        timeout - time to wait for the operation to finish before timing out
        unit - timeout unit
        Returns:
        ResultCollector to retrieve the results received. This is different object than the ResultCollector provided in withCollector(ResultCollector). User has to use this reference to retrieve results.
        Throws:
        FunctionException
        Since:
        Geode 1.11