/** * Get the global thread pool instance. * @return The global thread pool. */ public static synchronized IThreadPool getThreadPool(String name) { IThreadPool ret = (IThreadPool)threadpools.get(name); if(ret==null) { ret = createThreadPool(); threadpools.put(name, ret); // System.out.println("Created threadpool: "+name+" "+ret); } return ret; }
IThreadPool tp = ThreadPoolFactory.createThreadPool(); MyTask[] tasks = new MyTask[10]; MyMonitor[] monitors = new MyMonitor[tasks.length];
this.executor = new Executor(threadpool!=null? threadpool: ThreadPoolFactory.createThreadPool(), new IExecutable()
this.executor = new Executor(threadpool!=null? threadpool: ThreadPoolFactory.createThreadPool(), new IExecutable()
public static void main(String[] args) { double PRIORITY = 0.1; LoadManagingExecutionService service = new LoadManagingExecutionService( ThreadPoolFactory.createThreadPool()); service.execute(new TestExecutable(), PRIORITY); service.execute(new TestExecutable(), PRIORITY); service.execute(new TestExecutable(), PRIORITY); service.execute(new TestExecutable(), PRIORITY+0.3); service.execute(new TestExecutable(), PRIORITY+0.3); service.execute(new TestExecutable(), PRIORITY+0.3); service.execute(new TestExecutable(), PRIORITY+0.8); service.execute(new TestExecutable(), PRIORITY+0.8); }