Class ThreadPoolService
- java.lang.Object
- 
- jadex.bridge.service.BasicService
- 
- jadex.platform.service.threadpool.ThreadPoolService
 
 
- 
- All Implemented Interfaces:
- IInternalService,- IService,- IDaemonThreadPoolService,- IThreadPoolService,- IThreadPool
 
 public class ThreadPoolService extends BasicService implements IThreadPoolService, IDaemonThreadPoolService Service wrapper for a threadpool.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IThreadPoolthreadpoolThe threadpool.- 
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 ThreadPoolService(IThreadPool threadpool, IComponentIdentifier provider)Create a new threadpool service.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFinishListener(IChangeListener<java.lang.Void> listener)Add a finished listener.voiddispose()Shutdown the thread pool.voidexecute(java.lang.Runnable task)Execute a task in its own thread.voidexecuteForever(java.lang.Runnable task)Execute a task in its own thread.booleanisRunning()Test if the thread pool is running.IFuture<java.lang.Void>shutdownService()Shutdown the 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, startService, toString
 
- 
 
- 
- 
- 
Field Detail- 
threadpoolprotected IThreadPool threadpool The threadpool.
 
- 
 - 
Constructor Detail- 
ThreadPoolServicepublic ThreadPoolService(IThreadPool threadpool, IComponentIdentifier provider) Create a new threadpool service.
 
- 
 - 
Method Detail- 
shutdownServicepublic IFuture<java.lang.Void> shutdownService() Shutdown the service.- Specified by:
- shutdownServicein interface- IInternalService
- Overrides:
- shutdownServicein class- BasicService
- Returns:
- A future that is done when the service has completed its shutdown.
 
 - 
executepublic void execute(java.lang.Runnable task) Execute a task in its own thread.- Specified by:
- executein interface- IThreadPool
- Parameters:
- task- The task to execute.
 
 - 
executeForeverpublic void executeForever(java.lang.Runnable task) Execute a task in its own thread. The pool expects the thread executing the task to never return. Preferably use this method if you want to permanently retrieve a thread e.g. for repeated blocking operations. Consider requesting the daemon version.- Specified by:
- executeForeverin interface- IThreadPool
- Parameters:
- task- The task to execute.
 
 - 
disposepublic void dispose() Shutdown the thread pool.- Specified by:
- disposein interface- IThreadPool
 
 - 
isRunningpublic boolean isRunning() Test if the thread pool is running.- Specified by:
- isRunningin interface- IThreadPool
 
 - 
addFinishListenerpublic void addFinishListener(IChangeListener<java.lang.Void> listener) Add a finished listener.- Specified by:
- addFinishListenerin interface- IThreadPool
 
 
- 
 
-