Author: lewismc Date: Wed Sep 23 16:55:38 2015 New Revision: 1704896 URL: http://svn.apache.org/viewvc?rev=1704896&view=rev Log: NUTCH-2111 Delete temporary files location for selenium tmp files after driver quits
Modified: nutch/trunk/CHANGES.txt nutch/trunk/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java Modified: nutch/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/nutch/trunk/CHANGES.txt?rev=1704896&r1=1704895&r2=1704896&view=diff ============================================================================== --- nutch/trunk/CHANGES.txt (original) +++ nutch/trunk/CHANGES.txt Wed Sep 23 16:55:38 2015 @@ -2,6 +2,8 @@ Nutch Change Log Nutch Current Development 1.11-SNAPSHOT +* NUTCH-2111 Delete temporary files location for selenium tmp files after driver quits (Kim Whitehall via lewismc) + * NUTCH-2095 WARC exporter for the CommonCrawlDataDumper (jorgelbg) * NUTCH-2102 WARC Exporter (jnioche) Modified: nutch/trunk/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java URL: http://svn.apache.org/viewvc/nutch/trunk/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java?rev=1704896&r1=1704895&r2=1704896&view=diff ============================================================================== --- nutch/trunk/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java (original) +++ nutch/trunk/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java Wed Sep 23 16:55:38 2015 @@ -33,6 +33,7 @@ import org.openqa.selenium.remote.Desire import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.safari.SafariDriver; import org.openqa.selenium.support.ui.WebDriverWait; +import org.openqa.selenium.io.TemporaryFilesystem; import com.opera.core.systems.OperaDriver; @@ -96,6 +97,7 @@ public class HttpWebClient { capabilities.setBrowserName("firefox"); capabilities.setJavascriptEnabled(true); capabilities.setCapability("firefox_binary",seleniumGridBinary); + System.setProperty("webdriver.reap_profile", "false"); driver = new RemoteWebDriver(new URL(seleniumHubProtocol, seleniumHubHost, seleniumHubPort, seleniumHubPath), capabilities); break; default: @@ -131,6 +133,7 @@ public class HttpWebClient { if (driver != null) { try { driver.quit(); + TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles(); } catch (Exception e) { throw new RuntimeException(e); } @@ -161,6 +164,7 @@ public class HttpWebClient { // I'm sure this catch statement is a code smell ; borrowing it from lib-htmlunit } catch (Exception e) { + TemporaryFilesystem.getDefaultTmpFS().deleteTemporaryFiles(); throw new RuntimeException(e); } finally { cleanUpDriver(driver);