Examples of ManagedConnectionPool


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);
     
      try
      {
         conn.createStatement().execute("blah");
        
      }catch(SQLException e)
      {
         //Normal
         assertFalse("Should not be StaleConnectionException", e instanceof StaleConnectionException);
         assertTrue("Connection error should be fatal", mcp.getConnectionDestroyedCount() > 0);
        
      }
     
      assertTrue("Exception should be falal", mcp.getConnectionDestroyedCount() > 0);     

   }
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.