private void startCrawlThread(ICrawler cw) { RunnableCrawler rc = null; synchronized (runnables) { rc = runnables.get(cw); } Thread t = new Thread(rc, "crawler-" + cw.toString()); synchronized (runningCrawlers) { runningCrawlers.put(cw.getType(), t); } t.start(); }
private void runCrawler(ICrawler cw) { if (stopped) { return; } Thread t = null; synchronized (runningCrawlers) { t = runningCrawlers.get(cw.getType()); } if (t == null || !t.isAlive()) { startCrawlThread(cw); } }