|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.support.ServiceSupport
org.apache.camel.impl.DefaultExecutorServiceManager
public class DefaultExecutorServiceManager
Default ExecutorServiceManager.
| Field Summary |
|---|
| Fields inherited from class org.apache.camel.support.ServiceSupport |
|---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
| Constructor Summary | |
|---|---|
DefaultExecutorServiceManager(CamelContext camelContext)
|
|
| Method Summary | |
|---|---|
boolean |
awaitTermination(ExecutorService executorService,
long shutdownAwaitTermination)
Awaits the termination of the thread pool. |
protected void |
doShutdown()
Implementations override this method to perform customized shutdown. |
protected void |
doStart()
Implementations override this method to support customized start/stop. |
protected void |
doStop()
Implementations override this method to support customized start/stop. |
ThreadPoolProfile |
getDefaultThreadPoolProfile()
Gets the default thread pool profile |
long |
getShutdownAwaitTermination()
Gets the time to wait for thread pools to shutdown orderly, when invoking the ShutdownableService.shutdown() method. |
String |
getThreadNamePattern()
Gets the thread name patter to use |
ThreadPoolFactory |
getThreadPoolFactory()
Gets the ThreadPoolFactory to use for creating the thread pools. |
ThreadPoolProfile |
getThreadPoolProfile(String id)
Gets the thread pool profile by the given id |
ExecutorService |
newCachedThreadPool(Object source,
String name)
Creates a new cached thread pool. |
ScheduledExecutorService |
newDefaultScheduledThreadPool(Object source,
String name)
Creates a new scheduled thread pool using the default thread pool profile. |
ExecutorService |
newDefaultThreadPool(Object source,
String name)
Creates a new thread pool using the default thread pool profile. |
ExecutorService |
newFixedThreadPool(Object source,
String name,
int poolSize)
Creates a new fixed thread pool. |
ScheduledExecutorService |
newScheduledThreadPool(Object source,
String name,
int poolSize)
Creates a new scheduled thread pool. |
ScheduledExecutorService |
newScheduledThreadPool(Object source,
String name,
String profileId)
Creates a new scheduled thread pool using a profile id |
ScheduledExecutorService |
newScheduledThreadPool(Object source,
String name,
ThreadPoolProfile profile)
Creates a new scheduled thread pool using a profile |
ExecutorService |
newSingleThreadExecutor(Object source,
String name)
Creates a new single-threaded thread pool. |
ScheduledExecutorService |
newSingleThreadScheduledExecutor(Object source,
String name)
Creates a new single-threaded thread pool. |
Thread |
newThread(String name,
Runnable runnable)
Creates a new daemon thread with the given name. |
ExecutorService |
newThreadPool(Object source,
String name,
int poolSize,
int maxPoolSize)
Creates a new thread pool. |
ExecutorService |
newThreadPool(Object source,
String name,
String profileId)
Creates a new thread pool using using the given profile id |
ExecutorService |
newThreadPool(Object source,
String name,
ThreadPoolProfile profile)
Creates a new thread pool using the given profile |
protected void |
onNewExecutorService(ExecutorService executorService)
Strategy callback when a new ExecutorService have been created. |
void |
registerThreadPoolProfile(ThreadPoolProfile profile)
Registers the given thread pool profile |
String |
resolveThreadName(String name)
Creates a full thread name |
void |
setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile)
Sets the default thread pool profile |
void |
setShutdownAwaitTermination(long shutdownAwaitTermination)
Sets the time to wait for thread pools to shutdown orderly, when invoking the ShutdownableService.shutdown() method. |
void |
setThreadNamePattern(String threadNamePattern)
Sets the thread name pattern used for creating the full thread name. |
void |
setThreadPoolFactory(ThreadPoolFactory threadPoolFactory)
Sets a custom ThreadPoolFactory to use |
void |
shutdown(ExecutorService executorService)
Shutdown the given executor service (not graceful). |
void |
shutdownGraceful(ExecutorService executorService)
Shutdown the given executor service graceful at first, and then aggressively if the await termination timeout was hit. |
void |
shutdownGraceful(ExecutorService executorService,
long shutdownAwaitTermination)
Shutdown the given executor service graceful at first, and then aggressively if the await termination timeout was hit. |
List<Runnable> |
shutdownNow(ExecutorService executorService)
Shutdown now the given executor service aggressively. |
| Methods inherited from class org.apache.camel.support.ServiceSupport |
|---|
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.camel.ShutdownableService |
|---|
shutdown |
| Methods inherited from interface org.apache.camel.Service |
|---|
start, stop |
| Constructor Detail |
|---|
public DefaultExecutorServiceManager(CamelContext camelContext)
| Method Detail |
|---|
public ThreadPoolFactory getThreadPoolFactory()
ExecutorServiceManagerThreadPoolFactory to use for creating the thread pools.
getThreadPoolFactory in interface ExecutorServiceManagerpublic void setThreadPoolFactory(ThreadPoolFactory threadPoolFactory)
ExecutorServiceManagerThreadPoolFactory to use
setThreadPoolFactory in interface ExecutorServiceManagerthreadPoolFactory - the thread pool factorypublic void registerThreadPoolProfile(ThreadPoolProfile profile)
ExecutorServiceManager
registerThreadPoolProfile in interface ExecutorServiceManagerprofile - the profilepublic ThreadPoolProfile getThreadPoolProfile(String id)
ExecutorServiceManager
getThreadPoolProfile in interface ExecutorServiceManagerid - id of the thread pool profile to get
public ThreadPoolProfile getDefaultThreadPoolProfile()
ExecutorServiceManager
getDefaultThreadPoolProfile in interface ExecutorServiceManagerpublic void setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile)
ExecutorServiceManager
setDefaultThreadPoolProfile in interface ExecutorServiceManagerdefaultThreadPoolProfile - the new default thread pool profilepublic String getThreadNamePattern()
ExecutorServiceManager
getThreadNamePattern in interface ExecutorServiceManagerpublic void setThreadNamePattern(String threadNamePattern)
ExecutorServiceManagerCamelContext
setThreadNamePattern in interface ExecutorServiceManagerthreadNamePattern - the patternpublic long getShutdownAwaitTermination()
ExecutorServiceManagerShutdownableService.shutdown() method.
The default value is 10000 millis.
getShutdownAwaitTermination in interface ExecutorServiceManagerpublic void setShutdownAwaitTermination(long shutdownAwaitTermination)
ExecutorServiceManagerShutdownableService.shutdown() method.
The default value is 10000 millis.
setShutdownAwaitTermination in interface ExecutorServiceManagershutdownAwaitTermination - time in millis.public String resolveThreadName(String name)
ExecutorServiceManager
resolveThreadName in interface ExecutorServiceManagername - name which is appended to the full thread name
public Thread newThread(String name,
Runnable runnable)
ExecutorServiceManager
newThread in interface ExecutorServiceManagername - name which is appended to the thread namerunnable - a runnable to be executed by new thread instance
public ExecutorService newDefaultThreadPool(Object source,
String name)
ExecutorServiceManager
newDefaultThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread name
public ScheduledExecutorService newDefaultScheduledThreadPool(Object source,
String name)
ExecutorServiceManager
newDefaultScheduledThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread name
public ExecutorService newThreadPool(Object source,
String name,
String profileId)
ExecutorServiceManager
newThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread nameprofileId - the id of the profile with the thread pool settings to use
public ExecutorService newThreadPool(Object source,
String name,
ThreadPoolProfile profile)
ExecutorServiceManager
newThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread nameprofile - the profile with the thread pool settings to use
public ExecutorService newThreadPool(Object source,
String name,
int poolSize,
int maxPoolSize)
ExecutorServiceManager
newThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread namepoolSize - the core pool sizemaxPoolSize - the maximum pool size
public ExecutorService newSingleThreadExecutor(Object source,
String name)
ExecutorServiceManager
newSingleThreadExecutor in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread name
public ExecutorService newCachedThreadPool(Object source,
String name)
ExecutorServiceManager
newCachedThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread name
public ExecutorService newFixedThreadPool(Object source,
String name,
int poolSize)
ExecutorServiceManager
newFixedThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread namepoolSize - the core pool size
public ScheduledExecutorService newSingleThreadScheduledExecutor(Object source,
String name)
ExecutorServiceManager
newSingleThreadScheduledExecutor in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread name
public ScheduledExecutorService newScheduledThreadPool(Object source,
String name,
ThreadPoolProfile profile)
ExecutorServiceManager
newScheduledThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread nameprofile - the profile with the thread pool settings to use
public ScheduledExecutorService newScheduledThreadPool(Object source,
String name,
String profileId)
ExecutorServiceManager
newScheduledThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread nameprofileId - the id of the profile with the thread pool settings to use
public ScheduledExecutorService newScheduledThreadPool(Object source,
String name,
int poolSize)
ExecutorServiceManager
newScheduledThreadPool in interface ExecutorServiceManagersource - the source object, usually it should be this passed in as parametername - name which is appended to the thread namepoolSize - the core pool size
public void shutdown(ExecutorService executorService)
ExecutorServiceManagerExecutorService.shutdown() and return.
shutdown in interface ExecutorServiceManagerexecutorService - the executor service to shutdownExecutorService.shutdown()public void shutdownGraceful(ExecutorService executorService)
ExecutorServiceManagerExecutorServiceManager.shutdownNow(java.util.concurrent.ExecutorService) which
forces a shutdown. The ExecutorServiceManager.getShutdownAwaitTermination()
is used as timeout value waiting for orderly shutdown to
complete normally, before going aggressively.
shutdownGraceful in interface ExecutorServiceManagerexecutorService - the executor service to shutdownExecutorService.shutdown(),
ExecutorServiceManager.getShutdownAwaitTermination()
public void shutdownGraceful(ExecutorService executorService,
long shutdownAwaitTermination)
ExecutorServiceManagerExecutorServiceManager.shutdownNow(java.util.concurrent.ExecutorService) which
forces a shutdown. The parameter shutdownAwaitTermination
is used as timeout value waiting for orderly shutdown to
complete normally, before going aggressively.
shutdownGraceful in interface ExecutorServiceManagerexecutorService - the executor service to shutdownshutdownAwaitTermination - timeout in millis to wait for orderly shutdownExecutorService.shutdown()public List<Runnable> shutdownNow(ExecutorService executorService)
ExecutorServiceManagerExecutorService.shutdownNow() and return.
shutdownNow in interface ExecutorServiceManagerexecutorService - the executor service to shutdown now
ExecutorService.shutdownNow()
public boolean awaitTermination(ExecutorService executorService,
long shutdownAwaitTermination)
throws InterruptedException
ExecutorServiceManager
awaitTermination in interface ExecutorServiceManagerexecutorService - the thread poolshutdownAwaitTermination - time in millis to use as timeout
InterruptedException - is thrown if we are interrupted during waitingprotected void onNewExecutorService(ExecutorService executorService)
ExecutorService have been created.
executorService - the created ExecutorService
protected void doStart()
throws Exception
ServiceSupportServiceSupport.doStop() for more details.
doStart in class ServiceSupportExceptionServiceSupport.doStop()
protected void doStop()
throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.
doStop in class ServiceSupportExceptionServiceSupport.doStart()
protected void doShutdown()
throws Exception
ServiceSupport
doShutdown in class ServiceSupportException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||