db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-445) Add convenience method that returns a PersistenceManager proxy
Date Sat, 23 Dec 2006 19:58:21 GMT
    [ http://issues.apache.org/jira/browse/JDO-445?page=comments#action_12460660 ] 
Craig Russell commented on JDO-445:

I think there might be a use-case for the getPersistenceManagerProxy for a non-JTA PersistenceManagerFactory.
This proxy would use the delegation pattern but would use a ThreadLocal to store the delegate
PersistenceManager.  This allows multiple transactions to be begun and committed using the
same delegate. 

The behavior would be slightly different in the life cycle of the delegate (the proxy would
still be static and thread-safe, and bound to an instance of PersitsenceManagerFactory. If
there were no thread local delegate, the PersistenceManager would be obtained from the factory
and stored in the thread local. The delegate would be removed from the thread local when the
close() method was called on the proxy. The next invocation of a method on the proxy would
obtain a new delegate.

The behavior of getPersistenceManagerProxy could be different based on whether the factory
were configured as a TransactionType JTA versus RESOURCE_LOCAL. We could use the same method,
and it would return either a PersistenceManagerJTAProxy or a PersistenceManagerThreadLocalProxy
depending on the setting of the TransactionType.

Alternatively, we could define two methods, one of which would always throw an exception:
getPersistenceManagerJTAProxy or getPersistenceManagerThreadLocalProxy.

I'm not afraid of long method names, by the way. ;-)

> Add convenience method that returns a PersistenceManager proxy
> --------------------------------------------------------------
>                 Key: JDO-445
>                 URL: http://issues.apache.org/jira/browse/JDO-445
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2, api2-legacy
>            Reporter: Michelle Caisse
>         Assigned To: Craig Russell
>             Fix For: JDO 2 maintenance release 1
>         Attachments: PMProxy-patch.txt
> In Chapter 8, add a convenience method that returns a PersistenceManager proxy that can
be used in web and ejb containers to dynamically bind to the transaction-associated PersistenceManager.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message