aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1636398 - /aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
Date Mon, 03 Nov 2014 17:17:19 GMT
Author: cschneider
Date: Mon Nov  3 17:17:18 2014
New Revision: 1636398

URL: http://svn.apache.org/r1636398
Log:
ARIES-1162 Destroy persistence unit on unresolved event

Modified:
    aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java

Modified: aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java?rev=1636398&r1=1636397&r2=1636398&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
(original)
+++ aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleManager.java
Mon Nov  3 17:17:18 2014
@@ -284,11 +284,16 @@ public class PersistenceBundleManager im
     EntityManagerFactoryManager mgr = (EntityManagerFactoryManager) object;
     //If the bundle was updated we need to destroy it and re-initialize
     //the EntityManagerFactoryManager
-    if(event != null && event.getType() == BundleEvent.UPDATED) {
+    //If the bundle becomes unresolved we need to destroy persistenceUnits, since they
+    //keep a reference to bundle classloader which has wiring m_isDisposed set to true
+    //this occurs when Karaf BundleWatcher is used.
+    if(event != null && (event.getType() == BundleEvent.UPDATED || event.getType()
== BundleEvent.UNRESOLVED)) {
       mgr.destroy();
       persistenceUnitFactory.destroyPersistenceBundle(ctx, bundle);
-      //Don't add to the managersAwaitingProviders, the setupManager will do it
-      setupManager(bundle, mgr, true);
+      if (event.getType() == BundleEvent.UPDATED) {
+          //Don't add to the managersAwaitingProviders, the setupManager will do it
+          setupManager(bundle, mgr, true);
+      }
     } else {
       try {
         boolean reassign;



Mime
View raw message