WorkerThread wt = (WorkerThread)availWorkers.removeFirst(); busyWorkers.add(wt); wt.run(runnable); } else { WorkerThread wt = new WorkerThread(this, threadGroup, "WorkerThread-LastJob", prio, isMakeThreadsDaemons(), runnable); busyWorkers.add(wt); workers.add(wt); wt.start();
while(workerThreads.hasNext()) { WorkerThread wt = workerThreads.next(); wt.shutdown(); availWorkers.remove(wt); try { getLog().debug( "Waiting for thread " + wt.getName() + " to shut down"); WorkerThread wt = (WorkerThread) workerThreads.next(); try { wt.join(); workerThreads.remove(); } catch (InterruptedException _) {
if(getPriority() != tp.getThreadPriority()) { setPriority(tp.getThreadPriority());
if(getPriority() != tp.getThreadPriority()) { setPriority(tp.getThreadPriority());
if(getPriority() != tp.getThreadPriority()) { setPriority(tp.getThreadPriority());
WorkerThread wt = (WorkerThread)availWorkers.removeFirst(); busyWorkers.add(wt); wt.run(runnable); } else { WorkerThread wt = new WorkerThread(this, threadGroup, "WorkerThread-LastJob", prio, isMakeThreadsDaemons(), runnable); busyWorkers.add(wt); workers.add(wt); wt.start();
WorkerThread wt = (WorkerThread)availWorkers.removeFirst(); busyWorkers.add(wt); wt.run(runnable); } else { WorkerThread wt = new WorkerThread(this, threadGroup, "WorkerThread-LastJob", prio, isMakeThreadsDaemons(), runnable); busyWorkers.add(wt); workers.add(wt); wt.start();
while(workerThreads.hasNext()) { WorkerThread wt = (WorkerThread) workerThreads.next(); wt.start(); availWorkers.add(wt);
while(workerThreads.hasNext()) { WorkerThread wt = (WorkerThread) workerThreads.next(); wt.start(); availWorkers.add(wt);
/** * <p> * Create a worker thread, start it, execute the runnable and terminate * the thread (one time execution). * </p> */ WorkerThread(SimpleThreadPool tp, ThreadGroup threadGroup, String name, int prio, boolean isDaemon, Runnable runnable) { super(threadGroup, name); this.tp = tp; this.runnable = runnable; if(runnable != null) runOnce = true; setPriority(prio); setDaemon(isDaemon); }
protected List createWorkerThreads(int count) { workers = new LinkedList(); for (int i = 1; i<= count; ++i) { WorkerThread wt = new WorkerThread(this, threadGroup, getThreadNamePrefix() + "-" + i, getThreadPriority(), isMakeThreadsDaemons()); if (isThreadsInheritContextClassLoaderOfInitializingThread()) { wt.setContextClassLoader(Thread.currentThread() .getContextClassLoader()); } workers.add(wt); } return workers; }
protected List createWorkerThreads(int count) { workers = new LinkedList(); for (int i = 1; i<= count; ++i) { WorkerThread wt = new WorkerThread(this, threadGroup, getThreadNamePrefix() + "-" + i, getThreadPriority(), isMakeThreadsDaemons()); if (isThreadsInheritContextClassLoaderOfInitializingThread()) { wt.setContextClassLoader(Thread.currentThread() .getContextClassLoader()); } workers.add(wt); } return workers; }
/** * <p> * Create a worker thread, start it, execute the runnable and terminate * the thread (one time execution). * </p> */ WorkerThread(SimpleThreadPool tp, ThreadGroup threadGroup, String name, int prio, boolean isDaemon, Runnable runnable) { super(threadGroup, name); this.tp = tp; this.runnable = runnable; setPriority(prio); setDaemon(isDaemon); }
while(workerThreads.hasNext()) { WorkerThread wt = workerThreads.next(); wt.shutdown(); availWorkers.remove(wt); try { getLog().debug( "Waiting for thread " + wt.getName() + " to shut down"); WorkerThread wt = (WorkerThread) workerThreads.next(); try { wt.join(); workerThreads.remove(); } catch (InterruptedException _) {
if(getPriority() != tp.getThreadPriority()) { setPriority(tp.getThreadPriority());
while(workerThreads.hasNext()) { WorkerThread wt = workerThreads.next(); wt.start(); availWorkers.add(wt);
while(workerThreads.hasNext()) { WorkerThread wt = workerThreads.next(); wt.start(); availWorkers.add(wt);
WorkerThread wt = (WorkerThread)availWorkers.removeFirst(); busyWorkers.add(wt); wt.run(runnable); } else { WorkerThread wt = new WorkerThread(this, threadGroup, "WorkerThread-LastJob", prio, isMakeThreadsDaemons(), runnable); busyWorkers.add(wt); workers.add(wt); wt.start();