You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2009/04/28 13:08:02 UTC

svn commit: r769333 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context: BlueprintContextImpl.java ServiceRegistrationProxy.java

Author: gnodet
Date: Tue Apr 28 11:08:02 2009
New Revision: 769333

URL: http://svn.apache.org/viewvc?rev=769333&view=rev
Log:
Improve log for ServiceRegistrationProxy and catch all exceptions in BlueprintContextImpl

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=769333&r1=769332&r2=769333&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java Tue Apr 28 11:08:02 2009
@@ -147,6 +147,7 @@
     public synchronized void run() {
         try {
             for (;;) {
+                LOGGER.debug("Running blueprint context for bundle {} in state {}", bundleContext.getBundle().getSymbolicName(), state);
                 switch (state) {
                     case Unknown:
                         checkDirectives();
@@ -217,11 +218,11 @@
                         return;
                 }
             }
-        } catch (Exception e) {
+        } catch (Throwable t) {
             state = State.Failed;
             // TODO: clean up
-            LOGGER.error("Unable to start blueprint context for bundle " + bundleContext.getBundle().getSymbolicName(), e);
-            sender.sendFailure(this, e);
+            LOGGER.error("Unable to start blueprint context for bundle " + bundleContext.getBundle().getSymbolicName(), t);
+            sender.sendFailure(this, t);
         }
     }
 
@@ -310,7 +311,8 @@
     }
 
     public void notifySatisfaction(SatisfiableRecipe satisfiable) {
-        LOGGER.debug("Notified satisfaction for {}: {}", satisfiable.getName(), satisfiable.isSatisfied());
+        LOGGER.debug("Notified satisfaction {} in bundle {}: {}",
+                new Object[] { satisfiable.getName(), bundleContext.getBundle().getSymbolicName(), satisfiable.isSatisfied() });
         if (state == State.WaitForInitialReferences) {
             executors.submit(this);
         } else if (state == State.Created) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java?rev=769333&r1=769332&r2=769333&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java Tue Apr 28 11:08:02 2009
@@ -35,12 +35,16 @@
 import org.osgi.service.blueprint.reflect.RefMetadata;
 import org.osgi.service.blueprint.reflect.RegistrationListener;
 import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
 
 /** 
  * TODO: javadoc
  */
 public class ServiceRegistrationProxy implements ServiceRegistration {
-  
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceRegistrationProxy.class);
+
     private BlueprintContext blueprintContext;
     private Object service;
     private Map serviceProperties;
@@ -101,7 +105,7 @@
         registration = blueprintContext.getBundleContext().registerService(classesArray, service, props);
         registrationProperties = props;
         
-        System.out.println("service registered: " + service + " " + classes);
+        LOGGER.debug("Service {} registered with interfaces {}", service, classes);
         
         if (listeners != null) {
             for (Listener listener : listeners) {
@@ -129,8 +133,8 @@
         if (registration != null) {
             registration.unregister();
             
-            System.out.println("service unregistered: " + service);
-            
+            LOGGER.debug("Service {} unregistered", service);
+
             if (listeners != null) {
                 for (Listener listener : listeners) {
                     listener.unregister(this);
@@ -206,7 +210,7 @@
             try {
                 method.invoke(listener, args);
             } catch (Exception e) {
-                e.printStackTrace();
+                LOGGER.info("Error calling listener", e);
             }
         }