当前位置: 首页>>代码示例>>Java>>正文


Java BoneCPConfig.setConnectionTimeoutInMs方法代码示例

本文整理汇总了Java中com.jolbox.bonecp.BoneCPConfig.setConnectionTimeoutInMs方法的典型用法代码示例。如果您正苦于以下问题:Java BoneCPConfig.setConnectionTimeoutInMs方法的具体用法?Java BoneCPConfig.setConnectionTimeoutInMs怎么用?Java BoneCPConfig.setConnectionTimeoutInMs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jolbox.bonecp.BoneCPConfig的用法示例。


在下文中一共展示了BoneCPConfig.setConnectionTimeoutInMs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConfig

import com.jolbox.bonecp.BoneCPConfig; //导入方法依赖的package包/类
private BoneCPConfig createConfig() {
  final BoneCPConfig config = new BoneCPConfig();
  config.setPartitionCount(1);
  config.setLazyInit(false);
  config.setMinConnectionsPerPartition(3);
  config.setMaxConnectionsPerPartition(3);
  config.setDatasourceBean(new AbstractDataSource() {

    @Override
    public Connection getConnection() throws SQLException {
      return Mockito.mock(Connection.class);
    }

    @Override
    public Connection getConnection(String username, String password) throws SQLException {
      return getConnection();
    }
    
    public Logger getParentLogger() {
      return null;
    }
  });
  config.setConnectionTimeoutInMs(Timeout.standardTimeoutMillis());
  config.setConnectionHook(new BoneCPHack(config.getConnectionHook()));
  return config;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:27,代码来源:BoneCPHackTest.java

示例2: createConnectionPool

import com.jolbox.bonecp.BoneCPConfig; //导入方法依赖的package包/类
public static void createConnectionPool() {
BoneCPConfig config = new BoneCPConfig();
      config.setMaxConnectionsPerPartition(DatabaseConfiguration.getCpMaxConnections());
      config.setAcquireRetryAttempts(DatabaseConfiguration.getCpAcquireRetryAttempts());
      config.setAcquireRetryDelayInMs(DatabaseConfiguration.getCpAcquireRetryDelay());
      config.setConnectionTimeoutInMs(DatabaseConfiguration.getCpConnectionTimeout());
      config.setStatisticsEnabled(DatabaseConfiguration.isCpEnableStatistics());
      config.setDisableConnectionTracking(true); // set this to true to avoid bonecp closing connections erroniously
      
config.setJdbcUrl(jdbc_);
      config.setUsername(DatabaseConfiguration.getUsername());
      config.setPassword(DatabaseConfiguration.getPassword());
      config.setDefaultAutoCommit(DatabaseConfiguration.getCpDefaultAutoCommit());

      try {
          connectionPool_ = new BoneCP(config);
      }
      catch (Exception e) {
          connectionPool_ = null;
          logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));  
      }
  }
 
开发者ID:PearsonEducation,项目名称:StatsAgg,代码行数:23,代码来源:DatabaseConnections.java

示例3: configureBoneCp

import com.jolbox.bonecp.BoneCPConfig; //导入方法依赖的package包/类
private static void configureBoneCp(BoneCPConfig config) {
	config.setPartitionCount(3);
	config.setConnectionTimeoutInMs(500);
	config.setStatementsCacheSize(20);
	config.setResetConnectionOnClose(false);
	config.setCloseConnectionWatch(false);
	config.setDefaultAutoCommit(true);
	config.setDefaultReadOnly(true);
}
 
开发者ID:arnaudroger,项目名称:orm-benchmark,代码行数:10,代码来源:ConnectionHelper.java

示例4: setUp

import com.jolbox.bonecp.BoneCPConfig; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    reactor = new NioReactor();

    crusher = TcpCrusherBuilder.builder()
            .withReactor(reactor)
            .withBindAddress("127.0.0.1", CRUSHER_PORT)
            .withConnectAddress("127.0.0.1", DB_PORT)
            .buildAndOpen();

    hsqlServer = new Server();
    hsqlServer.setAddress("127.0.0.1");
    hsqlServer.setPort(DB_PORT);
    hsqlServer.setDaemon(true);
    hsqlServer.setErrWriter(new PrintWriter(System.err));
    hsqlServer.setLogWriter(new PrintWriter(System.out));
    hsqlServer.setNoSystemExit(true);
    hsqlServer.setDatabasePath(0, "mem:testdb");
    hsqlServer.setDatabaseName(0, "testdb");
    hsqlServer.start();

    Class.forName("org.hsqldb.jdbc.JDBCDriver");

    BoneCPConfig config = new BoneCPConfig();
    config.setJdbcUrl(String.format("jdbc:hsqldb:hsql://127.0.0.1:%d/testdb", CRUSHER_PORT));
    config.setUsername("sa");
    config.setPassword("");
    config.setInitSQL(SQL_CHECK);
    config.setConnectionTestStatement(SQL_CHECK);
    config.setAcquireIncrement(1);
    config.setAcquireRetryAttempts(1);
    config.setAcquireRetryDelayInMs(1000);
    config.setConnectionTimeoutInMs(1000);
    config.setQueryExecuteTimeLimitInMs(1000);
    config.setDefaultAutoCommit(false);
    config.setDefaultReadOnly(true);
    config.setDefaultTransactionIsolation("NONE");
    config.setPartitionCount(1);
    config.setMinConnectionsPerPartition(1);
    config.setMaxConnectionsPerPartition(1);
    config.setLazyInit(true);
    config.setDetectUnclosedStatements(true);

    connectionPool = new BoneCP(config);
}
 
开发者ID:NetCrusherOrg,项目名称:netcrusher-java,代码行数:46,代码来源:DbTest.java


注:本文中的com.jolbox.bonecp.BoneCPConfig.setConnectionTimeoutInMs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。