DispatcherThread.java
上传用户:qing5858
上传日期:2015-10-27
资源大小:6056k
文件大小:1k
源码类别:

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.core.threading;
  2. import net.javacoding.jspider.core.task.DispatcherTask;
  3. /**
  4.  *
  5.  * $Id: DispatcherThread.java,v 1.4 2003/02/02 15:30:21 vanrogu Exp $
  6.  *
  7.  * @author G黱ther Van Roey
  8.  */
  9. class DispatcherThread extends Thread {
  10.     protected DispatcherTask task;
  11.     protected WorkerThreadPool pool;
  12.     public DispatcherThread(ThreadGroup group, String name, WorkerThreadPool pool) {
  13.         super(group, name);
  14.         this.pool = pool;
  15.     }
  16.     public void assign(DispatcherTask task) {
  17.         this.task = task;
  18.         start();
  19.     }
  20.     public void run() {
  21.         synchronized (task) {
  22.             task.execute();
  23.             task.notify();
  24.         }
  25.     }
  26. }