org.apache.camel.impl
Class DefaultExecutorServiceStrategy

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.impl.DefaultExecutorServiceStrategy
All Implemented Interfaces:
Service, ShutdownableService, ExecutorServiceStrategy, StatefulService, SuspendableService

Deprecated. use ExecutorServiceManager instead, will be removed in a future Camel release

@Deprecated
public class DefaultExecutorServiceStrategy
extends ServiceSupport
implements ExecutorServiceStrategy


Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
DefaultExecutorServiceStrategy(CamelContext camelContext)
          Deprecated.  
 
Method Summary
protected  void doStart()
          Deprecated. Implementations override this method to support customized start/stop.
protected  void doStop()
          Deprecated. Implementations override this method to support customized start/stop.
 ThreadPoolProfile getDefaultThreadPoolProfile()
          Deprecated. Gets the default thread pool profile
 String getThreadName(String name)
          Deprecated. Creates a full thread name
 String getThreadNamePattern()
          Deprecated. Gets the thread name pattern used for creating the full thread name.
 ThreadPoolProfile getThreadPoolProfile(String id)
          Deprecated. Gets the thread pool profile by the given id
 ExecutorService lookup(Object source, String name, String executorServiceRef)
          Deprecated. Lookup a ExecutorService from the Registry and from known list of ThreadPoolProfile(s).
 ScheduledExecutorService lookupScheduled(Object source, String name, String executorServiceRef)
          Deprecated. Lookup a ScheduledExecutorService from the Registry and from known list of ThreadPoolProfile(s).
 ExecutorService newCachedThreadPool(Object source, String name)
          Deprecated. Creates a new cached thread pool.
 ExecutorService newDefaultThreadPool(Object source, String name)
          Deprecated. Creates a new thread pool using the default thread pool profile.
 ExecutorService newFixedThreadPool(Object source, String name, int poolSize)
          Deprecated. Creates a new fixed thread pool.
 ScheduledExecutorService newScheduledThreadPool(Object source, String name)
          Deprecated. Creates a new scheduled thread pool.
 ScheduledExecutorService newScheduledThreadPool(Object source, String name, int poolSize)
          Deprecated. Creates a new scheduled thread pool.
 ExecutorService newSingleThreadExecutor(Object source, String name)
          Deprecated. Creates a new single-threaded thread pool.
 ExecutorService newSynchronousThreadPool(Object source, String name)
          Deprecated. Creates a new synchronous thread pool, which executes the task in the caller thread (no task queue).
 ExecutorService newThreadPool(Object source, String name, int corePoolSize, int maxPoolSize)
          Deprecated. Creates a new custom thread pool.
 ExecutorService newThreadPool(Object source, String name, int corePoolSize, int maxPoolSize, int maxQueueSize)
          Deprecated. Creates a new custom thread pool.
 ExecutorService newThreadPool(Object source, String name, int corePoolSize, int maxPoolSize, long keepAliveTime, TimeUnit timeUnit, int maxQueueSize, RejectedExecutionHandler rejectedExecutionHandler, boolean daemon)
          Deprecated. Creates a new custom thread pool.
 ExecutorService newThreadPool(Object source, String name, String threadPoolProfileId)
          Deprecated. Creates a new thread pool using based on the given profile id.
 void registerThreadPoolProfile(ThreadPoolProfile profile)
          Deprecated. Registers the given thread pool profile
 void setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile)
          Deprecated. Sets the default thread pool profile
 void setThreadNamePattern(String pattern)
          Deprecated. Sets the thread name pattern used for creating the full thread name.
 void shutdown(ExecutorService executorService)
          Deprecated. Shutdown the given executor service.
 List<Runnable> shutdownNow(ExecutorService executorService)
          Deprecated. Shutdown now the given executor service.
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, 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

DefaultExecutorServiceStrategy

public DefaultExecutorServiceStrategy(CamelContext camelContext)
Deprecated. 
Method Detail

