/** Start the thread and wait for its actual startup. */ public synchronized void start() { running.set(true); thread.start(); wait(this, STARTUP_TIMEOUT); }
/** * Stop thread and waits for its graceful close. Please note that if {@link #STOP_TIMEOUT} exceeds this method does * not guarantee graceful thread close. * <p> * If thread is not alive, see {@link Thread#isAlive()}, this method does nothing. */ public synchronized void stop() { running.set(false); if(thread.isAlive()) { thread.interrupt(); wait(this, STOP_TIMEOUT); } }