|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package us.codecraft.webmagic.downloader.selenium;
|
|
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.openqa.selenium.WebDriver;
|
|
|
|
|
import org.openqa.selenium.chrome.ChromeDriver;
|
|
|
|
|
|
|
|
|
@ -16,6 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
* Time: 下午1:41 <br>
|
|
|
|
|
*/
|
|
|
|
|
class WebDriverPool {
|
|
|
|
|
private Logger logger = Logger.getLogger(getClass());
|
|
|
|
|
|
|
|
|
|
private final static int DEFAULT_CAPACITY = 5;
|
|
|
|
|
|
|
|
|
@ -81,8 +83,8 @@ class WebDriverPool {
|
|
|
|
|
throw new IllegalStateException("Already closed!");
|
|
|
|
|
}
|
|
|
|
|
for (WebDriver webDriver : webDriverList) {
|
|
|
|
|
webDriver.close();
|
|
|
|
|
logger.info("Quit webDriver" + webDriver);
|
|
|
|
|
webDriver.quit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|