List of usage examples for org.apache.commons.pool.impl GenericObjectPool WHEN_EXHAUSTED_BLOCK
byte WHEN_EXHAUSTED_BLOCK
To view the source code for org.apache.commons.pool.impl GenericObjectPool WHEN_EXHAUSTED_BLOCK.
Click Source Link
From source file:net.agmodel.metbroker.driver.impl.JmaMsmJp.java
/** * set up JDBC parameter.//from ww w . j a va 2s. c o m * This driver uses postgresql's JDBC driver. * (non-Javadoc) * @see net.agmodel.metbroker.driver.MetDriver#init(net.agmodel.metbroker.driver.DriverConfig) */ public void init(DriverConfig driverConfig) throws DriverException { logger.debug("initialize JMA MSM JP data source"); try { Class.forName("org.postgresql.Driver"); int maxActive = Integer.parseInt(driverConfig.getParam("maxactive")); int maxWait = Integer.parseInt(driverConfig.getParam("maxwait")); int maxIdle = Integer.parseInt(driverConfig.getParam("maxidle")); String user = driverConfig.getParam("user"); String password = driverConfig.getParam("password"); String host = driverConfig.getParam("host"); int port = Integer.parseInt(driverConfig.getParam("port")); String db = driverConfig.getParam("db"); ObjectPool connectionPool = new GenericObjectPool(null, maxActive, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, maxWait, maxIdle, false, false, 60000, 3, 10000, false); Properties p = new Properties(); p.put("user", user); p.put("password", password); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory( "jdbc:postgresql://" + host + ":" + port + "/" + db, p); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); dataSource = new PoolingDataSource(connectionPool); logger.debug("JMA MSM JP DataSource created"); } catch (Exception e) { e.printStackTrace(); throw new DriverException(e.getMessage()); } }
From source file:net.agmodel.metbroker.driver.impl.JmaGsmJp.java
/** * set up JDBC parameter.// ww w . j a va2s . com * This driver uses postgresql's JDBC driver. * * (non-Javadoc) * @see net.agmodel.metbroker.driver.MetDriver#init(net.agmodel.metbroker.driver.DriverConfig) */ public void init(DriverConfig driverConfig) throws DriverException { logger.debug("initialize JMA GSM JP data source"); try { Class.forName("org.postgresql.Driver"); int maxActive = Integer.parseInt(driverConfig.getParam("maxactive")); int maxWait = Integer.parseInt(driverConfig.getParam("maxwait")); int maxIdle = Integer.parseInt(driverConfig.getParam("maxidle")); String user = driverConfig.getParam("user"); String password = driverConfig.getParam("password"); String host = driverConfig.getParam("host"); int port = Integer.parseInt(driverConfig.getParam("port")); String db = driverConfig.getParam("db"); ObjectPool connectionPool = new GenericObjectPool(null, maxActive, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, maxWait, maxIdle, false, false, 60000, 3, 10000, false); Properties p = new Properties(); p.put("user", user); p.put("password", password); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory( "jdbc:postgresql://" + host + ":" + port + "/" + db, p); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); dataSource = new PoolingDataSource(connectionPool); logger.debug("JMA GSM JP DataSource created"); } catch (Exception e) { e.printStackTrace(); throw new DriverException(e.getMessage()); } }
From source file:net.agmodel.metbroker.driver.impl.JmaGsmGl.java
/** * <PRE>/* ww w. j av a 2s. co m*/ * set up JDBC parameter. * This driver uses postgresql's JDBC driver. * </PRE> * (non-Javadoc) * @see net.agmodel.metbroker.driver.MetDriver#init(net.agmodel.metbroker.driver.DriverConfig) */ public void init(DriverConfig driverConfig) throws DriverException { logger.debug("initialize JMA GSM GLobal data source"); try { Class.forName("org.postgresql.Driver"); int maxActive = Integer.parseInt(driverConfig.getParam("maxactive")); int maxWait = Integer.parseInt(driverConfig.getParam("maxwait")); int maxIdle = Integer.parseInt(driverConfig.getParam("maxidle")); String user = driverConfig.getParam("user"); String password = driverConfig.getParam("password"); String host = driverConfig.getParam("host"); int port = Integer.parseInt(driverConfig.getParam("port")); String db = driverConfig.getParam("db"); ObjectPool connectionPool = new GenericObjectPool(null, maxActive, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, maxWait, maxIdle, false, false, 60000, 3, 10000, false); Properties p = new Properties(); p.put("user", user); p.put("password", password); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory( "jdbc:postgresql://" + host + ":" + port + "/" + db, p); PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); dataSource = new PoolingDataSource(connectionPool); logger.debug("JMA GSM Global DataSource created"); } catch (Exception e) { e.printStackTrace(); throw new DriverException(e.getMessage()); } }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java
public void testWhenExhaustedBlock() throws Exception { pool.setMaxActive(1);//from w w w. j a v a 2 s.c o m pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK); pool.setMaxWait(10L); Object obj1 = pool.borrowObject(); assertNotNull(obj1); try { pool.borrowObject(); fail("Expected NoSuchElementException"); } catch (NoSuchElementException e) { // expected } pool.returnObject(obj1); pool.close(); }
From source file:de.hybris.platform.test.ThreadPoolTest.java
/** * CORE-66PLA-10816 Potential chance to fetch a PoolableThread with pending transaction from previous run * //from w w w . j a v a2 s . c o m * together with setting logger level for a log4j.logger.de.hybris.platform.util.threadpool=DEBUG prints out * information who/where started the stale transaction */ @Test public void testTransactionCleanUp() throws Exception { final Queue<Transaction> recordedTransactions = new ConcurrentLinkedQueue<Transaction>(); final boolean flagBefore = Config.getBoolean("transaction.monitor.begin", false); Config.setParameter("transaction.monitor.begin", "true"); ThreadPool pool = null; try { // create own pool since we don't want to mess up the system pool = new ThreadPool(Registry.getCurrentTenantNoFallback().getTenantID(), MAX_THREADS); final GenericObjectPool.Config config = new GenericObjectPool.Config(); config.maxActive = MAX_THREADS; config.maxIdle = 1; config.maxWait = -1; config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; config.testOnBorrow = true; config.testOnReturn = true; config.timeBetweenEvictionRunsMillis = 30 * 1000; // keep idle threads for at most 30 sec pool.setConfig(config); final int maxSize = pool.getMaxActive(); final int activeBefore = pool.getNumActive(); final List<NoClosingTransactionProcess> started = new ArrayList<NoClosingTransactionProcess>(maxSize); for (int i = activeBefore; i < maxSize; i++) { final PoolableThread poolableThread = pool.borrowThread(); final NoClosingTransactionProcess noClosingTransactionProcess = new NoClosingTransactionProcess(); started.add(noClosingTransactionProcess); poolableThread.execute(noClosingTransactionProcess); } Thread.sleep(1000); transacationStartingBarrier.await(); //await for all transacations to start //record all started transactions for (final NoClosingTransactionProcess singleStarted : started) { recordedTransactions.add(singleStarted.getStartedTransaction()); } finishedStaleTransactionLatch.await(180, TimeUnit.SECONDS); Thread.sleep(1000);//give them 1 second to finish final List<HasNoCurrentRunningTransactionProcess> ranAfter = new ArrayList<HasNoCurrentRunningTransactionProcess>( maxSize); Transaction recordedTransaction = recordedTransactions.poll(); do { final PoolableThread poolableThread = pool.borrowThread(); final HasNoCurrentRunningTransactionProcess hasNoCurrentRunningTransactionProcess = new HasNoCurrentRunningTransactionProcess( recordedTransaction); ranAfter.add(hasNoCurrentRunningTransactionProcess); poolableThread.execute(hasNoCurrentRunningTransactionProcess); recordedTransaction = recordedTransactions.poll(); } while (recordedTransaction != null); //still can borrow Assert.assertNotNull(pool.borrowThread()); Thread.sleep(1000); //verify if really Thread had a non started transaction on the enter for (final HasNoCurrentRunningTransactionProcess singleRanAfter : ranAfter) { if (singleRanAfter.getException() != null) { singleRanAfter.getException().printException(); Assert.fail("Some of the thread(s) captured not finshied transaction in the pool "); } } } finally { if (pool != null) { try { pool.close(); } catch (final Exception e) { // can't help it } } Config.setParameter("transaction.monitor.begin", BooleanUtils.toStringTrueFalse(flagBefore)); } }
From source file:com.tango.logstash.flume.redis.source.RedisSource.java
@Override protected void doConfigure(Context context) throws FlumeException { logger.info("Configuring"); host = context.getString(RedisSourceConfigurationConstant.HOST); Preconditions.checkState(StringUtils.isNotBlank(host), "host cannot be empty, please specify in configuration file"); port = context.getInteger(RedisSourceConfigurationConstant.PORT, Protocol.DEFAULT_PORT); timeout = context.getInteger(RedisSourceConfigurationConstant.TIMEOUT, Protocol.DEFAULT_TIMEOUT); database = context.getInteger(RedisSourceConfigurationConstant.DATABASE, Protocol.DEFAULT_DATABASE); password = context.getString(RedisSourceConfigurationConstant.PASSWORD); redisKey = context// ww w. j av a 2 s . c o m .getString(RedisSourceConfigurationConstant.KEY, RedisSourceConfigurationConstant.DEFAULT_KEY) .getBytes(); batchSize = context.getInteger(RedisSourceConfigurationConstant.BATCH_SIZE, RedisSourceConfigurationConstant.DEFAULT_BATCH_SIZE); String serializerClassName = context.getString(RedisSourceConfigurationConstant.SERIALIZER, RedisSourceConfigurationConstant.DEFAULT_SERIALIZER_CLASS_NAME); maxActive = context.getInteger(RedisSourceConfigurationConstant.REDIS_MAX_ACTIVE); maxIdle = context.getInteger(RedisSourceConfigurationConstant.REDIS_MAX_IDLE); minIdle = context.getInteger(RedisSourceConfigurationConstant.REDIS_MIN_IDLE); numTestsPerEvictionRun = context .getInteger(RedisSourceConfigurationConstant.REDIS_NUM_TESTS_PER_EVICTION_RUN); maxWait = context.getLong(RedisSourceConfigurationConstant.REDIS_MAX_WAIT); minEvictableIdleTimeMillis = context .getLong(RedisSourceConfigurationConstant.REDIS_MIN_EVICTABLE_IDLE_TIME_MILLIS); softMinEvictableIdleTimeMillis = context .getLong(RedisSourceConfigurationConstant.REDIS_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS); testOnBorrow = context.getBoolean(RedisSourceConfigurationConstant.REDIS_TEST_ON_BORROW); testOnReturn = context.getBoolean(RedisSourceConfigurationConstant.REDIS_TEST_ON_RETURN); testWhileIdle = context.getBoolean(RedisSourceConfigurationConstant.REDIS_TEST_WHILE_IDLE); timeBetweenEvictionRunsMillis = context .getLong(RedisSourceConfigurationConstant.REDIS_TIME_BETWEEN_EVICTION_RUNS_MILLIS); String whenExhaustedActionStr = context .getString(RedisSourceConfigurationConstant.REDIS_WHEN_EXHAUSTED_ACTION); if (StringUtils.isNotBlank(whenExhaustedActionStr) == true) { if (whenExhaustedActionStr.equalsIgnoreCase(WHEN_EXHAUSTED_BLOCK)) { whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; } else if (whenExhaustedActionStr.equalsIgnoreCase(WHEN_EXHAUSTED_FAIL)) { whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_FAIL; } else if (whenExhaustedActionStr.equalsIgnoreCase(WHEN_EXHAUSTED_GROW)) { whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW; } } Preconditions.checkState(batchSize > 0, RedisSourceConfigurationConstant.BATCH_SIZE + " parameter must be greater than 1"); try { /** * Instantiate serializer */ @SuppressWarnings("unchecked") Class<? extends Serializer> clazz = (Class<? extends Serializer>) Class.forName(serializerClassName); serializer = clazz.newInstance(); /** * Configure it */ Context serializerContext = new Context(); serializerContext.putAll(context.getSubProperties(RedisSourceConfigurationConstant.SERIALIZER_PREFIX)); serializer.configure(serializerContext); } catch (ClassNotFoundException e) { logger.error("Could not instantiate event serializer", e); Throwables.propagate(e); } catch (InstantiationException e) { logger.error("Could not instantiate event serializer", e); Throwables.propagate(e); } catch (IllegalAccessException e) { logger.error("Could not instantiate event serializer", e); Throwables.propagate(e); } if (sourceCounter == null) { sourceCounter = new SourceCounter(getName()); } }
From source file:com.janrain.redis.Redis.java
private Redis() { JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxActive(50);//from ww w. ja va 2s .com jedisPoolConfig.setTestWhileIdle(true); jedisPoolConfig.setTestOnReturn(true); jedisPoolConfig.setMaxWait(REDIS_MAX_WAIT_SECONDS * 1000l); jedisPoolConfig.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK); jedisPoolConfig.setMaxIdle(-1); jedisPoolConfig.setMinIdle(50); String redisServerConfig = System.getProperty(BackplaneSystemProps.REDIS_SERVER_PRIMARY); String redisServerPass = System.getProperty(BackplaneSystemProps.REDIS_SERVER_PRIMARY_PASSWORD); if (StringUtils.isEmpty(redisServerConfig)) { logger.error("cannot find configuration entry for " + BackplaneSystemProps.REDIS_SERVER_PRIMARY); System.exit(1); } String[] args = redisServerConfig.split(":"); int port = 6379; if (args.length == 2) { try { port = Integer.parseInt(args[1]); } catch (NumberFormatException e) { logger.error("port for Redis server is malformed: " + redisServerConfig); } } poolForWrites = new Pair<String, JedisPool>(args[0] + ":" + port, new JedisPool(jedisPoolConfig, args[0], port, Protocol.DEFAULT_TIMEOUT, redisServerPass)); redisServerConfig = System.getProperty(BackplaneSystemProps.REDIS_SERVER_READS); redisServerPass = System.getProperty(BackplaneSystemProps.REDIS_SERVER_READS_PASSWORD); if (StringUtils.isEmpty(redisServerConfig)) { logger.error("cannot find configuration entry for " + BackplaneSystemProps.REDIS_SERVER_READS); System.exit(1); } String[] readServers = redisServerConfig.split(","); for (int i = 0; i < readServers.length; i++) { args = readServers[i].split(":"); port = 6379; if (args.length == 2) { try { port = Integer.parseInt(args[1]); //currentRedisServerForReads[i] = args[0]; poolForReads .add(new Pair<String, JedisPool>(args[0] + ":" + port, new JedisPool(jedisPoolConfig, args[0], port, Protocol.DEFAULT_TIMEOUT, redisServerPass))); } catch (NumberFormatException e) { logger.error("invalid Redis server configuration: " + redisServerConfig); System.exit(1); } } } }
From source file:de.hybris.platform.jdbcwrapper.GenericObjectPoolTest.java
DummyPool createPool(final int minIdle, final int max) { final GenericObjectPool.Config poolCfg = new Config(); poolCfg.maxActive = max;/* ww w . j a v a 2s. c o m*/ poolCfg.maxIdle = max; poolCfg.minIdle = minIdle; poolCfg.timeBetweenEvictionRunsMillis = 1 * 1000; poolCfg.minEvictableIdleTimeMillis = 5 * 1000; poolCfg.testWhileIdle = true; poolCfg.numTestsPerEvictionRun = 1000; poolCfg.testOnBorrow = true; poolCfg.testOnReturn = true; poolCfg.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; poolCfg.maxWait = 2 * 1000; return new DummyPool(new ConnectionFactory(), poolCfg); }
From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericKeyedObjectPool.java
public void testSettersAndGetters() throws Exception { GenericKeyedObjectPool pool = new GenericKeyedObjectPool(); {/*w ww. j a va2s .c o m*/ pool.setFactory(new SimpleFactory()); } { pool.setMaxActive(123); assertEquals(123, pool.getMaxActive()); } { pool.setMaxIdle(12); assertEquals(12, pool.getMaxIdle()); } { pool.setMaxWait(1234L); assertEquals(1234L, pool.getMaxWait()); } { pool.setMinEvictableIdleTimeMillis(12345L); assertEquals(12345L, pool.getMinEvictableIdleTimeMillis()); } { pool.setNumTestsPerEvictionRun(11); assertEquals(11, pool.getNumTestsPerEvictionRun()); } { pool.setTestOnBorrow(true); assertTrue(pool.getTestOnBorrow()); pool.setTestOnBorrow(false); assertTrue(!pool.getTestOnBorrow()); } { pool.setTestOnReturn(true); assertTrue(pool.getTestOnReturn()); pool.setTestOnReturn(false); assertTrue(!pool.getTestOnReturn()); } { pool.setTestWhileIdle(true); assertTrue(pool.getTestWhileIdle()); pool.setTestWhileIdle(false); assertTrue(!pool.getTestWhileIdle()); } { pool.setTimeBetweenEvictionRunsMillis(11235L); assertEquals(11235L, pool.getTimeBetweenEvictionRunsMillis()); } { pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction()); pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL, pool.getWhenExhaustedAction()); pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW); assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction()); } }
From source file:com.verisign.epp.pool.EPPSystemSessionPool.java
/** * Initialize the pool using configuration values defined by * {@link com.verisign.epp.util.Environment} class. The * {@link com.verisign.epp.util.Environment} class and logging must * be initialized before calling this method. * /*from w w w. j ava 2 s. c o m*/ * @throws EPPSessionPoolException On error */ public void init() throws EPPSessionPoolException { // Get configuration settings for pool try { String theValue; // clientId this.clientId = this.getProperty("clientId"); if (this.clientId == null) { log.error("EPPSystemSessionPool.init(): clientId not defined"); throw new EPPSessionPoolException("clientId not defined"); } // password this.password = this.getProperty("password"); if (this.password == null) { log.error("EPPSystemSessionPool.init(): password not defined"); throw new EPPSessionPoolException("password not defined"); } // absoluteTimeout theValue = this.getProperty("absoluteTimeout"); if (theValue != null) this.absoluteTimeout = Long.parseLong(theValue); else this.absoluteTimeout = DEFAULT_ABSOLUTE_TIMEOUT; log.info("init(): absolute timeout = " + this.absoluteTimeout + " ms"); // idleTimeout theValue = this.getProperty("idleTimeout"); if (theValue != null) this.idleTimeout = Long.parseLong(theValue); else this.idleTimeout = DEFAULT_IDLE_TIMEOUT; log.info("init(): idle timeout = " + this.idleTimeout + " ms"); // poolableClassName theValue = this.getProperty("poolableClassName"); log.info("init(): poolable class name = " + theValue); try { this.factory = (EPPSessionPoolableFactory) Class.forName(theValue).newInstance(); } catch (Exception ex) { log.error("EPPSystemSessionPool.init(): Exception creating instance of class " + theValue + ": " + ex); throw new EPPSessionPoolException("Exception creating instance of class " + theValue + ": " + ex); } // serverName this.serverName = this.getProperty("serverName"); if (this.serverName == null) { log.error("EPPSystemSessionPool.init(): serverName not defined"); throw new EPPSessionPoolException("serverName not defined"); } log.info("init(): serverName = " + this.serverName); // serverPort theValue = this.getProperty("serverPort"); if (theValue != null) this.serverPort = new Integer(theValue); log.info("init(): serverPort = " + this.serverPort); // clientHost this.clientHost = this.getProperty("clientHost"); log.info("init(): clientHost = " + this.clientHost); // Ensure minEvictableIdleTimeMillis is disabled this.config.minEvictableIdleTimeMillis = 0; // maxIdle theValue = this.getProperty("maxIdle"); if (theValue != null) this.config.maxIdle = Integer.parseInt(theValue); else this.config.maxIdle = DEFAULT_MAX_IDLE; log.info("init(): max idle = " + this.config.maxIdle); // maxActive theValue = this.getProperty("maxActive"); if (theValue != null) this.config.maxActive = Integer.parseInt(theValue); else this.config.maxActive = DEFAULT_MAX_ACTIVE; log.info("init(): max active = " + this.config.maxActive); // initMaxActive theValue = this.getProperty("initMaxActive"); if (theValue != null) this.initMaxActive = (Boolean.valueOf(theValue)).booleanValue(); else this.initMaxActive = DEFAULT_INIT_MAX_ACTIVE; log.info("init(): init max active = " + this.initMaxActive); // borrowRetries theValue = this.getProperty("borrowRetries"); if (theValue != null) this.borrowRetries = Integer.parseInt(theValue); else this.borrowRetries = DEFAULT_BORROW_RETRIES; log.info("init(): borrow retries = " + this.borrowRetries); // maxWait theValue = this.getProperty("maxWait"); if (theValue != null) this.config.maxWait = Integer.parseInt(theValue); else this.config.maxWait = DEFAULT_MAX_WAIT; log.info("init(): max wait = " + this.config.maxWait); // minIdle theValue = this.getProperty("minIdle"); if (theValue != null) this.config.minIdle = Integer.parseInt(theValue); else this.config.minIdle = DEFAULT_MIN_IDLE; log.info("init(): min idle = " + this.config.minIdle); // numTestsPerEvictionRun this.config.numTestsPerEvictionRun = -1; // This will cause all session to be tested // testOnBorrow this.config.testOnBorrow = false; // testOnReturn this.config.testOnReturn = false; // testWhileIdle this.config.testWhileIdle = true; // timeBetweenEvictionRunsMillis theValue = this.getProperty("timeBetweenEvictionRunsMillis"); if (theValue != null) this.config.timeBetweenEvictionRunsMillis = Long.parseLong(theValue); else this.config.timeBetweenEvictionRunsMillis = DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS; log.info("init(): time between eviction runs = " + this.config.timeBetweenEvictionRunsMillis + " ms"); // whenExhaustedAction this.config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; } catch (Exception ex) { log.error("EPPSystemSessionPool.init(): Exception referencing Environment property: " + ex); throw new EPPSessionPoolException("Exception referencing Environment property: " + ex); } // Set factory required attributes this.factory.setAbsoluteTimeout(this.absoluteTimeout); this.factory.setIdleTimeout(this.idleTimeout); this.factory.setClientId(this.clientId); this.factory.setPassword(this.password); this.factory.setServerName(this.serverName); this.factory.setServerPort(this.serverPort); this.factory.setClientHost(this.clientHost); // Does pool have its own SSL configuration? if (this.getProperty("SSLProtocol") != null) { // Create EPPSSLConfig with required properties EPPSSLConfig theConfig = new EPPSSLConfig(this.getProperty("SSLProtocol"), this.getProperty("SSLKeyStore"), this.getProperty("SSLKeyFileName"), this.getProperty("SSLPassPhrase")); // Set optional EPPSSLConfig properties theConfig.setIdentityKeyPassPhrase(this.getProperty("SSLKeyPassPhrase")); theConfig.setSslDebug(this.getProperty("SSLDebug")); theConfig.setTrustStore(this.getProperty("SSLTrustStore"), this.getProperty("SSLTrustStoreFileName"), this.getProperty("SSLTrustStorePassPhrase")); theConfig.setSSLEnabledProtocols(this.getProperty("SSLEnabledProtocols")); theConfig.setSSLEnabledCipherSuites(this.getProperty("SSLEnabledCipherSuites")); try { this.sslContext = EPPSSLImpl.initialize(theConfig); } catch (EPPConException ex) { log.error("EPPSystemSessionPool.init(): Exception initializing EPPSSLContext: " + ex); throw new EPPSessionPoolException( "EPPSystemSessionPool.init(): Exception initializing EPPSSLContext: " + ex); } this.factory.setSSLContext(this.sslContext); } this.init(this.factory, this.config); // Pre-initialize maxActive sessions in pool? if (this.initMaxActive && this.config.maxActive > 0) { log.info("init(): Pre-initialize maxActive (" + this.config.maxActive + ") sessions"); EPPSession theSessions[] = new EPPSession[this.config.maxActive]; // Borrow maxActive sessions from pool for (int i = 0; i < this.config.maxActive; i++) { try { theSessions[i] = this.borrowObject(); log.info("init(): Pre-initialized session #" + (i + 1)); } catch (EPPSessionPoolException ex) { log.error("init(): Failure to pre-initialize session #" + (i + 1) + ": " + ex); } } // Return maxActive sessions back to pool for (int i = 0; i < this.config.maxActive; i++) { if (theSessions[i] != null) { this.returnObject(theSessions[i]); theSessions[i] = null; } } } }