/** * Determine the correct pool for this request, creates a new one when necessary. * * @param key the key to the pool * @param subject the subject of the pool * @param cri the connection request info * @return the subpool context * @throws ResourceException for any error */ protected ManagedConnectionPool getManagedConnectionPool( Object key, Subject subject, ConnectionRequestInfo cri) throws ResourceException { try { ManagedConnectionPool mcp = mcpPools.get(key); if (mcp == null) { ManagedConnectionPoolFactory mcpf = new ManagedConnectionPoolFactory(); ManagedConnectionPool newMcp = mcpf.create(mcf, clf, subject, cri, poolConfiguration, this); mcp = mcpPools.putIfAbsent(key, newMcp); if (mcp == null) { mcp = newMcp; initLock(); } } return mcp; } catch (Throwable t) { throw new ResourceException(bundle.unableGetManagedConnectionPool(), t); } }