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

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.core.throttle;
  2. /**
  3.  * Interface that will be implemented upon all classes that will act as a
  4.  * throttle.  This type of component will control the load put upon a
  5.  * certain host, thus keeping the spider threads from doing too much
  6.  * requests in a too short time frame.
  7.  *
  8.  * <p>
  9.  * If no throttling would be used, our JSpider engine could cause a DOS
  10.  * attack on the target machine.
  11.  * </p>
  12.  * <p>
  13.  * Please remark that the throttling is done on a per-host base, not on
  14.  * a per-site base.  This means that if you have 2 sites, eg:
  15.  * <ol>
  16.  *   <li>http://localhost:80/</li>
  17.  *   <li>http://localhost:8080/</li>
  18.  * <ol>
  19.  * and you would allow 2 hits/second by configuring a throttle, these
  20.  * sites would _together_ get 2 hits/second at max, because they're
  21.  * on the same machine.
  22.  * Two sites on a difference hostname are throttled independently of
  23.  * each other.
  24.  * </p>
  25.  *
  26.  * $Id: Throttle.java,v 1.1 2002/11/20 17:26:09 vanrogu Exp $
  27.  *
  28.  * @author G黱ther Van Roey
  29.  */
  30. public interface Throttle {
  31.     /**
  32.      * Method to which a spider thread will be directed before making
  33.      * a call on a webserver.  This allows the throttle component
  34.      * implementation to hold the thread under control.
  35.      */
  36.     public void throttle();
  37. }