From: Ahmed A. <asa...@ya...> - 2017-01-10 16:53:44
|
Hi, - Please sent to user-list, not dev-list.- You must subscribe to the list before posting - Try to use 2.24 - Try to profile the application. - Provide your complete case (with URL). Ahmed ----- Forwarded Message ----- From: "htm...@li..." <htm...@li...> To: htm...@li... Sent: Tuesday, January 10, 2017 4:19 PM Subject: Auto-discard notification ----- Forwarded Message ----- The attached message has been automatically discarded.Hi, We have recently updated HTMLUnit from 2.15 to 2.23 after which we are facing memory and cpu utilization issues. Below is the code snippet for open and close connections for webclient. Please review and provide some feedback: openSession(){ WebClient _webClient = new WebClient(BrowserVersionFactory.getBrowserVersion(browserVersion)); _webClient.getOptions().setSSLClientCertificate(url.toURL(), new String(selfSignedCertificate), "JKS"); _webClient.getOptions().setUseInsecureSSL(true); _webClient.getOptions().setTimeout(Config.getTwbTimeout() * 1000); _webClient.getOptions().setCssEnabled(false); _webClient.getCookieManager().setCookiesEnabled(true); _cookieManager = _webClient.getCookieManager(); _cookieManager.setCookiesEnabled(true); _webClient.getOptions().setJavaScriptEnabled(true); _webClient.getOptions().setRedirectEnabled(true); _webClient.getOptions().setThrowExceptionOnScriptError(false); _webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); _webClient.setAjaxController(new NicelyResynchronizingAjaxController()); } closeSession(){ try{ if(_webClient != null){ List<WebWindow> windows = _webClient.getWebWindows(); for (WebWindow wd : windows) { wd.getJobManager().removeAllJobs(); } _webClient.getCookieManager().clearCookies(); _webClient.close(); } }catch (Exception e) { TPLog.writeLogMessage(Log.WARN, ERROR_LOG+command+e.getMessage(), e); } } |