Examples of ManagedConnectionPool


Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      }
   }

   public void testTrackConnectionByTx() throws Exception
   {
      ManagedConnectionPool mcp = getOnePool(2);
      BaseConnectionManager2 cm = getTxTrackCM(mcp);
      try
      {
         tm.begin();
         TestConnection c1 = allocate(cm, cri1);
         TestManagedConnection mc1 = c1.getMC();
         c1.close();
         TestConnection c2 = allocate(cm, cri1);
         TestManagedConnection mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should be equal in same transaction", mc1.equals(mc2));
         Transaction tx1 = tm.suspend();
         tm.begin();
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should not be equal in a different transaction", mc1.equals(mc2) == false);
         tm.commit();
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should not be equal outside a transaction", mc1.equals(mc2) == false);
         tm.resume(tx1);
         c2 = allocate(cm, cri1);
         mc2 = c2.getMC();
         c2.close();
         assertTrue("Connections should still be equal in same transaction", mc1.equals(mc2));
         tm.commit();
         assertTrue("All connections should be recycled", mcp.getAvailableConnectionCount() == 2);
      }
      finally
      {
         shutdown(mcp);
      }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      }
   }

   public void testTrackConnectionByTxAndCRI() throws Exception
   {
      ManagedConnectionPool mcp = getPoolByCri(2);
      BaseConnectionManager2 cm = getTxTrackCM(mcp);
      try
      {
         tm.begin();
         TestConnection c1 = allocate(cm, cri1);
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

    * @exception Exception Thrown if an error occurs
    */
   private BaseConnectionManager2 getCM(InternalManagedConnectionPool.PoolParams pp) throws Exception
   {
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, log);
      BaseConnectionManager2 cm = new NoTxConnectionManager(ccm, poolingStrategy);
      poolingStrategy.setConnectionListenerFactory(cm);
     
      if (pp.prefill)
      {
         BasePool bp = (BasePool)poolingStrategy;
         bp.prefill(null, null, false);
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

    * Shutdown the BaseConnectionManager2
    * @param cm The instance
    */
   private void shutdown(BaseConnectionManager2 cm)
   {
      ManagedConnectionPool pool = cm.getPoolingStrategy();
      pool.shutdown();
   }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      pp.idleTimeout = 500;

      BaseConnectionManager2 cm = getCM(pp);
      try
      {
         ManagedConnectionPool ps = cm.getPoolingStrategy();

         assertTrue("0: Initial check", ps.getConnectionCount() == 0);

         // Get a connection
         ConnectionListener cl = cm.getManagedConnection(null, null);
         assertTrue("1: Got a null connection!", cl.getManagedConnection() != null);
         assertTrue("1: One connection", ps.getConnectionCount() == 1);

         // Get another connection
         ConnectionListener cl2 = cm.getManagedConnection(null, null);
         assertTrue("2: Got a null connection!", cl2.getManagedConnection() != null);
         assertTrue("2: Two connections", ps.getConnectionCount() == 2);

         // Return first
         cm.returnManagedConnection(cl, true);
         assertTrue("3: One connection", ps.getConnectionCount() == 1);

         // Return second
         cm.returnManagedConnection(cl2, true);
         assertTrue("4: Zero connections", ps.getConnectionCount() == 0);
      }
      finally
      {
         shutdown(cm);
      }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      InternalManagedConnectionPool.PoolParams pp = new InternalManagedConnectionPool.PoolParams();
      pp.minSize = 0;
      pp.maxSize = poolSize;
      pp.blockingTimeout = 100;
      pp.idleTimeout = 500;
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, poolLog);
      cri = new TestConnectionRequestInfo();
      cm = new TxConnectionManager(ccm, poolingStrategy, tm);
      cm.setLocalTransactions(true);
      poolingStrategy.setConnectionListenerFactory(cm);
   }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      InternalManagedConnectionPool.PoolParams pp = new InternalManagedConnectionPool.PoolParams();
      pp.minSize = 0;
      pp.maxSize = poolSize;
      pp.blockingTimeout = 100;
      pp.idleTimeout = 500;
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, poolLog);
      cri = new TestConnectionRequestInfo();
      cm = new TxConnectionManager(ccm, poolingStrategy, tm);
      cm.setLocalTransactions(false);
      cm.setInterleaving(true);
      poolingStrategy.setConnectionListenerFactory(cm);
   }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

   }

   private BaseConnectionManager2 getCM(InternalManagedConnectionPool.PoolParams pp, int ar, int arwm) throws Exception
   {
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = new JBossManagedConnectionPool.OnePool(mcf, pp, false, log);
      BaseConnectionManager2 cm = new NoTxConnectionManager(ccm, poolingStrategy);
      cm.setAllocationRetry(ar);
      cm.setAllocationRetryWaitMillis(arwm);
      poolingStrategy.setConnectionListenerFactory(cm);
     
      if (pp.prefill)
      {
         BasePool bp = (BasePool)poolingStrategy;
         bp.prefill(null, null, false);
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

   private BaseConnectionManager2 getCM(
      InternalManagedConnectionPool.PoolParams pp)
      throws Exception
   {
      ManagedConnectionFactory mcf = new TestManagedConnectionFactory();
      ManagedConnectionPool poolingStrategy = new TestPool(mcf, pp, false, log);
      BaseConnectionManager2 cm = new NoTxConnectionManager(ccm, poolingStrategy);
      poolingStrategy.setConnectionListenerFactory(cm);
      return cm;
   }
View Full Code Here

Examples of org.jboss.resource.connectionmanager.ManagedConnectionPool

      InternalManagedConnectionPool.PoolParams pp = new InternalManagedConnectionPool.PoolParams();
      pp.minSize = 1;
      pp.maxSize = 2;
      pp.blockingTimeout = 10000;

      ManagedConnectionPool mcp = new JBossManagedConnectionPool.OnePool(mcf, pp, false, log);
      NoTxConnectionManager noTxn = new NoTxConnectionManager(null, mcp);
      mcp.setConnectionListenerFactory(noTxn);
      Connection conn = (Connection)noTxn.allocateConnection(mcf, null);
      Object proxy = ((WrappedConnection)conn).getUnderlyingConnection();
      TestConnection uc = (TestConnection) Proxy.getInvocationHandler(proxy);
      uc.setFail(true);
     
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.