/** * 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(); } }