Package com.mchange.v2.c3p0

Examples of com.mchange.v2.c3p0.PoolBackedDataSource


    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
       
        ComboPooledDataSource cpds = new ComboPooledDataSource();
View Full Code Here


    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
      }
  catch ( Exception e )
View Full Code Here

    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
       
        ComboPooledDataSource cpds = new ComboPooledDataSource();
View Full Code Here

    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
       
        ComboPooledDataSource cpds = new ComboPooledDataSource();
View Full Code Here

    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
       
    ComboPooledDataSource cpds = new ComboPooledDataSource();
View Full Code Here

    System.err.println("DriverManagerDataSource:");
    doTest( dmds );
   
    WrapperConnectionPoolDataSource wcpds = new WrapperConnectionPoolDataSource();
    wcpds.setNestedDataSource( dmds );
    PoolBackedDataSource pbds = new PoolBackedDataSource();
    pbds.setConnectionPoolDataSource( wcpds );
   
    System.err.println("PoolBackedDataSource:");
    doTest( pbds );
       
        ComboPooledDataSource cpds = new ComboPooledDataSource();
View Full Code Here

   public void testGetConnection() throws Exception
   {
      cf = new C3p0ConnectionFactory();
      cf.setConfig(config);
      cf.start();
      PooledDataSource internalDs = (PooledDataSource) cf.getDataSource();

      Connection c1 = cf.getConnection();
      Connection c2 = cf.getConnection();
      assertEquals("There should be two connections checked out", 2, internalDs.getNumBusyConnectionsDefaultUser());

      cf.close(c1);
      Thread.sleep(100);
      assertEquals("There should be one connection checked out", 1, internalDs.getNumBusyConnectionsDefaultUser());

      cf.close(c2);
      Thread.sleep(100);
      assertEquals("There should be no connections checked out", 0, internalDs.getNumBusyConnectionsDefaultUser());
   }
View Full Code Here

   public void testGetConnection() throws Exception
   {
      cf = new C3p0ConnectionFactory();
      cf.setConfig(config);
      cf.start();
      PooledDataSource internalDs = (PooledDataSource) cf.getDataSource();

      Connection c1 = cf.getConnection();
      Connection c2 = cf.getConnection();
      assertEquals("There should be two connections checked out", 2, internalDs.getNumBusyConnectionsDefaultUser());

      cf.close(c1);
      Thread.sleep(100);
      assertEquals("There should be one connection checked out", 1, internalDs.getNumBusyConnectionsDefaultUser());

      cf.close(c2);
      Thread.sleep(100);
      assertEquals("There should be no connections checked out", 0, internalDs.getNumBusyConnectionsDefaultUser());
   }
View Full Code Here

                ds = (DataSource) DatabaseConfig.getInstance().getPooledDataSource(connectionName);
            }

            // make sure it's a c3p0 PooledDataSource
            if (ds != null && (ds instanceof PooledDataSource)) {
                PooledDataSource pds = (PooledDataSource) ds;
                log.debug("displayDS for " + where + " -      num_connections: " + pds.getNumConnectionsDefaultUser());
                log.debug("displayDS for " + where + " - num_busy_connections: " + pds.getNumBusyConnectionsDefaultUser());
                log.debug("displayDS for " + where + " - num_idle_connections: " + pds.getNumIdleConnectionsDefaultUser());
            }
        } catch(Exception ex) {
            log.debug("displayDS for " + where + " - ERROR: " + ex.getMessage());
        }
    }
View Full Code Here

                    AbstractPoolBackedDataSource apbds = ((AbstractPoolBackedDataSource) pds);
                    apbds.setFactoryClassLocation( val );
                    ConnectionPoolDataSource checkDs1 = apbds.getConnectionPoolDataSource();
                    if (checkDs1 instanceof WrapperConnectionPoolDataSource)
                    {
                        WrapperConnectionPoolDataSource wcheckDs1 = (WrapperConnectionPoolDataSource) checkDs1;
                        wcheckDs1.setFactoryClassLocation( val );
                        DataSource checkDs2 = wcheckDs1.getNestedDataSource();
                        if (checkDs2 instanceof DriverManagerDataSource)
                            ((DriverManagerDataSource) checkDs2).setFactoryClassLocation( val );
                    }
                    return;
                }
View Full Code Here

TOP

Related Classes of com.mchange.v2.c3p0.PoolBackedDataSource

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.