Examples of borrowObject()


Examples of org.apache.commons.pool.ObjectPool.borrowObject()

            }
        );

        Object[] obj = new Object[10];
        for(int i=0;i<10;i++) {
            obj[i] = pool.borrowObject();
        }
        for(int i=0;i<10;i++) {
            pool.returnObject(obj[i]);
        }
        assertEquals(3,pool.getNumIdle());
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

    public void testIdleCap() throws Exception {
        ObjectPool pool = makeEmptyPool(8);
        Object[] active = new Object[100];
        for(int i=0;i<100;i++) {
            active[i] = pool.borrowObject();
        }
        assertEquals(100,pool.getNumActive());
        assertEquals(0,pool.getNumIdle());
        for(int i=0;i<100;i++) {
            pool.returnObject(active[i]);
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

        }
        for(int j=0;j<3;j++) {
            Integer[] borrowed = new Integer[10];
            BitSet found = new BitSet();
            for(int i=0;i<10;i++) {
                borrowed[i] = (Integer)(pool.borrowObject());
                assertNotNull(borrowed);
                assertTrue(!found.get(borrowed[i].intValue()));
                found.set(borrowed[i].intValue());
            }
            for(int i=0;i<10;i++) {
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

            }
            for(int i=0;i<10;i++) {
                pool.returnObject(borrowed[i]);
            }
        }
        pool.invalidateObject(pool.borrowObject());
        pool.invalidateObject(pool.borrowObject());
        pool.clear();       
    }
   
    /**
 
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

            for(int i=0;i<10;i++) {
                pool.returnObject(borrowed[i]);
            }
        }
        pool.invalidateObject(pool.borrowObject());
        pool.invalidateObject(pool.borrowObject());
        pool.clear();       
    }
   
    /**
     * @deprecated - to be removed in pool 2.0
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

     * @deprecated - to be removed in pool 2.0
     */
    public void testBorrowFromEmptyPoolWithNullFactory() throws Exception {
        ObjectPool pool = new StackObjectPool();
        try {
            pool.borrowObject();
            fail("Expected NoSuchElementException");
        } catch(NoSuchElementException e) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

     * @deprecated - to be removed in pool 2.0
     */
    public void testSetFactory() throws Exception {
        ObjectPool pool = new StackObjectPool();
        try {
            pool.borrowObject();
            fail("Expected NoSuchElementException");
        } catch(NoSuchElementException e) {
            // expected
        }
        pool.setFactory(new SimpleFactory());
View Full Code Here

Examples of org.apache.commons.pool.ObjectPool.borrowObject()

            fail("Expected NoSuchElementException");
        } catch(NoSuchElementException e) {
            // expected
        }
        pool.setFactory(new SimpleFactory());
        Object obj = pool.borrowObject();
        assertNotNull(obj);
        pool.returnObject(obj);
    }

    /**
 
View Full Code Here

Examples of org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject()

            PerformanceTest test = new PerformanceTest() {

                @Override
                public void doOperation(int id) throws Exception {
                    Integer key = id % numKeys;
                    String s = (String) pool.borrowObject(key);
                    pool.returnObject(key, s);
                }
            };
            test.run(numRequests, numThreads);
            test.printStats();
View Full Code Here

Examples of org.apache.commons.pool.impl.GenericObjectPool.borrowObject()

  {
    ScriptingContainer container = null;
    try
    {
      GenericObjectPool pool = (GenericObjectPool) message.getSession().getServletContext().getAttribute(Attributes.POOL);
      container = (ScriptingContainer) pool.borrowObject();
            long beginTime = System.currentTimeMillis();
      try
      {
        Object app = container.runScriptlet("Sipatra::Application::new");
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.