@Override public void close() throws IOException { httpClient.close(); }
@Override public synchronized void close() throws java.io.IOException { if (httpClient != null) httpClient.close(); }
@Override public synchronized void close() throws java.io.IOException { if (httpClient != null) httpClient.close(); }
public void close() throws IOException { if (debugLeaks) openFiles.remove(location); if (session != null) { session.close(); session = null; } }
public void close() throws IOException { if (fileCache != null) { fileCache.release(this); return; } if (debugLeaks) openFiles.remove(location); if (session != null) { session.close(); session = null; } }
static protected synchronized void kill() { if(sessionList != null) { for(HTTPSession session : sessionList) { session.close(); } sessionList.clear(); connmgr.close(); } }
public void close() { try { if(allowSessions && hasSession) { openConnection(urlString + ".close", new Command() { public void process(InputStream is) throws IOException { captureStream(is); } }); } if(_session != null) _session.close(); } catch (Throwable t) { // ignore } }
static protected synchronized void kill() { if(sessionList != null) { for(HTTPSession session : sessionList) { session.close(); } sessionList.clear(); // Rebuild the connection manager connmgr.shutdown(); connmgr = new PoolingClientConnectionManager(); setGlobalThreadCount(DFALTTHREADCOUNT); } }
if (session != null) session.close(); throw ioe;
/** * Calling close will force the method to close, and will * force any open stream to terminate. If the session is local, * Then that too will be closed. */ public synchronized void close() { if(closed) return; // multiple calls ok closed = true; // mark as closed to prevent recursive calls if(methodstream != null) { try { methodstream.close(); } catch (IOException ioe) {/*failure is ok*/} ; methodstream = null; } if(this.request != null) { this.request.releaseConnection(); this.request = null; } if(session != null) { session.removeMethod(this); if(localsession) { session.close(); session = null; } } }
session.removeMethod(this); if(localsession) { session.close(); session = null;
@Test public void testCache() throws Exception { logger.info("*** Testing: Cache Invalidation"); for(AuthDataBasic data : basictests) { Result result = null; TestProvider provider = null; logger.info("*** URL: " + data.url); // Do each test with a bad password to cause cache invalidation provider = new TestProvider(data.user, BADPASSWORD); HTTPSession session = HTTPFactory.newSession(data.url); session.setCredentialsProvider(provider); result = invoke(session, data.url); report(result,provider.counter); Assert.assertTrue("Incorrect return code: " + result.status, result.status == HttpStatus.SC_UNAUTHORIZED || result.status == HttpStatus.SC_FORBIDDEN); Assert.assertTrue("Credentials provider called: " + provider.counter, provider.counter == 1); // retry with correct password; // AuthCache should automatically clear bad one from cache. provider.setUserPwd(data.user, data.password); session.setCredentialsProvider(provider); result = invoke(session, data.url); report(result,provider.counter); Assert.assertTrue("Incorrect return code: " + result.status, check(result.status)); session.close(); } }
status = method.execute(); stream = (HTTPMethodStream) method.getResponseBodyAsStream(); session.close(); Assert.assertTrue(stream.isClosed()); Assert.assertTrue(method.isClosed());