Package jadex.future
Class CallSequentializer<T>
java.lang.Object
jadex.future.CallSequentializer<T>
The call sequentializer realizes a 'critical region' for async calls,
i.e. it sequentializes access to a method.
- It uses a command to call the method
- It guarantees first come first served method invocation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe list of waiting calls with future and args.The command to execute a call.The current call. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new sequentializer.CallSequentializer
(jadex.common.IResultCommand<IFuture<T>, Object[]> call) Create a new sequentializer. -
Method Summary
-
Field Details
-
currentcall
The current call. -
calls
The list of waiting calls with future and args. -
commands
The command to execute a call.
-
-
Constructor Details
-
CallSequentializer
public CallSequentializer()Create a new sequentializer. -
CallSequentializer
Create a new sequentializer.- Parameters:
call
- The command to execute on an invocation.
-
-
Method Details
-
addCommand
Add a command by (method) name.- Parameters:
method
- The method name (or just a name).
-
call
Handles a call. If no other call is in it will execute the command. If at least one call is in it will be added to the calls list. When a call finishes the next is fetched from the list until empty.- Parameters:
args
- The call args.- Returns:
- The call result future.
-
call
-
proceed
protected void proceed()Called when a command returns.
-