package com.sourcefellows.patterns.command;

public class CrawlCommand implements Runnable{

    private String url;
    private final WebCrawler webCrawler;

    public CrawlCommand(String siteToBeCrwawled, WebCrawler collector) {
        this.url = siteToBeCrwawled;
        this.webCrawler = collector;
    }

    @Override
    public void run() {
        webCrawler.crawl(this.url);
        try {
            Thread.sleep(300);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
