/** * Mutator for the connection implementation. * * @param mc The managed connection implementation */ void setManagedConnection(final ManagedConnectionImpl mc) { if (mc == null) { this.mc = null; this.pm = null; return; } this.mc = mc; this.pm = mc.getPersistenceManager(); }
/** * Method to close the Persistence Manager. This is invoked by the application server if this * handle is not closed */ public void close() { assertIsOpen(); LOGGER.debug("Closing handle " + this); if (pm != null) { pm.flush(); mc.notifyClosed(this); } closed = true; }
/* (non-Javadoc) * @see javax.resource.spi.ManagedConnectionFactory#matchManagedConnections(java.util.Set, javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo) */ public ManagedConnection matchManagedConnections( @SuppressWarnings("rawtypes") Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { log(Level.FINEST, "matchManagedConnections"); if ((null != connectionSet) && !connectionSet.isEmpty()) { for (Object con : (Set<?>) connectionSet) { if (con instanceof ManagedConnectionImpl) { ManagedConnectionImpl conn = (ManagedConnectionImpl) con; ConnectionRequestInfo otherCxRequestInfo = conn.getCxRequestInfo(); if (null == otherCxRequestInfo || otherCxRequestInfo.equals(cxRequestInfo)) { return conn; } } else { log(Level.WARNING, "Unexpected element in list: " + con); } } } // null is interpreted as "create new one" by the container return null; }