/** * Sets the idleConnectionTestPeriod. * * This sets the time (in seconds), for a connection to remain idle before sending * a test query to the DB. This is useful to prevent a DB from timing out connections * on its end. Do not use aggressive values here! * * * <p>Default: 240 min, set to 0 to disable * * @param idleConnectionTestPeriod to set */ public void setIdleConnectionTestPeriodInSeconds(long idleConnectionTestPeriod) { setIdleConnectionTestPeriod(idleConnectionTestPeriod, TimeUnit.SECONDS); }
/** * Sets the idleConnectionTestPeriod. * * This sets the time (in minutes), for a connection to remain idle before sending * a test query to the DB. This is useful to prevent a DB from timing out connections * on its end. Do not use aggressive values here! * * * <p>Default: 240 min, set to 0 to disable * * @param idleConnectionTestPeriod to set */ public void setIdleConnectionTestPeriodInMinutes(long idleConnectionTestPeriod) { // we use TimeUnit.SECONDS instead of TimeUnit.MINUTES because it's not supported // by JDK5 setIdleConnectionTestPeriod(idleConnectionTestPeriod*60, TimeUnit.SECONDS); }
/** * Sets the idleConnectionTestPeriod in minutes * * @deprecated Please use {@link #setIdleConnectionTestPeriodInMinutes(long)} or {@link #setIdleConnectionTestPeriod(long, TimeUnit)} instead * @param idleConnectionTestPeriod to set in minutes */ @Deprecated public void setIdleConnectionTestPeriod(long idleConnectionTestPeriod) { logger.warn("Please use setIdleConnectionTestPeriodInMinutes in place of setIdleConnectionTestPeriod. This method has been deprecated."); setIdleConnectionTestPeriod(idleConnectionTestPeriod*60, TimeUnit.SECONDS); }
dbConfig.setIdleMaxAge(config.getIdleMaxAge().getPeriod(), config.getIdleMaxAge().getUnit()); dbConfig.setMaxConnectionAge(config.getMaxConnectionAge().getPeriod(), config.getMaxConnectionAge().getUnit()); dbConfig.setIdleConnectionTestPeriod(config.getIdleConnectionTestPeriod().getPeriod(), config.getIdleConnectionTestPeriod().getUnit()); dbConfig.setPartitionCount(1); dbConfig.setDefaultTransactionIsolation("READ_COMMITTED");