Package org.apache.http.impl.conn.tsccm

Examples of org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.releaseConnection()


        mgr.shutdown();

        // First release the connection. If the manager keeps working
        // despite the shutdown, this will deblock the extra thread.
        // The release itself should turn into a no-op, without exception.
        mgr.releaseConnection(conn, -1, null);


        gct.join(10000);
        assertNull("thread should not have obtained connection",
                   gct.getConnection());
View Full Code Here


            fail("should have gotten a timeout");
        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
View Full Code Here

        Thread.sleep(100); // give the thread time to block


        // releasing the connection for route1 should deblock thread1
        // the other thread gets a timeout
        mgr.releaseConnection(conn, -1, null);

        gct1.join(10000);
        gct2.join(10000);

        assertNotNull("thread 1 should have gotten a connection",
View Full Code Here

            fail("should have gotten a timeout");
        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
View Full Code Here

            fail("should have gotten a timeout");
        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
View Full Code Here

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
    }
   
    public void testReleaseOnAbort() throws Exception {
View Full Code Here

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
    }

    public void testReleaseOnIOException() throws Exception {
View Full Code Here

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
    }
   
}
View Full Code Here

            // expected
        }

        // release connection without marking for re-use
        // expect the next connection obtained to be closed
        mgr.releaseConnection(conn, -1, null);
        conn = getConnection(mgr, route);
        Assert.assertFalse("connection should have been closed", conn.isOpen());

        // repeat the communication, no need to prepare the request again
        conn.open(route, httpContext, defaultParams);
View Full Code Here

        // ignore data, but it must be read

        // release connection after marking it for re-use
        // expect the next connection obtained to be open
        conn.markReusable();
        mgr.releaseConnection(conn, -1, null);
        conn = getConnection(mgr, route);
        Assert.assertTrue("connection should have been open", conn.isOpen());

        // repeat the communication, no need to prepare the request again
        httpContext.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.