registerThreadPoolProfile

public void registerThreadPoolProfile(ThreadPoolProfile profile)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Registers the given thread pool profile

Specified by:
registerThreadPoolProfile in interface ExecutorServiceStrategy
Parameters:
profile - the profile

getThreadPoolProfile

public ThreadPoolProfile getThreadPoolProfile(String id)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Gets the thread pool profile by the given id

Specified by:
getThreadPoolProfile in interface ExecutorServiceStrategy
Parameters:
id - id of the thread pool profile to get
Returns:
the found profile, or null if not found

getDefaultThreadPoolProfile

public ThreadPoolProfile getDefaultThreadPoolProfile()
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Gets the default thread pool profile

Specified by:
getDefaultThreadPoolProfile in interface ExecutorServiceStrategy
Returns:
the default profile which are newer null

setDefaultThreadPoolProfile

public void setDefaultThreadPoolProfile(ThreadPoolProfile defaultThreadPoolProfile)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Sets the default thread pool profile

Specified by:
setDefaultThreadPoolProfile in interface ExecutorServiceStrategy
Parameters:
defaultThreadPoolProfile - the new default thread pool profile

getThreadName

public String getThreadName(String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a full thread name

Specified by:
getThreadName in interface ExecutorServiceStrategy
Parameters:
name - name which is appended to the full thread name
Returns:
the full thread name

getThreadNamePattern

public String getThreadNamePattern()
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Gets the thread name pattern used for creating the full thread name.

Specified by:
getThreadNamePattern in interface ExecutorServiceStrategy
Returns:
the pattern

setThreadNamePattern

public void setThreadNamePattern(String pattern)
                          throws IllegalArgumentException
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Sets the thread name pattern used for creating the full thread name.

The default pattern is: Camel (#camelId#) thread #counter# - #name#

Where #camelId# is the name of the CamelContext
and #counter# is a unique incrementing counter.
and #name# is the regular thread name.
You can also use #longName# is the long thread name which can includes endpoint parameters etc.

Specified by:
setThreadNamePattern in interface ExecutorServiceStrategy
Parameters:
pattern - the pattern
Throws:
IllegalArgumentException - if the pattern is invalid.

lookup

public ExecutorService lookup(Object source,
                              String name,
                              String executorServiceRef)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Lookup a ExecutorService from the Registry and from known list of ThreadPoolProfile(s).

Specified by:
lookup in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
executorServiceRef - reference to lookup
Returns:
the ExecutorService or null if not found

lookupScheduled

public ScheduledExecutorService lookupScheduled(Object source,
                                                String name,
                                                String executorServiceRef)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Lookup a ScheduledExecutorService from the Registry and from known list of ThreadPoolProfile(s).

Specified by:
lookupScheduled in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
executorServiceRef - reference to lookup
Returns:
the ScheduledExecutorService or null if not found

newDefaultThreadPool

public ExecutorService newDefaultThreadPool(Object source,
                                            String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new thread pool using the default thread pool profile.

Specified by:
newDefaultThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
Returns:
the created thread pool

newThreadPool

public ExecutorService newThreadPool(Object source,
                                     String name,
                                     String threadPoolProfileId)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new thread pool using based on the given profile id.

Specified by:
newThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
threadPoolProfileId - id of the thread pool profile to use for creating the thread pool
Returns:
the created thread pool, or null if the was no thread pool profile with that given id.

newCachedThreadPool

public ExecutorService newCachedThreadPool(Object source,
                                           String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new cached thread pool.

Important: Using cached thread pool is discouraged as they have no upper bound and can overload the JVM.

Specified by:
newCachedThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
Returns:
the created thread pool

newScheduledThreadPool

public ScheduledExecutorService newScheduledThreadPool(Object source,
                                                       String name,
                                                       int poolSize)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new scheduled thread pool.

Specified by:
newScheduledThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
poolSize - the core pool size
Returns:
the created thread pool

newScheduledThreadPool

public ScheduledExecutorService newScheduledThreadPool(Object source,
                                                       String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new scheduled thread pool.

Will use the pool size from the default thread pool profile

Specified by:
newScheduledThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
Returns:
the created thread pool

newFixedThreadPool

public ExecutorService newFixedThreadPool(Object source,
                                          String name,
                                          int poolSize)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new fixed thread pool.

Specified by:
newFixedThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
poolSize - the core pool size
Returns:
the created thread pool

newSingleThreadExecutor

public ExecutorService newSingleThreadExecutor(Object source,
                                               String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new single-threaded thread pool. This is often used for background threads.

Specified by:
newSingleThreadExecutor in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
Returns:
the created thread pool

newSynchronousThreadPool

public ExecutorService newSynchronousThreadPool(Object source,
                                                String name)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new synchronous thread pool, which executes the task in the caller thread (no task queue).

Specified by:
newSynchronousThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
Returns:
the created thread pool

newThreadPool

public ExecutorService newThreadPool(Object source,
                                     String name,
                                     int corePoolSize,
                                     int maxPoolSize)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new custom thread pool.

Will by default use 60 seconds for keep alive time for idle threads. And use CallerRunsPolicy as rejection handler

Specified by:
newThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
corePoolSize - the core pool size
maxPoolSize - the maximum pool size
Returns:
the created thread pool

newThreadPool

public ExecutorService newThreadPool(Object source,
                                     String name,
                                     int corePoolSize,
                                     int maxPoolSize,
                                     int maxQueueSize)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new custom thread pool.

Will by default use 60 seconds for keep alive time for idle threads. And use CallerRunsPolicy as rejection handler

Specified by:
newThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
corePoolSize - the core pool size
maxPoolSize - the maximum pool size
maxQueueSize - the maximum number of tasks in the queue, use Integer.MAX_INT or -1 to indicate unbounded
Returns:
the created thread pool

newThreadPool

public ExecutorService newThreadPool(Object source,
                                     String name,
                                     int corePoolSize,
                                     int maxPoolSize,
                                     long keepAliveTime,
                                     TimeUnit timeUnit,
                                     int maxQueueSize,
                                     RejectedExecutionHandler rejectedExecutionHandler,
                                     boolean daemon)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Creates a new custom thread pool.

Specified by:
newThreadPool in interface ExecutorServiceStrategy
Parameters:
source - the source object, usually it should be this passed in as parameter
name - name which is appended to the thread name
corePoolSize - the core pool size
maxPoolSize - the maximum pool size
keepAliveTime - keep alive time for idle threads
timeUnit - time unit for keep alive time
maxQueueSize - the maximum number of tasks in the queue, use Integer.MAX_INT or -1 to indicate unbounded
rejectedExecutionHandler - the handler for tasks which cannot be executed by the thread pool. If null is provided then CallerRunsPolicy is used.
daemon - whether or not the created threads is daemon or not
Returns:
the created thread pool

shutdown

public void shutdown(ExecutorService executorService)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Shutdown the given executor service.

Specified by:
shutdown in interface ExecutorServiceStrategy
Parameters:
executorService - the executor service to shutdown
See Also:
ExecutorService.shutdown()

shutdownNow

public List<Runnable> shutdownNow(ExecutorService executorService)
Deprecated. 
Description copied from interface: ExecutorServiceStrategy
Shutdown now the given executor service.

Specified by:
shutdownNow in interface ExecutorServiceStrategy
Parameters:
executorService - the executor service to shutdown now
Returns:
list of tasks that never commenced execution
See Also:
ExecutorService.shutdownNow()

doStart

protected void doStart()
                throws Exception
Deprecated. 
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Specified by:
doStart in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStop()

doStop

protected void doStop()
               throws Exception
Deprecated. 
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: Camel will invoke this ServiceSupport.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.

Specified by:
doStop in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStart()


Apache CAMEL