/** * Accessor for the delegate PM that we hand off to. * @return The delegate PM (from the PMF thread-local store) */ protected PersistenceManager getPM() { return pmf.getPMProxyDelegate(); }
/** * Convenience method to clear the thread-local delegate PM that we refer to. * This is invoked when the proxy PM has close() invoked. */ void clearPMProxyDelegate() { // TODO Is it safe to assume 'this' is actually the right PMF already? PersistenceManagerFactory pmf = getPMProxyDelegate().getPersistenceManagerFactory(); String txnType = pmf.getTransactionType(); if (TransactionType.RESOURCE_LOCAL.toString().equalsIgnoreCase(txnType)) { // Close the PM and unset the thread-local getPMProxyDelegate().close(); pmProxyThreadLocal.remove(); } else if (TransactionType.JTA.toString().equalsIgnoreCase(txnType)) { // Do nothing } }