Package org.apache.geode.cache.execute
Interface Execution<IN,OUT,AGG>
- Type Parameters:
IN- The type of the argument passed into the function, if anyOUT- The type of results sent by the functionAGG- 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:
-
Method Summary
Modifier and TypeMethodDescriptionExecutes the function using its id.Executes the function using its id with the specified timeout.Executes the function instance provided.Executes the function instance provided.setArguments(IN args) Specifies the user data passed to the function when it is executed.Deprecated.Specifies theResultCollectorthat will receive the results after the function has been executed.withFilter(Set<?> filter) Specifies a data filter of routing objects for selecting the GemFire members to execute the function on.
-
Method Details
-
withFilter
Specifies a data filter of routing objects for selecting the GemFire members to execute the function on.Applicable only for regions with
DataPolicy.PARTITIONDataPolicy. 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:
IllegalArgumentException- if filter passed is null.UnsupportedOperationException- if not called afterFunctionService.onRegion(org.apache.geode.cache.Region)- Since:
- GemFire 6.0
-
setArguments
Specifies the user data passed to the function when it is executed. The function can retrieve these arguments usingFunctionContext.getArguments()- Parameters:
args- user data passed to the function execution- Returns:
- an Execution with args
- Throws:
IllegalArgumentException- if the input parameter is null- Since:
- Geode 1.2
-
withArgs
Deprecated.usesetArguments(Object)insteadSpecifies the user data passed to the function when it is executed. The function can retrieve these arguments usingFunctionContext.getArguments()- Parameters:
args- user data passed to the function execution- Returns:
- an Execution with args
- Throws:
IllegalArgumentException- if the input parameter is null- Since:
- GemFire 6.0
-
withCollector
Specifies theResultCollectorthat will receive the results after the function has been executed. Collector will receive results as they are sent from theFunction.execute(FunctionContext)usingResultSender.- Parameters:
rc- TheResultCollectorthat will receive the results- Returns:
- an Execution with a collector
- Throws:
IllegalArgumentException- ifResultCollectoris null- Since:
- GemFire 6.0
- See Also:
-
execute
Executes the function using its id. When executed from a client, it blocks until all results have been received or the global timeout (gemfire.CLIENT_FUNCTION_TIMEOUT Java property), if set, has expired.Function.execute(FunctionContext)is called on the instance retrieved usingFunctionService.getFunction(String)on the executing member.- Parameters:
functionId- id of the function to execute- 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:
LowMemoryException- if theFunction.optimizeForWrite()returns true and there is a low memory conditionFunctionException- Since:
- GemFire 6.0
-
execute
ResultCollector<OUT,AGG> execute(String functionId, long timeout, 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 usingFunctionService.getFunction(String)on the executing member.- Parameters:
functionId- id of the function to executetimeout- time to wait for the operation to finish before timing outunit- 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
-
execute
Executes the function instance provided. When executed from a client, it blocks until all results have been received or the global timeout (gemfire.CLIENT_FUNCTION_TIMEOUT Java property), if set, has expired.Function.execute(FunctionContext)is called on the de-serialized instance on the executing member.- Parameters:
function- instance to execute- 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:
LowMemoryException- if theFunction.optimizeForWrite()returns true and there is a low memory conditionFunctionException- Since:
- GemFire 6.0
-
execute
ResultCollector<OUT,AGG> execute(Function function, long timeout, TimeUnit unit) throws FunctionException Executes the function instance provided. It blocks until all results have been received or the timeout has expired.Function.execute(FunctionContext)is called on the de-serialized instance on the executing member.- Parameters:
function- instance to executetimeout- time to wait for the operation to finish before timing outunit- 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:
LowMemoryException- if theFunction.optimizeForWrite()returns true and there is a low memory conditionFunctionException- Since:
- Geode 1.11
-
setArguments(Object)instead