Package org.apache.commons.pool.impl

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


        CPDSConnectionFactory factory =
            new CPDSConnectionFactory(cpds, pool, null, "username", "password");
       
        // Checkout a pair of connections
        PooledConnection pcon1 =
            ((PooledConnectionAndInfo) pool.borrowObject())
                .getPooledConnection();
        Connection con1 = pcon1.getConnection();
        PooledConnection pcon2 =
            ((PooledConnectionAndInfo) pool.borrowObject())
                .getPooledConnection();
View Full Code Here

        PooledConnection pcon1 =
            ((PooledConnectionAndInfo) pool.borrowObject())
                .getPooledConnection();
        Connection con1 = pcon1.getConnection();
        PooledConnection pcon2 =
            ((PooledConnectionAndInfo) pool.borrowObject())
                .getPooledConnection();
        assertEquals(2, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
       
        // Verify listening
View Full Code Here

        assertEquals(1, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
       
        // Ask for another connection
        PooledConnection pcon3 =
            ((PooledConnectionAndInfo) pool.borrowObject())
                .getPooledConnection();
        assertTrue(!pcon3.equals(pcon1)); // better not get baddie back
        assertTrue(!pc.getListeners().contains(factory)); // verify cleanup
        assertEquals(2, pool.getNumActive());
        assertEquals(0, pool.getNumIdle());
View Full Code Here

      // lazy initialization of pool
      PoolableObjectFactory factory = new SolbaseHTableInterfaceFactory(config, tableName);
      pool = new GenericObjectPool(factory, this.maxActive);
    }
    try {
      HTableInterface table = (HTableInterface) pool.borrowObject();
      return table;
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
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.