public XsltTransformer() { super(); transformerPool = new GenericObjectPool(new PooledXsltTransformerFactory()); transformerPool.setMinIdle(MIN_IDLE_TRANSFORMERS); transformerPool.setMaxIdle(MAX_IDLE_TRANSFORMERS); transformerPool.setMaxActive(MAX_ACTIVE_TRANSFORMERS); contextProperties = new HashMap<String, Object>(); }
/** Create dataSource object using given parameters */ public DataSource setupDataSource( String connectionURL, String username, String password, int minIdle, int maxActive) throws Exception { GenericObjectPool connectionPool = new GenericObjectPool(null); connectionPool.setMinIdle(minIdle); connectionPool.setMaxActive(maxActive); connectionPool.setMaxWait(1000 * 60); pool = connectionPool; ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectionURL, username, password); PoolableConnectionFactory factory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); pool.setFactory(factory); PoolingDataSource dataSource = new PoolingDataSource(connectionPool); dataSource.setAccessToUnderlyingConnectionAllowed(true); return dataSource; }