On Aug 19, 2008, at 9:55 AM, Kevin Sutter wrote:
Okay, I'm starting to understand David Blevins' initial post, but I'm stillnot convinced that it's a valid concern.Prior to the TSR (TransactionSynchronizationRegistry), OpenJPA would access the TransactionManager in a myriad number of means. Some of which were not looked on favorably by some of the Application Server vendors (ie. WebSphere and their TransactionManager). Thus, we jumped through some hoops to follow the documented practices. Due to these various (and inconsistent) methods of obtaining the TransactionManager, that's probably why the TM was cachedat the EMF level. Educated guess. Now that the TSR is available and has a defined jndi location(java:comp/TransactionSynchronizationRegistry), we can be more consistent with our processing. Since the java:comp/ TransactionSynchronizationRegistry object is only available for Java EE managed components, caching this once per JVM should be just fine. In this case, the OpenJPA runtime would only be resident in the same JVM as the app server, so bouncing the app servershould bounce OpenJPA. Unless I am missing something from your scenario that would make the java:comp/TransactionSynchronizationRegistry accessible outside of thecontainer's managed environment... But, I don't think that would be speccompliant.
At the risk of overreaching, the scenario described by David is that the transaction management component (TMC hereinafter) of the application server is being reset, invalidating the object (hereinafter TSR) that was bound to java:comp/ TransactionSynchronizationRegistry.
After the TMC is reset, the new TSR instance is bound to the same JNDI address. Since OpenJPA has a reference to the old TSR instance, it doesn't work after the reset.
My pay grade isn't high enough for me to work through all the dependencies and synchronization conditions. While the TMC is being reset, nothing works, so the server needs to slow or stop the applications that are dependent on TMC. After the reset, the new TSR is active.
I don't understand with all this going on, why there would be an issue with a delegation model in which there is one TSR that delegates to the now-current implementation object.
Craig
KevinOn Mon, Aug 18, 2008 at 6:08 PM, David Jencks <[EMAIL PROTECTED]>wrote:On Aug 18, 2008, at 8:44 AM, Craig L Russell wrote: Hi David,Is it possible to fix this on the TSR implementation side?Specifically, since TSR implementation is registered with JNDI, could you refactor it into a permanent singleton registered in JNDI that delegates tothe real implementation?And the server code notify it the JNDI instance when there is a server state change that would invalidate the implementation. Then the JNDI objectcould delegate to the new implementation object.Seems like the only difference between what you're proposing and what I'mproposing is the receiver of the change notification.I don't know what the context is in openejb where this showed up, but it seems to me that at a possibly more philosophical level david's point wasthat having different lifecycles for these references very apt to beimplemented by the same object is pretty much an accident waiting to happen.thanks david jencksCraig On Aug 15, 2008, at 4:10 PM, David Blevins wrote:Seems there are some slight differences in the way OpenJPA tracks theTransactionManager reference versus the TransactionSynchronizationRegistry. The TransactionManager appears to be fetched once per EntityManagerFactory,so if the underlying app server does any sort of rebooting the newTransactionManager instance is picked up just fine as OpenJPA continues to get it from the app server. This is good. However when it comes to the TransactionSynchronizationRegistry, it seems OpenJPA grabs it once for the life of the VM and never lets it go. So if any sort of rebooting happens inthe app server OpenJPA will not get the newTransactionSynchronizationRegistry and of course ceases to work properly.Is it possible we can get this fixed for the next release? -David (pulled these stack traces of the code referencing the oldTransactionSynchronizationRegistry, may or may not be useful to you)atorg.apache.openjpa.ee.RegistryManagedRuntime $ TransactionManagerRegistryFacade .getStatus(RegistryManagedRuntime.java:130)atorg .apache .openjpa .kernel .AbstractBrokerFactory .syncWithManagedTransaction(AbstractBrokerFactory.java:723) at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java: 320)atorg .apache .openjpa .kernel .AbstractBrokerFactory .initializeBroker(AbstractBrokerFactory.java:216)atorg .apache .openjpa .kernel .AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)atorg .apache .openjpa .kernel .DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java: 142)atorg .apache .openjpa .persistence .EntityManagerFactoryImpl .createEntityManager(EntityManagerFactoryImpl.java:192)atorg .apache .openjpa .persistence .EntityManagerFactoryImpl .createEntityManager(EntityManagerFactoryImpl.java:56)-- atorg.apache.openjpa.ee.RegistryManagedRuntime $ TransactionManagerRegistryFacade .getStatus(RegistryManagedRuntime.java:130)atorg .apache .openjpa .kernel .AbstractBrokerFactory .syncWithManagedTransaction(AbstractBrokerFactory.java:723)atorg .apache .openjpa .kernel.BrokerImpl.syncWithManagedTransaction(BrokerImpl.java:1391)atorg .apache .openjpa .kernel .DelegatingBroker .syncWithManagedTransaction(DelegatingBroker.java:893)atorg .apache .openjpa .persistence .EntityManagerImpl.joinTransaction(EntityManagerImpl.java:501)-- atorg.apache.openjpa.ee.RegistryManagedRuntime $ TransactionManagerRegistryFacade .registerSynchronization(RegistryManagedRuntime.java:118)atorg .apache .openjpa .kernel .AbstractBrokerFactory .syncWithManagedTransaction(AbstractBrokerFactory.java:735)atorg .apache .openjpa .kernel.BrokerImpl.syncWithManagedTransaction(BrokerImpl.java:1391)atorg .apache .openjpa .kernel .DelegatingBroker .syncWithManagedTransaction(DelegatingBroker.java:893)atorg .apache .openjpa .persistence .EntityManagerImpl.joinTransaction(EntityManagerImpl.java:501)-- atorg.apache.openjpa.ee.RegistryManagedRuntime $ TransactionManagerRegistryFacade .getTransactionKey(RegistryManagedRuntime.java:134)atorg .apache .openjpa .ee .RegistryManagedRuntime .getTransactionKey(RegistryManagedRuntime.java:88)atorg .apache .openjpa .ee .AutomaticManagedRuntime .getTransactionKey(AutomaticManagedRuntime.java:255)atorg .apache .openjpa .kernel .AbstractBrokerFactory .syncWithManagedTransaction(AbstractBrokerFactory.java:740)atorg .apache .openjpa .kernel.BrokerImpl.syncWithManagedTransaction(BrokerImpl.java:1391)atorg .apache .openjpa .kernel .DelegatingBroker .syncWithManagedTransaction(DelegatingBroker.java:893)atorg .apache .openjpa .persistence .EntityManagerImpl.joinTransaction(EntityManagerImpl.java:501)-- atorg.apache.openjpa.ee.RegistryManagedRuntime $ TransactionManagerRegistryFacade .registerSynchronization(RegistryManagedRuntime.java:118)atorg .apache .openjpa .kernel .AbstractBrokerFactory .syncWithManagedTransaction(AbstractBrokerFactory.java:746)atorg .apache .openjpa .kernel.BrokerImpl.syncWithManagedTransaction(BrokerImpl.java:1391)atorg .apache .openjpa .kernel .DelegatingBroker .syncWithManagedTransaction(DelegatingBroker.java:893)atorg .apache .openjpa .persistence .EntityManagerImpl.joinTransaction(EntityManagerImpl.java:501)Craig L Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
Craig L Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
