Package com.mchange.v2.coalesce

Examples of com.mchange.v2.coalesce.WeakCcCoalescer


   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config, ClassLoader classLoader) throws CacheLoaderException {
      logFileOverride(classLoader);
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         log.errorInstantiatingJdbcDriver(config.getDriverClass(), e);
View Full Code Here


   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config, ClassLoader classLoader) throws CacheLoaderException {
      logFileOverride(classLoader);
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         /* Since c3p0 does not throw an exception when it fails to load a driver we attempt to do so here
          * Also, c3p0 does not allow specifying a custom classloader, so use c3p0's
          */
 
View Full Code Here

        toInt(ps.getProperty("maxPoolSize")), toInt(ps.getProperty("minPoolSize")), toInt(ps.getProperty("initialPoolSize")),
        toInt(ps.getProperty("maxIdleTime")),toInt(ps.getProperty("acquireIncrement")));
  }
 
  public boolean start() {
    dataSource = new ComboPooledDataSource();
    dataSource.setJdbcUrl(jdbcUrl);
    dataSource.setUser(user);
    dataSource.setPassword(password);
    try {dataSource.setDriverClass(driverClass);}
    catch (PropertyVetoException e) {dataSource = null; System.err.println("C3p0Plugin start error"); throw new RuntimeException(e);}
View Full Code Here

   private ComboPooledDataSource pooledDataSource;

   @Override
   public void start(ConnectionFactoryConfig config) throws CacheLoaderException {
      logFileOverride();
      pooledDataSource = new ComboPooledDataSource();
      pooledDataSource.setProperties(new Properties());
      try {
         pooledDataSource.setDriverClass(config.getDriverClass()); //loads the jdbc driver
      } catch (PropertyVetoException e) {
         String message = "Error while instatianting JDBC driver: '" + config.getDriverClass();
View Full Code Here

    }

    public DataSource createDataSource(Object databaseKey)
    {
        String databaseName = databaseKey.toString();
        ComboPooledDataSource dataSource = new ComboPooledDataSource();
        try
        {
            dataSource.setDriverClass(driver);
        }
        catch (PropertyVetoException e)
        {
            String msg = "Could not create data source with driver class '" + driver + "' for '" + databaseName + "'.";
            logger.error(msg, e);
            throw new DataSourceCreationException(msg, e);
        }
        dataSource.setJdbcUrl(url + databaseName);
        dataSource.setUser(username);
        dataSource.setPassword(password);
        return dataSource;
    }
View Full Code Here

    return new DatabaseData(dbDialect, datasource_default);
  }
 
  DatabaseData setupOracleDatabase(WorkflowRepository workflowRepository, LoggingStatisticCollector runtimeStatisticsCollector){

    ComboPooledDataSource datasource_oracle = new ComboPooledDataSource();
    try {
      datasource_oracle.setDriverClass("oracle.jdbc.OracleDriver");
      datasource_oracle.setJdbcUrl("jdbc:oracle:thin:COPPER2/COPPER2@localhost:1521:HM");
      datasource_oracle.setMinPoolSize(1);
      datasource_oracle.setMaxPoolSize(8);
      datasource_oracle.setConnectionTesterClassName("de.scoopgmbh.copper.db.utility.oracle.c3p0.OracleConnectionTester");
      datasource_oracle.setConnectionCustomizerClassName("de.scoopgmbh.copper.db.utility.oracle.c3p0.OracleConnectionCustomizer");
      datasource_oracle.setIdleConnectionTestPeriod(15);
    } catch (PropertyVetoException e1) {
      throw new RuntimeException(e1);
    }

    final OracleDialect oracleDialect = new OracleDialect();
View Full Code Here

//                     0,
//                     100 );

    //ds_unpooled = DataSources.unpooledDataSource(jdbc_url, username, password);
    //ds_pooled = DataSources.pooledDataSource( ds_unpooled );
      ds_unpooled = new DriverManagerDataSource();

       //DataSource ds_unpooled_screwy = C3P0TestUtils.unreliableCommitDataSource( ds_unpooled );
       //ds_pooled = DataSources.pooledDataSource( ds_unpooled_screwy );

//     PoolConfig pc = new PoolConfig();
View Full Code Here

      usage();
  */
 
  try
      {
    DriverManagerDataSource dmds = new DriverManagerDataSource();
    //dmds.setJdbcUrl( jdbcUrl );
    //dmds.setUser( username );
    //dmds.setPassword( password );
    try { drop( dmds ); }
    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

   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

TOP

Related Classes of com.mchange.v2.coalesce.WeakCcCoalescer

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.