Package jadex.platform.service.execution
Class SyncExecutionService
- java.lang.Object
- 
- jadex.bridge.service.BasicService
- 
- jadex.platform.service.execution.SyncExecutionService
 
 
- 
- All Implemented Interfaces:
- IInternalService,- IService,- IExecutionService
 - Direct Known Subclasses:
- BisimExecutionService
 
 public class SyncExecutionService extends BasicService implements IExecutionService The synchronous execution service that executes all tasks in zero to one thread.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSyncExecutionService.StateThe possible states of the service.
 - 
Field SummaryFields Modifier and Type Field Description protected ExecutorexecutorThe executor.protected Future<java.lang.Void>idlefutureThe idle future.protected IInternalAccessproviderThe provider.protected java.util.Set<IExecutable>queueThe queue of tasks to be executed.protected java.util.List<Future<java.lang.Void>>removedfutThe removed listeners.protected IExecutableremovedtaskFlag that indicates that the current task has been removed.protected SyncExecutionService.StatestateThe state of the service.protected IExecutabletaskThe current task.- 
Fields inherited from class jadex.bridge.service.BasicServiceidcnt, impltype, internalaccess, providerid, shutdowned, sid, started, type
 - 
Fields inherited from interface jadex.bridge.service.IServiceEMPTY_SERVICES
 
- 
 - 
Constructor SummaryConstructors Constructor Description SyncExecutionService(IInternalAccess provider)Create a new synchronous executor service.SyncExecutionService(IInternalAccess provider, java.util.Map<java.lang.String,java.lang.Object> properties)Create a new synchronous executor service.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>cancel(IExecutable task)Cancel a task.booleancustomIsValid()Test if the service is valid.voidexecute(IExecutable task)Execute a task.IFuture<java.lang.Void>getNextIdleFuture()Get the future indicating that executor is idle.IExecutable[]getRunningTasks()Get the currently running or waiting tasks.protected IThreadPoolServicegetThreadPool()Thread pool template method to support replacment.IFuture<java.lang.Void>shutdownService()Shutdown the executor service.IFuture<java.lang.Void>startService()Start the executor service.- 
Methods inherited from class jadex.bridge.service.BasicServicecreateServiceIdentifier, createServiceIdentifier, equals, generateServiceName, getInterfaceType, getInternalAccess, getInvokeMethod, getMethodInfos, getMethodTimeout, getPropertyMap, getProviderId, getServiceId, hashCode, initNFProperties, invokeMethod, isValid, setComponentAccess, setPropertyMap, setServiceIdentifier, toString
 
- 
 
- 
- 
- 
Field Detail- 
queueprotected java.util.Set<IExecutable> queue The queue of tasks to be executed.
 - 
executorprotected Executor executor The executor.
 - 
idlefutureprotected volatile Future<java.lang.Void> idlefuture The idle future.
 - 
stateprotected SyncExecutionService.State state The state of the service.
 - 
taskprotected IExecutable task The current task.
 - 
removedtaskprotected IExecutable removedtask Flag that indicates that the current task has been removed.
 - 
removedfutprotected java.util.List<Future<java.lang.Void>> removedfut The removed listeners.
 - 
providerprotected IInternalAccess provider The provider.
 
- 
 - 
Constructor Detail- 
SyncExecutionServicepublic SyncExecutionService(IInternalAccess provider) Create a new synchronous executor service.
 - 
SyncExecutionServicepublic SyncExecutionService(IInternalAccess provider, java.util.Map<java.lang.String,java.lang.Object> properties) Create a new synchronous executor service.
 
- 
 - 
Method Detail- 
executepublic void execute(IExecutable task) Execute a task. Triggers the task to be executed in future.- Specified by:
- executein interface- IExecutionService
- Parameters:
- task- The task to execute.
 
 - 
cancelpublic IFuture<java.lang.Void> cancel(IExecutable task) Cancel a task. Triggers the task to be not executed in future.- Specified by:
- cancelin interface- IExecutionService
- Parameters:
- task- The task to execute.
- Returns:
- Future signaling cancellation.
 
 - 
getRunningTaskspublic IExecutable[] getRunningTasks() Get the currently running or waiting tasks.- Specified by:
- getRunningTasksin interface- IExecutionService
 
 - 
customIsValidpublic boolean customIsValid() Test if the service is valid.- Returns:
- True, if service can be used.
 
 - 
startServicepublic IFuture<java.lang.Void> startService() Start the executor service. Resumes all tasks.- Specified by:
- startServicein interface- IInternalService
- Overrides:
- startServicein class- BasicService
- Returns:
- A future that is done when the service has completed starting.
 
 - 
shutdownServicepublic IFuture<java.lang.Void> shutdownService() Shutdown the executor service.- Specified by:
- shutdownServicein interface- IInternalService
- Overrides:
- shutdownServicein class- BasicService
- Returns:
- A future that is done when the service has completed its shutdown.
 
 - 
getNextIdleFuturepublic IFuture<java.lang.Void> getNextIdleFuture() Get the future indicating that executor is idle.- Specified by:
- getNextIdleFuturein interface- IExecutionService
 
 - 
getThreadPoolprotected IThreadPoolService getThreadPool() Thread pool template method to support replacment.
 
- 
 
-