/** * Wait for this watchable to finish */ public void waitForFinish() { synchronized (statusLock) { while (!isFinished() && getStatus() != Watchable.STOPPED) { try { statusLock.wait(); } catch (InterruptedException ex) { // ignore } } } }
/** * Wait for this watchable to finish */ public void waitForFinish() { synchronized (statusLock) { while (!isFinished() && getStatus() != Watchable.STOPPED) { try { statusLock.wait(); } catch (InterruptedException ex) { // ignore } } } }
/** * Wait for this watchable to finish */ public void waitForFinish() { synchronized (statusLock) { while (!isFinished() && getStatus() != Watchable.STOPPED) { try { statusLock.wait(); } catch (InterruptedException ex) { // ignore } } } }
/** * Start executing this watchable * * @param synchronous if true, run in this thread */ protected synchronized void execute(boolean synchronous) { // see if we're already running if (thread != null) { // we're already running. Make sure we wake up on any change. synchronized (statusLock) { statusLock.notifyAll(); } return; } else if (isFinished()) { // we're all finished return; } // we'return not running. Start up if (synchronous) { thread = Thread.currentThread(); run(); } else { thread = new Thread(this); thread.setName(getClass().getName()); thread.start(); } }
/** * Start executing this watchable * * @param synchronous if true, run in this thread */ protected synchronized void execute(boolean synchronous) { // see if we're already running if (thread != null) { // we're already running. Make sure we wake up on any change. synchronized (statusLock) { statusLock.notifyAll(); } return; } else if (isFinished()) { // we're all finished return; } // we'return not running. Start up if (synchronous) { thread = Thread.currentThread(); run(); } else { thread = new Thread(this); thread.setName(getClass().getName()); thread.start(); } }
/** * Start executing this watchable * * @param synchronous if true, run in this thread */ protected synchronized void execute(boolean synchronous) { // see if we're already running if (thread != null) { // we're already running. Make sure we wake up on any change. synchronized (statusLock) { statusLock.notifyAll(); } return; } else if (isFinished()) { // we're all finished return; } // we'return not running. Start up if (synchronous) { thread = Thread.currentThread(); run(); } else { thread = new Thread(this); thread.setName(getClass().getName()); thread.start(); } }
while (!isFinished() && getStatus() != Watchable.STOPPED) { if (isExecutable()) {
while (!isFinished() && getStatus() != Watchable.STOPPED) { if (isExecutable()) {
while (!isFinished() && getStatus() != Watchable.STOPPED) { if (isExecutable()) {