geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r785767 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container: AbstractServiceReferenceRecipe.java ReferenceRecipe.java
Date Wed, 17 Jun 2009 19:53:59 GMT
Author: gnodet
Date: Wed Jun 17 19:53:59 2009
New Revision: 785767

URL: http://svn.apache.org/viewvc?rev=785767&view=rev
Log:
Fix a problem in service references

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java?rev=785767&r1=785766&r2=785767&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
Wed Jun 17 19:53:59 2009
@@ -65,7 +65,7 @@
  */
 public abstract class AbstractServiceReferenceRecipe extends AbstractRecipe implements ServiceListener,
SatisfiableRecipe {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(RefListRecipe.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractServiceReferenceRecipe.class);
 
     protected final ExtendedBlueprintContainer blueprintContainer;
     protected final ServiceReferenceMetadata metadata;
@@ -185,7 +185,7 @@
     protected List<Class> loadAllClasses(Iterable<String> interfaceNames) throws
ClassNotFoundException {
         List<Class> classes = new ArrayList<Class>();
         for (String name : interfaceNames) {
-            Class clazz = proxyClassLoader.loadClass(name);
+            Class clazz = loadClass(name);
             classes.add(clazz);
         }
         return classes;
@@ -238,13 +238,11 @@
     }
 
     private void serviceAdded(ServiceReference ref) {
+        LOGGER.debug("Tracking reference {} for OSGi service {}", ref, getOsgiFilter());
         boolean added;
         boolean satisfied;
         synchronized (references) {
-            added = !references.contains(ref);
-            if (added) {
-                references.add(ref);
-            }
+            added = references.add(ref);
             satisfied = optional || !references.isEmpty();
         }
         if (added) {
@@ -254,10 +252,11 @@
     }
 
     private void serviceModified(ServiceReference ref) {
-        track(ref);
+        serviceAdded(ref);
     }
 
     private void serviceRemoved(ServiceReference ref) {
+        LOGGER.debug("Untracking reference {} for OSGi service {}", ref, getOsgiFilter());
         boolean removed;
         boolean satisfied;
         synchronized (references) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java?rev=785767&r1=785766&r2=785767&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java
Wed Jun 17 19:53:59 2009
@@ -32,6 +32,8 @@
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
 import org.osgi.service.blueprint.container.ServiceUnavailableException;
 import org.osgi.service.blueprint.reflect.ReferenceMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A recipe to create an unary OSGi service reference.
@@ -46,6 +48,8 @@
  */
 public class ReferenceRecipe extends AbstractServiceReferenceRecipe {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(ReferenceRecipe.class);
+
     private final ReferenceMetadata metadata;
     private Object proxy;
 
@@ -113,7 +117,7 @@
         // TODO: make this behavior configurable through a custom attribute
         // TODO:      policy = sticky | replace
         synchronized (monitor) {
-            if (trackedServiceReference != null) {
+            if (trackedServiceReference == null) {
                 retrack();
             }
         }
@@ -169,9 +173,10 @@
             }
             if (trackedServiceReference == null) {
                 if (isStarted()) {
+                    LOGGER.info("Timeout expired when waiting for OSGi service {}", getOsgiFilter());
                     throw new ServiceUnavailableException("Timeout expired when waiting for
OSGi service", getOsgiFilter());
                 } else {
-                    throw new ServiceUnavailableException("Service tracker is stopped", getOsgiFilter());
+                    throw new ServiceUnavailableException("The Blueprint container is being
or has been destroyed", getOsgiFilter());
                 }
             }
             if (trackedService == null) {



Mime
View raw message