aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1342554 - /aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java
Date Fri, 25 May 2012 10:05:33 GMT
Author: gnodet
Date: Fri May 25 10:05:32 2012
New Revision: 1342554

URL: http://svn.apache.org/viewvc?rev=1342554&view=rev
Log:
[ARIES-851] BundleTrackerCustomizer in BundleHookBundleTracker is called multiple times for
the same event.

Modified:
    aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java

Modified: aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java?rev=1342554&r1=1342553&r2=1342554&view=diff
==============================================================================
--- aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java
(original)
+++ aries/trunk/util/util/src/main/java/org/apache/aries/util/tracker/hook/BundleHookBundleTracker.java
Fri May 25 10:05:32 2012
@@ -62,7 +62,23 @@ public class BundleHookBundleTracker<T> 
 
   @Override
   public void open() {
-    tracked = new Tracked();
+    synchronized (this) {
+      tracked = new Tracked();
+      Bundle[] bundles = context.getBundles();
+      if (bundles != null) {
+        int length = bundles.length;
+        for (int i = 0; i < length; i++) {
+          int state = bundles[i].getState();
+          if ((state & mask) == 0) {
+            /* null out bundles whose states are not interesting */
+            bundles[i] = null;
+          }
+        }
+        /* set tracked with the initial bundles */
+        tracked.setInitial(bundles);
+      }
+    }
+    tracked.trackInitial();
     EventHook hook = new BundleEventHook(tracked);
     sr = context.registerService(EventHook.class.getName(), hook, null);
   }



Mime
View raw message