Package org.apache.avalon.excalibur.pool

Examples of org.apache.avalon.excalibur.pool.Poolable


        pool.enableLogging( logger );

        assertEquals( "1) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "1) Pool Size", 0, pool.getSize() );

        Poolable p = pool.get();

        assertEquals( "2) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "2) Pool Size", 1, pool.getSize() );

        pool.put( p );
View Full Code Here


        pool.enableLogging( logger );

        assertEquals( "1) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "1) Pool Size", 0, pool.getSize() );

        Poolable p1 = pool.get();

        assertEquals( "2) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "2) Pool Size", 1, pool.getSize() );

        pool.put( p1 );

        assertEquals( "3) Pool Ready Size", 1, pool.getReadySize() );
        assertEquals( "3) Pool Size", 1, pool.getSize() );

        Poolable p2 = pool.get();

        assertEquals( "4) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "4) Pool Size", 1, pool.getSize() );

        assertEquals( "Pooled Object reuse check", p1, p2 );
View Full Code Here

        pool.enableLogging( logger );

        assertEquals( "1) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "1) Pool Size", 0, pool.getSize() );

        Poolable p1 = pool.get();

        assertEquals( "2) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "2) Pool Size", 1, pool.getSize() );

        Poolable p2 = pool.get();

        assertEquals( "3) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "3) Pool Size", 2, pool.getSize() );

        pool.put( p1 );
View Full Code Here

        ClassInstanceObjectFactory factory =
            new ClassInstanceObjectFactory( FailingPoolableTestObject.class, logger );
        ResourceLimitingPool pool = new ResourceLimitingPool( factory, 3, true, true, 5000, 0 );

        pool.enableLogging( logger );
        Poolable p1;
       
        assertEquals( "1) Pool Ready Size", 0, pool.getReadySize() );
        assertEquals( "1) Pool Size", 0, pool.getSize() );
       
        try
View Full Code Here

        // The timing of this test makes it so the pool should grow to 4 elements
        assertEquals( "1) Pool Ready Size", 3, m_pool.getReadySize() );
        assertEquals( "1) Pool Size", 3, m_pool.getSize() );

        // Make sure that each of the objects are uniqe by checking them all back out.
        Poolable p1 = m_pool.get();
        Poolable p2 = m_pool.get();
        Poolable p3 = m_pool.get();

        assertEquals( "2) Pool Ready Size", 0, m_pool.getReadySize() );
        assertEquals( "2) Pool Size", 3, m_pool.getSize() );

        assertTrue( "p1 != p2", p1 != p2 );
View Full Code Here

    /*---------------------------------------------------------------
     * TestCases
     *-------------------------------------------------------------*/
    public void testGetPut() throws Exception
    {
        Poolable p;
        try
        {
            p = m_pool.get();
        }
        catch( Exception e )
View Full Code Here

    /*---------------------------------------------------------------
     * TestCases
     *-------------------------------------------------------------*/
    public void testGetPut() throws Exception
    {
        Poolable p = m_pool.get();
        try
        {
            Thread.sleep( 33 );
        }
        catch( InterruptedException e )
View Full Code Here

        // The timing of this test makes it so the pool should grow to 4 elements
        assertEquals( "1) Pool Ready Size", 3, m_pool.getReadySize() );
        assertEquals( "1) Pool Size", 3, m_pool.getSize() );

        // Make sure that each of the objects are uniqe by checking them all back out.
        Poolable p1 = m_pool.get();
        Poolable p2 = m_pool.get();
        Poolable p3 = m_pool.get();

        assertEquals( "2) Pool Ready Size", 0, m_pool.getReadySize() );
        assertEquals( "2) Pool Size", 3, m_pool.getSize() );

        assertTrue( "p1 != p2", p1 != p2 );
View Full Code Here

    /*---------------------------------------------------------------
     * TestCases
     *-------------------------------------------------------------*/
    public void testGetPut() throws Exception
    {
        Poolable p = m_pool.get();

        try
        {
            Thread.sleep( 33 );
        }
View Full Code Here

        // The timing of this test makes it so the pool should grow to 4 elements
        assertEquals( "1) Pool Ready Size", 3, m_pool.getReadySize() );
        assertEquals( "1) Pool Size", 3, m_pool.getSize() );

        // Make sure that each of the objects are uniqe by checking them all back out.
        Poolable p1 = m_pool.get();
        Poolable p2 = m_pool.get();
        Poolable p3 = m_pool.get();

        assertEquals( "2) Pool Ready Size", 0, m_pool.getReadySize() );
        assertEquals( "2) Pool Size", 3, m_pool.getSize() );

        assertTrue( "p1 != p2", p1 != p2 );
View Full Code Here

TOP

Related Classes of org.apache.avalon.excalibur.pool.Poolable

Copyright © 2018 www.massapicom. 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.