Package jadex.micro.taskdistributor
Class IntermediateTaskDistributorAgent<R,T>
java.lang.Object
jadex.micro.taskdistributor.IntermediateTaskDistributorAgent<R,T>
- All Implemented Interfaces:
IIntermediateTaskDistributor<R,
T>
public class IntermediateTaskDistributorAgent<R,T>
extends Object
implements IIntermediateTaskDistributor<R,T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected Queue
<jadex.future.Future<ITaskDistributor.Task<T>>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjadex.future.IFuture
<Void> addTaskResult
(String id, R result) Set the result of a task.jadex.future.ISubscriptionIntermediateFuture
<R> Publish a new task.jadex.future.IFuture
<ITaskDistributor.Task<T>> Request a task.jadex.future.IFuture
<Void> setTaskException
(String id, Exception ex) Set the exception of a task.jadex.future.IFuture
<Void> Set a task finished.
-
Field Details
-
tasks
-
requestors
-
ongoingtasks
-
cnt
protected int cnt
-
-
Constructor Details
-
IntermediateTaskDistributorAgent
public IntermediateTaskDistributorAgent()
-
-
Method Details
-
publish
Publish a new task.- Specified by:
publish
in interfaceIIntermediateTaskDistributor<R,
T> - Parameters:
task
- The task to publish.
-
addTaskResult
Set the result of a task.- Specified by:
addTaskResult
in interfaceIIntermediateTaskDistributor<R,
T> - Parameters:
id
- The task id.result
- The result.
-
setTaskFinished
Set a task finished.- Specified by:
setTaskFinished
in interfaceIIntermediateTaskDistributor<R,
T> - Parameters:
id
- The task id.result
- The result.
-
setTaskException
Set the exception of a task.- Specified by:
setTaskException
in interfaceIIntermediateTaskDistributor<R,
T> - Parameters:
id
- The task id.ex
- The exception.
-
requestNextTask
Request a task.- Specified by:
requestNextTask
in interfaceIIntermediateTaskDistributor<R,
T> - Returns:
- The next task (waits for a task).
-