You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2012/02/14 20:28:57 UTC
svn commit: r1244183 - in
/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container:
ReferenceListRecipe.java ReferenceRecipe.java
Author: not
Date: Tue Feb 14 19:28:57 2012
New Revision: 1244183
URL: http://svn.apache.org/viewvc?rev=1244183&view=rev
Log:
ARIES-829 Update our code to be more tolerant of an IllegalStateException when calling ctx.ungetService(). This only happens when the referenced service has gone, so the effect is the same.
Also update the ReferenceListRecipe.ServiceDispatcher.destroy to use the right bundle context when calling unget.
All in an attempt to make me less of a grumpy curmudgeon.
Modified:
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java?rev=1244183&r1=1244182&r2=1244183&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java Tue Feb 14 19:28:57 2012
@@ -192,9 +192,13 @@ public class ReferenceListRecipe extends
proxy = null;
Bundle bundle = ref.getBundle();
if (bundle != null) {
- BundleContext ctx = bundle.getBundleContext();
+ BundleContext ctx = getBundleContextForServiceLookup();
if (ctx != null) {
- ctx.ungetService(ref);
+ try {
+ ctx.ungetService(ref);
+ } catch (IllegalStateException ise) {
+ // we don't care it doesn't exist so, shrug.
+ }
}
}
}
Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java?rev=1244183&r1=1244182&r2=1244183&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java Tue Feb 14 19:28:57 2012
@@ -164,7 +164,11 @@ public class ReferenceRecipe extends Abs
voidProxiedChildren();
bind(trackedServiceReference, proxy);
if (oldReference != null) {
+ try {
getBundleContextForServiceLookup().ungetService(oldReference);
+ } catch (IllegalStateException ise) {
+ // In case the service no longer exists lets just cope and ignore.
+ }
}
monitor.notifyAll();
}
@@ -179,7 +183,11 @@ public class ReferenceRecipe extends Abs
trackedServiceReference = null;
trackedService = null;
voidProxiedChildren();
- getBundleContextForServiceLookup().ungetService(oldReference);
+ try {
+ getBundleContextForServiceLookup().ungetService(oldReference);
+ } catch (IllegalStateException ise) {
+ // In case the service no longer exists lets just cope and ignore.
+ }
monitor.notifyAll();
}
}