You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/02/03 11:58:43 UTC

svn commit: r1240075 - /karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java

Author: jbonofre
Date: Fri Feb  3 10:58:43 2012
New Revision: 1240075

URL: http://svn.apache.org/viewvc?rev=1240075&view=rev
Log:
[KARAF-1179] Register the bundle watcher as a bundle listener

Modified:
    karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java

Modified: karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java
URL: http://svn.apache.org/viewvc/karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java?rev=1240075&r1=1240074&r2=1240075&view=diff
==============================================================================
--- karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java (original)
+++ karaf/trunk/shell/dev/src/main/java/org/apache/karaf/shell/dev/watch/BundleWatcher.java Fri Feb  3 10:58:43 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.karaf.shell.dev.watch;
 
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -64,7 +63,7 @@ public class BundleWatcher implements Ru
 
 
     /**
-     * Construcotr
+     * Constructor
      */
     public BundleWatcher() {
     }
@@ -77,9 +76,7 @@ public class BundleWatcher implements Ru
     }
 
     public void run() {
-        if (logger.isDebugEnabled()) {
-            logger.debug("Bundle watcher thread started");
-        }
+        logger.debug("Bundle watcher thread started");
         int oldCounter = -1;
         Set<Bundle> watchedBundles = new HashSet<Bundle>();
         while (running.get() && watchURLs.size()>0) {
@@ -252,6 +249,9 @@ public class BundleWatcher implements Ru
 
 
     public void start() {
+        // register the bundle listener
+        bundleContext.addBundleListener(this);
+        // start the watch thread
         if (running.compareAndSet(false, true)) {
             if (watchURLs.size()>0) {
                 Thread thread = new Thread(this);
@@ -265,6 +265,8 @@ public class BundleWatcher implements Ru
      */
     public void stop() {
         running.set(false);
+        // unregister the bundle listener
+        bundleContext.removeBundleListener(this);
     }
 
     public ConfigurationAdmin getConfigurationAdmin() {