You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2013/12/04 17:07:51 UTC

git commit: CLEREZZA-848: making sure the thread is non-null before the bundle-listener is registered

Updated Branches:
  refs/heads/master 35448624b -> aec88f543


CLEREZZA-848: making sure the thread is non-null before the bundle-listener is registered

Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/aec88f54
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/aec88f54
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/aec88f54

Branch: refs/heads/master
Commit: aec88f543044d22244cec815d04dd0432affec45
Parents: 3544862
Author: retobg <re...@apache.org>
Authored: Wed Dec 4 17:07:32 2013 +0100
Committer: retobg <re...@apache.org>
Committed: Wed Dec 4 17:07:32 2013 +0100

----------------------------------------------------------------------
 .../clerezza/platform/content/fsadaptor/BundleFsLoader.scala  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/aec88f54/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
----------------------------------------------------------------------
diff --git a/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala b/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
index d9548c1..645dab1 100644
--- a/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
+++ b/platform.content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
@@ -140,12 +140,12 @@ class BundleFsLoader extends BundleListener with Logger with WeightedTcProvider
           if bundle.getState == Bundle.ACTIVE) {
         bundleList ::= bundle
       }
-      context.getBundleContext().addBundleListener(this);
       updateCache
       tcManager.getTcAccessController.setRequiredReadPermissions(
           RESOURCE_MGRAPH_URI, Collections.singleton(new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ)))
       cgProvider.addTemporaryAdditionGraph(RESOURCE_MGRAPH_URI)
       updateThread = new UpdateThread()
+      context.getBundleContext().addBundleListener(this);
     }
   }
   protected def deactivate(context: ComponentContext) {
@@ -154,6 +154,7 @@ class BundleFsLoader extends BundleListener with Logger with WeightedTcProvider
       updateThread.interrupt()
       cgProvider.removeTemporaryAdditionGraph(RESOURCE_MGRAPH_URI)
       tcManager.deleteTripleCollection(currentCacheUri);
+      updateThread == null;
     }
   }
 
@@ -238,6 +239,10 @@ class BundleFsLoader extends BundleListener with Logger with WeightedTcProvider
 
 
   def bundleChanged(event: BundleEvent) {
+    val updateThread = this.updateThread
+    if (updateThread == null) {
+      BundleFsLoader.log.error("UpdateThread is null, yet we get bundle Events")
+    }
     val bundle = event.getBundle();
     event.getType() match  {
       case BundleEvent.STARTED => {