You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/07/20 08:02:49 UTC
svn commit: r795697 -
/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
Author: gawor
Date: Mon Jul 20 06:02:49 2009
New Revision: 795697
URL: http://svn.apache.org/viewvc?rev=795697&view=rev
Log:
simplify satisfaction tracking of service references
Modified:
geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.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=795697&r1=795696&r2=795697&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 Mon Jul 20 06:02:49 2009
@@ -130,8 +130,10 @@
ServiceReference[] references = blueprintContainer.getBundleContext().getServiceReferences(null, getOsgiFilter());
if (references != null) {
for (ServiceReference reference : references) {
- serviceAdded(reference);
+ this.references.add(reference);
+ track(reference);
}
+ satisfied.set(optional || !this.references.isEmpty());
}
}
} catch (InvalidSyntaxException e) {
@@ -282,20 +284,16 @@
private void serviceAdded(ServiceReference ref) {
LOGGER.debug("Tracking reference {} for OSGi service {}", ref, getOsgiFilter());
- boolean added;
- boolean satisfied;
synchronized (references) {
- added = references.add(ref);
- satisfied = optional || !references.isEmpty();
+ references.add(ref);
}
- if (added) {
- track(ref);
- }
- setSatisfied(satisfied);
+ track(ref);
+ setSatisfied(true);
}
private void serviceModified(ServiceReference ref) {
- serviceAdded(ref);
+ // ref must be in references and must be satisfied
+ track(ref);
}
private void serviceRemoved(ServiceReference ref) {