Package com.jolbox.bonecp

Examples of com.jolbox.bonecp.BoneCP



        config.setMinConnectionsPerPartition(getIntegerAttribute(virtualHost, "minConnectionsPerPartition", DEFAULT_MIN_CONNECTIONS_PER_PARTITION));
        config.setMaxConnectionsPerPartition(getIntegerAttribute(virtualHost, "maxConnectionsPerPartition", DEFAULT_MAX_CONNECTIONS_PER_PARTITION));
        config.setPartitionCount(getIntegerAttribute(virtualHost, "partitionCount",DEFAULT_PARTITION_COUNT));
        _connectionPool = new BoneCP(config);
    }
View Full Code Here


    }
  }

  @Override
  public void addMetrics(MetricTreeObject tree) {
    BoneCP pool = getPool();
    if (pool == null) {
      // TODO: Should we handle this properly??
      return;
    }

    Statistics stats = pool.getStatistics();

    MetricTreeObject subtree = tree.getSubtree(key);

    subtree.addInt("hitCount", stats.getCacheHits());
    subtree.addInt("missCount", stats.getCacheMiss());
View Full Code Here

                LOG.error("Failed to obtain connection", t);
                return false;
            }
        };
        bconfig.setConnectionHook(hook);
        connectionPool = new BoneCP(bconfig);
    }
View Full Code Here

      config.setAcquireRetryDelayInMs(
          Long.parseLong(properties.getProperty(DBRETRYDELAYKEY)));
      config.setLogStatementsEnabled(true);
      config.setPartitionCount(
          Integer.parseInt(properties.getProperty(DBPARTKEY)));
      connectionPool = new BoneCP(config);
    }
  }
View Full Code Here

     
      config.setMinConnectionsPerPartition(5);
    config.setMaxConnectionsPerPartition(20);
    config.setPartitionCount(1);
     
      pool = new BoneCP(config);
  }
View Full Code Here

    }

    @Override
    public DataSource pool(final String name, final DataSource ds, final Properties properties) {
        final BoneCPConfig config;
        final BoneCP pool;
        try {
            config = new BoneCPConfig(prefixedProps(properties));
            pool = new BoneCP(config);
        } catch (final Exception e) {
            throw new IllegalArgumentException(e);
        }
        return build(BoneCPDataSourceProvidedPool.class, new BoneCPDataSourceProvidedPool(pool), new Properties());
    }
View Full Code Here

    bcpConfig.setMaxConnectionsPerPartition(10);
    bcpConfig.setPartitionCount(1);

    try
    {
      connectionPool = new BoneCP(bcpConfig);
    }
    catch (SQLException e)
    {
      throw new ConfigBite("Could not create the ConnectionPool");
    }
View Full Code Here

    @Override
    public void setMaxPoolSize(int maxPoolSize) {
        getTargetDataSource().setMaxConnectionsPerPartition(maxPoolSize);
        //BoneCP doesn't reinitialize itself on pool size change
        BoneCP boneCP = ReflectionUtils.invoke(getTargetDataSource(), ReflectionUtils.getMethod(getTargetDataSource(), "getPool"));
        boneCP.close();
        ReflectionUtils.setFieldValue(getTargetDataSource(), "pool", null);
    }
View Full Code Here

        config.setMinConnectionsPerPartition(convertToIntWithDefault(MIN_CONNECTIONS_PER_PARTITION, providerAttributes, DEFAULT_MIN_CONNECTIONS_PER_PARTITION));
        config.setMaxConnectionsPerPartition(convertToIntWithDefault(MAX_CONNECTIONS_PER_PARTITION, providerAttributes, DEFAULT_MAX_CONNECTIONS_PER_PARTITION));
        config.setPartitionCount(convertToIntWithDefault(PARTITION_COUNT, providerAttributes, DEFAULT_PARTITION_COUNT));

        _connectionPool = new BoneCP(config);
    }
View Full Code Here

      boneConf.setPartitionCount(3);
      // 设置连接空闲时间(分钟)
      boneConf.setIdleMaxAge(40);
      // 每60秒检查所有连接池中的空闲连接
      boneConf.setIdleConnectionTestPeriod(60);
      boneCp = new BoneCP(boneConf);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of com.jolbox.bonecp.BoneCP

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.