Lifecycle issues with PersistenceBundleManager
----------------------------------------------
Key: ARIES-137
URL: https://issues.apache.org/jira/browse/ARIES-137
Project: Aries
Issue Type: Bug
Components: JPA
Reporter: Alan Keane
EntityManagerFactory only gets registered for a unit if a matching
PersistenceProvider service
is bound before the persistence bundle is added to the tracker.
The PersistenceBundleManager will only attempt to setup an
EntityManagerFactoryManager
for the PersistenceProvider services available at the point when a persistence
bundle
is first detected and subsequently only tracks the persistence bundles that get
matched with a Provider.
Any Persistence bundle added to the tracker before a (suitable)
PersistenceProvider is
available will never get matched with a provider.
The PersistenceBundleManager#addingProvider method should check for persistence
bundles
that are not matched with a provider and attempt to resolve.
One possible solution would be that the addingBundle and setUpManager methods
use a
null object style pattern (or similar) for the EntityManagerFactoryManager so
that
detected persistence bundles without a matching provider are still tracked.
When a provider service is then bound to the PersistenceBundleManager via
addingProvider,
iterate through all tracked persistence bundles and attempt to match those that
do
not have a valid EntityManagerFactoryManager associated.
(Note: MultiBundleTracker does not expose the bundles tracked, but by exposing
getBundles()
for above and also using getObject() where the EntityManagerFactoryManager is
being returned
there probably wouldn't be any need for bundleToManagerMap and associated
synchronization)
Also I think an ExecutorService should be used for the setUpManager calls
rather
than this work being done on a framework event thread.
(I don't have time right now to look at this properly, so somebody might want
to have a
look/take this in the meantime)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.