private void initPool() { PoolConfig pconfig = Db.getInstance().getPoolConfig(); int poolSize = Db.supports(Capability.ROW_LEVEL_LOCKING) ? pconfig.mPoolSize : 1; // if no row lock, we need serial access to the underlying db file // still need external synchronization for now since other connections to zimbra.db can occur // through DbPool mConnectionPool = new GenericObjectPool(null, poolSize, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, -1, poolSize); ConnectionFactory cfac = ZimbraConnectionFactory.getConnectionFactory(pconfig); boolean defAutoCommit = false, defReadOnly = false; new PoolableConnectionFactory(cfac, mConnectionPool, null, null, defReadOnly, defAutoCommit); try { PoolingDataSource pds = new PoolingDataSource(mConnectionPool); pds.setAccessToUnderlyingConnectionAllowed(true); Db.getInstance().startup(pds, pconfig.mPoolSize); mDataSource = pds; } catch (SQLException e) { ZimbraLog.system.error("failed to initialize offline db pool", e); } }