?? spider.java
字號:
/*
* *****************************************************
* Copyright (c) 2005 IIM Lab. All Rights Reserved.
* Created by xuehao at 2005-10-12
* Contact: zxuehao@mail.ustc.edu.cn
* *****************************************************
*/
package org.indigo.spider;
import org.indigo.commands.Command;
/**
* 實現了Runnable接口,此類可以以參數的形式傳遞給ThreadPool類的execute()方法。
* 此類的主要作用是,每啟動一個任務就通過此類封裝為一個對象,
* 然后ThreadPool中就啟動一個線程,通過把此類的對象作為參數傳給ThreadPool可以完成采集任務。
* @author wbz
*
*/
public class Spider implements Runnable
{
private Command itsCommand;
public Spider( Command command )
{
itsCommand = command;
// System.out.println( "a spider is created now." );
}
/**
* 此線程的執行部分。
*/
public void run()
{
itsCommand.execute();
// System.out.println( "a spider will stop now." );
}
/**
* 啟動線程。
*
*/
public void start()
{
(new Thread(this)).start();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -