public final class WatcherSingleton extends Object
The default watcher instance is created at application startup and is named according to the system property
slf4jtoys.watcher.name, which defaults to watcher. The default watcher cannot be reassigned at runtime.
This utility class provides two mechanisms for periodic execution:
ScheduledExecutorService-based executorTimer-based timerNote: Ensure proper lifecycle management when using this class to avoid resource leaks.
| Modifier and Type | Field and Description |
|---|---|
Watcher |
DEFAULT_WATCHER
The default watcher instance.
|
| Constructor and Description |
|---|
WatcherSingleton() |
| Modifier and Type | Method and Description |
|---|---|
void |
startDefaultWatcherExecutor()
Starts the executor that periodically invokes the default watcher to report system status.
|
void |
startDefaultWatcherTimer()
Starts the timer that periodically invokes the default watcher to report system status.
|
void |
stopDefaultWatcherExecutor()
Stops the executor that periodically invokes the default watcher periodically.
|
void |
stopDefaultWatcherTimer()
Stops the timer that periodically invokes the default watcher periodically.
|
public final Watcher DEFAULT_WATCHER
slf4jtoys.watcher.name, defaulting to watcher.public void startDefaultWatcherExecutor()
public void stopDefaultWatcherExecutor()
public void startDefaultWatcherTimer()
public void stopDefaultWatcherTimer()
Copyright © 2010–2025. All rights reserved.