Class AuditRequestContextPropagatingExecutorServiceFactory
- java.lang.Object
-
- org.forgerock.openam.audit.context.AuditRequestContextPropagatingExecutorServiceFactory
-
- All Implemented Interfaces:
AMExecutorServiceFactory
public class AuditRequestContextPropagatingExecutorServiceFactory extends Object implements AMExecutorServiceFactory
ExecutorServiceFactorydecorator that ensures all ExecutorServices propagateAuditRequestContextfrom task publishing thread to task consuming thread.- Since:
- 13.0.0
-
-
Constructor Summary
Constructors Constructor Description AuditRequestContextPropagatingExecutorServiceFactory(org.forgerock.util.thread.listener.ShutdownManager shutdownManager)Constructs a newAuditRequestContextPropagatingExecutorServiceFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutorServicecreateCachedThreadPool(String threadName)Generates a Cached Thread Pool ExecutorService using the provided name as a prefix of the thread names.ExecutorServicecreateCachedThreadPool(ThreadFactory factory)Generates a Cached Thread Pool ExecutorService which has been pre-registered with the ShutdownManager.ExecutorServicecreateFixedThreadPool(int pool, String threadName)Create a fixed size Thread Pool ExecutorService using the provided name as the prefix of the thread names.ExecutorServicecreateFixedThreadPool(int pool, ThreadFactory factory)Creates a fixed size Thread Pool ExecutorService which has been pre-registered with theShutdownManager.ScheduledExecutorServicecreateScheduledService(int poolSize, String threadNamePrefix)Generates a ScheduledExecutorService which has been pre-registered with the ShutdownManager.ExecutorServicecreateThreadPool(int coreSize, int maxSize, long idleTimeout, TimeUnit timeoutTimeunit, BlockingQueue<Runnable> runnables, String threadNamePrefix)Generates a ThreadPoolExecutor with the provided values, and registers that executor as listening for shutdown messages.
-
-
-
Constructor Detail
-
AuditRequestContextPropagatingExecutorServiceFactory
public AuditRequestContextPropagatingExecutorServiceFactory(org.forgerock.util.thread.listener.ShutdownManager shutdownManager)
Constructs a newAuditRequestContextPropagatingExecutorServiceFactory.- Parameters:
shutdownManager- TheShutdownManager.
-
-
Method Detail
-
createScheduledService
public ScheduledExecutorService createScheduledService(int poolSize, String threadNamePrefix)
Description copied from interface:AMExecutorServiceFactoryGenerates a ScheduledExecutorService which has been pre-registered with the ShutdownManager.- Specified by:
createScheduledServicein interfaceAMExecutorServiceFactory- Parameters:
poolSize- The size of the ScheduledExecutorService thread pool.threadNamePrefix- The thread name prefix to use when generating new threads.- Returns:
- A non null ScheduledExecutorService
- See Also:
Executors.newScheduledThreadPool(int)
-
createFixedThreadPool
public ExecutorService createFixedThreadPool(int pool, ThreadFactory factory)
Description copied from interface:AMExecutorServiceFactoryCreates a fixed size Thread Pool ExecutorService which has been pre-registered with theShutdownManager.- Specified by:
createFixedThreadPoolin interfaceAMExecutorServiceFactory- Parameters:
pool- The size of the pool to create.factory- TheThreadFactoryused to generate new threads.- Returns:
- Non null.
-
createFixedThreadPool
public ExecutorService createFixedThreadPool(int pool, String threadName)
Description copied from interface:AMExecutorServiceFactoryCreate a fixed size Thread Pool ExecutorService using the provided name as the prefix of the thread names.- Specified by:
createFixedThreadPoolin interfaceAMExecutorServiceFactory- Parameters:
pool- Size of the fixed pool.threadName- The thread name prefix to use when generating new threads.- Returns:
- Non null.
- See Also:
AMExecutorServiceFactory.createFixedThreadPool(int, java.util.concurrent.ThreadFactory)
-
createCachedThreadPool
public ExecutorService createCachedThreadPool(ThreadFactory factory)
Description copied from interface:AMExecutorServiceFactoryGenerates a Cached Thread Pool ExecutorService which has been pre-registered with the ShutdownManager. The provided ThreadFactory is used by the service when creating Threads.- Specified by:
createCachedThreadPoolin interfaceAMExecutorServiceFactory- Parameters:
factory- The ThreadFactory that will be used when generating threads. May not be null.- Returns:
- A non null ExecutorService.
- See Also:
Executors.newCachedThreadPool(java.util.concurrent.ThreadFactory)
-
createCachedThreadPool
public ExecutorService createCachedThreadPool(String threadName)
Description copied from interface:AMExecutorServiceFactoryGenerates a Cached Thread Pool ExecutorService using the provided name as a prefix of the thread names.- Specified by:
createCachedThreadPoolin interfaceAMExecutorServiceFactory- Parameters:
threadName- The thread name prefix to use when generating new threads.- Returns:
- Non null.
- See Also:
AMExecutorServiceFactory.createCachedThreadPool(java.util.concurrent.ThreadFactory)
-
createThreadPool
public ExecutorService createThreadPool(int coreSize, int maxSize, long idleTimeout, TimeUnit timeoutTimeunit, BlockingQueue<Runnable> runnables, String threadNamePrefix)
Description copied from interface:AMExecutorServiceFactoryGenerates a ThreadPoolExecutor with the provided values, and registers that executor as listening for shutdown messages.- Specified by:
createThreadPoolin interfaceAMExecutorServiceFactory- Parameters:
coreSize- the number of threads to keep in the pool, even if they are idlemaxSize- Max number of threads in the poolidleTimeout- When the number of threads is greater than core, maximum time that excess idle threads will wait before terminatingtimeoutTimeunit- The time unit for the idleTimeout argumentrunnables- Queue of threads to be runthreadNamePrefix- The thread name prefix to use when generating new threads.- Returns:
- a configured ExecutorService, registered to listen to shutdown messages.
-
-