/** * Notification that a job has been added to the queue. Wake a worker, * creating a new worker if necessary. The provided job may be null. */ protected synchronized void jobQueued() { //if there is a sleeping thread, wake it up if (sleepingThreads > 0) { notify(); return; } //create a thread if all threads are busy if (busyThreads >= numThreads) { Worker worker = new Worker(this); worker.setDaemon(isDaemon); add(worker); if (JobManager.DEBUG) JobManager.debug("worker added to pool: " + worker); //$NON-NLS-1$ worker.start(); return; } }
/** * Notification that a job has been added to the queue. Wake a worker, * creating a new worker if necessary. The provided job may be null. */ protected synchronized void jobQueued() { //if there is a sleeping thread, wake it up if (sleepingThreads > 0) { notify(); return; } //create a thread if all threads are busy if (busyThreads >= numThreads) { Worker worker = new Worker(this); worker.setDaemon(isDaemon); add(worker); if (JobManager.DEBUG) JobManager.debug("worker added to pool: " + worker); //$NON-NLS-1$ worker.start(); return; } }
/** * Notification that a job has been added to the queue. Wake a worker, * creating a new worker if necessary. The provided job may be null. */ protected synchronized void jobQueued() { //if there is a sleeping thread, wake it up if (sleepingThreads > 0) { notify(); return; } //create a thread if all threads are busy if (busyThreads >= numThreads) { Worker worker = new Worker(this); worker.setDaemon(isDaemon); add(worker); if (JobManager.DEBUG) JobManager.debug("worker added to pool: " + worker); //$NON-NLS-1$ worker.start(); return; } }
/** * Notification that a job has been added to the queue. Wake a worker, * creating a new worker if necessary. The provided job may be null. */ protected synchronized void jobQueued() { //if there is a sleeping thread, wake it up if (sleepingThreads > 0) { notify(); return; } //create a thread if all threads are busy if (busyThreads >= numThreads) { Worker worker = new Worker(this); worker.setDaemon(isDaemon); add(worker); if (JobManager.DEBUG) JobManager.debug("worker added to pool: " + worker); //$NON-NLS-1$ worker.start(); return; } }