| | |
| | | * Set this to stop the thread. |
| | | */ |
| | | private Boolean shutdown = false; |
| | | private final Object shutdown_lock = new Object(); |
| | | |
| | | |
| | | /** |
| | |
| | | TRACER.debugVerbose("Heartbeat thread sleeping for %d", sleepTime); |
| | | } |
| | | |
| | | synchronized (shutdown) |
| | | synchronized (shutdown_lock) |
| | | { |
| | | if (!shutdown) |
| | | { |
| | | shutdown.wait(sleepTime); |
| | | shutdown_lock.wait(sleepTime); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public void shutdown() |
| | | { |
| | | synchronized (shutdown) |
| | | synchronized (shutdown_lock) |
| | | { |
| | | shutdown.notifyAll(); |
| | | shutdown = true; |
| | | shutdown_lock.notifyAll(); |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("Going to notify Heartbeat thread."); |