Package org.silverpeas.core.thread
Class ManagedThreadPool.ExecutionConfig
- java.lang.Object
-
- org.silverpeas.core.thread.ManagedThreadPool.ExecutionConfig
-
- Enclosing class:
- ManagedThreadPool
public static class ManagedThreadPool.ExecutionConfig extends Object
Class that permits to specify the execution configuration.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ManagedThreadPool.ExecutionConfig
defaultConfig()
Gets an instance of a default execution configuration.ManagedThreadPool.ExecutionConfig
killThreadsAfterTimeout()
By default the caller get again the control after the timeout whileRunnable
threads continue to run.static ManagedThreadPool.ExecutionConfig
maxThreadPoolSizeOf(int maxThreadPoolSize)
Gets an instance of an execution configuration with a specified maximum pool of thread.
This is only useful when invokingCallable
instances.static ManagedThreadPool.ExecutionConfig
timeoutOf(long timeout)
Gets an instance of an execution configuration with a specified timeout in milliseconds.ManagedThreadPool.ExecutionConfig
withMaxThreadPoolSizeOf(int maxThreadPoolSize)
Sets a maximum size of the pool of threads.
This is only useful when invokingCallable
instances.ManagedThreadPool.ExecutionConfig
withTimeoutOf(long timeout)
Sets a timeout in milliseconds after that the invocation process will give back hand.ManagedThreadPool.ExecutionConfig
withTimeoutOf(long timeout, TimeUnit timeUnit)
Sets a timeout after that the invocation process will give back hand.
-
-
-
Method Detail
-
maxThreadPoolSizeOf
public static ManagedThreadPool.ExecutionConfig maxThreadPoolSizeOf(int maxThreadPoolSize)
Gets an instance of an execution configuration with a specified maximum pool of thread.
This is only useful when invokingCallable
instances.- Parameters:
maxThreadPoolSize
- the maximum size of the treads pool.- Returns:
- an instance of an execution configuration with a specified maximum pool of thread.
-
timeoutOf
public static ManagedThreadPool.ExecutionConfig timeoutOf(long timeout)
Gets an instance of an execution configuration with a specified timeout in milliseconds.- Parameters:
timeout
- the timeout- Returns:
- an instance of an execution configuration with a specified timeout in milliseconds.
-
defaultConfig
public static ManagedThreadPool.ExecutionConfig defaultConfig()
Gets an instance of a default execution configuration.- Returns:
- an instance of a default execution configuration.
-
withMaxThreadPoolSizeOf
public ManagedThreadPool.ExecutionConfig withMaxThreadPoolSizeOf(int maxThreadPoolSize)
Sets a maximum size of the pool of threads.
This is only useful when invokingCallable
instances.- Parameters:
maxThreadPoolSize
- the maximum size of the pool of threads.- Returns:
- the instance of
ManagedThreadPool.ExecutionConfig
.
-
withTimeoutOf
public ManagedThreadPool.ExecutionConfig withTimeoutOf(long timeout)
Sets a timeout in milliseconds after that the invocation process will give back hand.- Parameters:
timeout
- the timeout after which the hand must be get back to the caller.- Returns:
- the instance of
ManagedThreadPool.ExecutionConfig
.
-
withTimeoutOf
public ManagedThreadPool.ExecutionConfig withTimeoutOf(long timeout, TimeUnit timeUnit)
Sets a timeout after that the invocation process will give back hand.- Parameters:
timeout
- the timeout after which the hand must be get back to the caller.timeUnit
- the time unit of the given timeout (default is milliseconds).- Returns:
- the instance of
ManagedThreadPool.ExecutionConfig
.
-
killThreadsAfterTimeout
public ManagedThreadPool.ExecutionConfig killThreadsAfterTimeout()
By default the caller get again the control after the timeout whileRunnable
threads continue to run. Calling this method if it is required that current running thread must be killed after an effective timeout.- Returns:
- the instance of
ManagedThreadPool.ExecutionConfig
.
-
-