Package com.github.jpmsilva.jsystemd
Class ExecutorStatusProvider
java.lang.Object
com.github.jpmsilva.jsystemd.ExecutorStatusProvider
- All Implemented Interfaces:
StatusProvider
Implementation of
StatusProvider that provides information regarding a thread pool: the busy threads out of the threads in the pool, and
the tasks waiting for a thread, such as workers: 3/10 threads, 5 queued. For a ScheduledThreadPoolExecutor, the tasks waiting are those
scheduled to run, including the periodic ones between their runs, such as scheduler: 1/2 threads, 4 scheduled.
The thread pool can be supplied when the status is read, for thread pools that are created after this provider, such as those of Spring's task
executors: nothing is reported while the supplier returns null.
- Author:
- Joao Silva
-
Constructor Summary
ConstructorsConstructorDescriptionExecutorStatusProvider(String name, ThreadPoolExecutor executor) Create a new ExecutorStatusProvider for the given thread pool.ExecutorStatusProvider(String name, Supplier<? extends @Nullable ThreadPoolExecutor> executor) Create a new ExecutorStatusProvider for the thread pool given by the supplier, when the status is read. -
Method Summary
-
Constructor Details
-
ExecutorStatusProvider
Create a new ExecutorStatusProvider for the given thread pool.- Parameters:
name- the name of the thread pool, shown in the statusexecutor- the thread pool
-
ExecutorStatusProvider
public ExecutorStatusProvider(String name, Supplier<? extends @Nullable ThreadPoolExecutor> executor) Create a new ExecutorStatusProvider for the thread pool given by the supplier, when the status is read.- Parameters:
name- the name of the thread pool, shown in the statusexecutor- the supplier of the thread pool, which returnsnullwhile there is none
-
-
Method Details
-
status
Description copied from interface:StatusProviderExposes status information to send to systemd.- Specified by:
statusin interfaceStatusProvider- Returns:
- the string message to add to the service status
-