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 01:10:22 GMT
    [ http://issues.apache.org/jira/browse/JDO-445?page=comments#action_12460629 ] 
            
Craig Russell commented on JDO-445:
-----------------------------------

Reply to Michael Watzek:

[brazil]- PersistenceManagerProxies are cached using PMF instances as keys. Thus, you get
the same proxy for the same PMF. I think this pattern disallows applications to implementing
a 1:1 mapping for servlets and PMFs because applications would retrieve the same proxy instance
with each (possibly concurrent) request. 

[clr] Yes, the intent is that you get the same proxy for the same PMF. Since the proxy is
thread-safe, this will always work.

[brazil]- PersistenceManagerProxy.close() does nothing. This means that after calling close,
it's still possible to successfully call methods like makePersistent() etc. My understanding
of javax.jdo.PersistenceManager is that all methods throw exceptions after close() except
for isClosed(). Is it a goal to have the same behavior for the proxy class and javax.jdo.PersistenceManager?


[clr] Not exactly a goal, especially since close is a life cycle method and the life cycle
of the proxy and the delegate are different. So close will need to be specified separately
for the proxy. Since it doesn't make sense to close the proxy, and the life cycle of the delegate
is under the control of the server, close should throw an exception. Also you will never get
a closed delegate from the proxy. 

[brazil]- Why is getPersistenceManagerProxy() a static method on class PersistenceManagerProxy
rather than on class JDOHelper? This means that application code must import class PersistenceManagerProxy.
If the method is defined on JDOHelper then class PersistenceManagerProxy can have default
access modifier and the proxy class can be transparent to application code. 

[clr] The intent was that this would not be used by the user, who would use getPersistenceManagerProxy
from the factory.

[brazil]- Class PersistenceManagerProxy never calls remove on static field 'persistenceManagerProxies'.


[clr] You are right, the proxies will exist until forever. The number of proxies in the Map
is small (one per PersistenceManagerFactory). We should use a weak Map that would allow the
Entry to be removed if the key is garbage collected. Thanks for the suggestion.

[brazil]- The JNDI lookup of TransactionSynchronizationRegistry is done in a static initializer
which may throw ExceptionInInitializerError. Would it make sense to do the lookup in getPersistenceManagerProxy()?


[clr] Thanks for the suggestion. I'll take a look. I'll need to double check to make sure
the resources needed by the code are available at the time the methods are called.


> 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

        

Mime
View raw message