Package org.apfloat.samples
Interface OperationExecutor
- All Known Implementing Classes:
LocalOperationExecutor
,PiDistributed.Node
,RemoteOperationExecutor
public interface OperationExecutor
Interface for implementing objects that can execute
Operation
s.
An operation can e.g. be executed locally or remotely.- Version:
- 1.1
- Author:
- Mikko Tommila
-
Method Summary
Modifier and TypeMethodDescription<T> T
Executes some code, returning a value.<T> BackgroundOperation
<T> executeBackground
(Operation<T> operation) Starts executing some code in the background.int
Returns the relative weight of this executor.
-
Method Details
-
execute
Executes some code, returning a value.- Type Parameters:
T
- Return value type of the operation.- Parameters:
operation
- The operation to execute.- Returns:
- Return value of the operation.
-
executeBackground
Starts executing some code in the background.- Type Parameters:
T
- Return value type of the operation.- Parameters:
operation
- The operation to execute in the background.- Returns:
- An object for retrieving the result of the operation later.
-
getWeight
int getWeight()Returns the relative weight of this executor. The weights of different operation executors can be used to distribute work more equally.- Returns:
- The relative weight of this operation executor.
-