Class ExecutorUtils
java.lang.Object
id.luckynetwork.lyrams.lyralibs.core.utils.ExecutorUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription> It creates a fixed size thread pool with a custom thread factory that sets the thread name and a custom uncaught exception handler that logs the exceptiongetFixedExecutorService(String name, int poolSize) > It creates a fixed size thread pool with a custom thread factory that sets the thread name and a custom uncaught exception handler that logs the exception> It creates a new `ScheduledExecutorService` with a fixed pool size, and a `ThreadFactory` that creates threads with a name format of `name` and a `LuckyThreadFactory` that creates threads with a name format of `name`getFixedScheduledExecutorService(String name, int poolSize) > It creates a new `ScheduledExecutorService` with a fixed pool size, and a `ThreadFactory` that creates threads with a name format of `name` and a `LuckyThreadFactory` that creates threads with a name format of `name`Create a single threaded executor with a thread factory that creates threads with the given name and a custom uncaught exception handler.Create a single threaded scheduled executor with a custom thread factory that sets the thread name and uses LuckyThreadFactory to set the thread priority.Create a thread pool executor with an unlimited number of threads, and a thread factory that creates threads with the given name.Create a scheduled executor service with an unlimited number of threads, and allow the threads to time out.It creates a ForkJoinPool with a custom thread factory that renames the threads
-
Constructor Details
-
ExecutorUtils
public ExecutorUtils()
-
-
Method Details
-
getFixedExecutorService
> It creates a fixed size thread pool with a custom thread factory that sets the thread name and a custom uncaught exception handler that logs the exception- Parameters:
name- The name of the thread pool.- Returns:
- A fixed thread pool executor service.
-
getFixedExecutorService
> It creates a fixed size thread pool with a custom thread factory that sets the thread name and a custom uncaught exception handler that logs the exception- Parameters:
name- The name of the thread pool.poolSize- The size of the thread pool.- Returns:
- A fixed thread pool executor service.
-
getFixedScheduledExecutorService
> It creates a new `ScheduledExecutorService` with a fixed pool size, and a `ThreadFactory` that creates threads with a name format of `name` and a `LuckyThreadFactory` that creates threads with a name format of `name`- Parameters:
name- The name of the thread pool.- Returns:
- A ScheduledExecutorService
-
getFixedScheduledExecutorService
> It creates a new `ScheduledExecutorService` with a fixed pool size, and a `ThreadFactory` that creates threads with a name format of `name` and a `LuckyThreadFactory` that creates threads with a name format of `name`- Parameters:
name- The name of the thread pool.poolSize- The size of the thread pool.- Returns:
- A ScheduledExecutorService
-
getUnlimitedExecutorService
Create a thread pool executor with an unlimited number of threads, and a thread factory that creates threads with the given name.- Parameters:
name- The name of the thread pool.- Returns:
- An ExecutorService
-
getUnlimitedScheduledExecutorService
Create a scheduled executor service with an unlimited number of threads, and allow the threads to time out.- Parameters:
name- The name of the thread pool.- Returns:
- A ScheduledExecutorService
-
getSingleThreadedExecutor
Create a single threaded executor with a thread factory that creates threads with the given name and a custom uncaught exception handler.- Parameters:
name- The name of the thread pool.- Returns:
- A single threaded executor service.
-
getSingleThreadedScheduledExecutor
Create a single threaded scheduled executor with a custom thread factory that sets the thread name and uses LuckyThreadFactory to set the thread priority.- Parameters:
name- The name of the thread.- Returns:
- A single threaded scheduled executor service.
-
getWorkStealingExecutor
It creates a ForkJoinPool with a custom thread factory that renames the threads- Parameters:
name- The name of the thread pool.- Returns:
- A work stealing executor service.
-