webmagic icon indicating copy to clipboard operation
webmagic copied to clipboard

接口Scheduler中方法poll,是否是拼写错误?

Open stonesun opened this issue 12 years ago • 3 comments

源码

public interface Scheduler {

    /**
     * add a url to fetch
     *
     * @param request
     * @param task
     */
    public void push(Request request, Task task);

    /**
     * get an url to crawl
     *
     * @param task the task of spider
     * @return the url to crawl
     */
    public Request poll(Task task);

}

中,方法poll是拼写错误吗?是不是应该写作pull?正好对应的是push?

stonesun avatar Jun 19 '14 10:06 stonesun

的确是拼写错误^-^

On Jun 19, 2014, at 06:48 PM, stonesun [email protected] wrote:

源码 public interface Scheduler {

/**
  • add a url to fetch *

  • @param request

  • @param task */ public void push(Request request, Task task);

    /**

  • get an url to crawl *

  • @param task the task of spider

  • @return the url to crawl */ public Request poll(Task task);

} 中,方法poll是拼写错误吗?是不是应该写作pull?正好对应的是push? — Reply to this email directly or view it on GitHub.

jerry-zww avatar Jun 19 '14 13:06 jerry-zww

这里写作poll更合适 参考Queue interface

sebastien-ma avatar Jun 19 '14 14:06 sebastien-ma

根据@sebastian1118提供的线索,这里应该是poll没有错。

证据是Java中的 Interface java.util.Queue<E>,参见http://docs.oracle.com/javase/7/docs/api/java/util/Queue.html

长知识了。才疏学浅,见笑见笑。

stonesun avatar Jun 20 '14 02:06 stonesun