/** {@inheritDoc} */ public synchronized void emptyManagedConnectionPool(ManagedConnectionPool pool) { log.debug(poolName + ": emptyManagedConnectionPool(" + pool + ")"); if (pool != null) { // We only consider removal if there are more than 1 managed connection pool if (mcpPools.size() > 1) { Iterator<ManagedConnectionPool> it = mcpPools.values().iterator(); while (it.hasNext()) { ManagedConnectionPool other = it.next(); if (other == pool && pool.isEmpty()) { pool.shutdown(); it.remove(); break; } } } } }
/** {@inheritDoc} */ public synchronized void flush(FlushMode mode) { log.debug(poolName + ": flush(" + mode + ")"); Set<ManagedConnectionPool> clearMcpPools = new HashSet<ManagedConnectionPool>(); Iterator<ManagedConnectionPool> it = mcpPools.values().iterator(); while (it.hasNext()) { ManagedConnectionPool mcp = it.next(); mcp.flush(mode); if (mcp.isEmpty()) clearMcpPools.add(mcp); } if (clearMcpPools.size() > 0) { for (ManagedConnectionPool mcp : clearMcpPools) { mcp.shutdown(); mcpPools.values().remove(mcp); } } }