zyh.robot
Class Robot
java.lang.Object
|
+--zyh.robot.Robot
- public class Robot
- extends java.lang.Object
- implements java.lang.Runnable
A robot can parse the content of a URL and
extract all links, then parse those new URLs, recursively.
If you are behind a firewall, please read also
Let Java Applications Through Firewall
Constructor Summary |
Robot(long requestInterval,
URLManager urlManager,
ThreadPool threadPool,
java.net.InetAddress proxyInetAddress,
int proxyPort)
Creates a Robot object |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Robot
public Robot(long requestInterval,
URLManager urlManager,
ThreadPool threadPool,
java.net.InetAddress proxyInetAddress,
int proxyPort)
- Creates a Robot object
- Parameters:
requestInterval
- Requests 1 document per n milliseconds
Suggestion: Using 60000~300000 milliseconds to avoid the potential overload of the destination host
Warning: Using a smaller value for requestInterval only when you're exploring your own websiteurlManager
- The URL manager which decides on the visit policythreadPool
- The thread pool manager which manages the thread distributionproxyInetAddress
- the InetAddress of HTTP proxyproxyPort
- the port of HTTP proxy
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
isAlive
public final boolean isAlive()
isIdle
public final boolean isIdle()
stop
public void stop()
run
public void run()
- Specified by:
- run in interface java.lang.Runnable