Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ignore RejectedExecutinException caused by the executor being shut do…

…wn while receiving a service event

git-svn-id: https://svn.apache.org/repos/asf/aries/trunk@1421112 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 2c635b14c3fbf34990e0f4868465fa64a42719c2 1 parent adae953
@gnodet gnodet authored
View
34 ...nt/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
@@ -35,6 +35,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.aries.blueprint.BlueprintConstants;
@@ -304,21 +305,26 @@ protected Object createProxy(final Callable<Object> dispatcher, Set<Class<?>> in
public void serviceChanged(final ServiceEvent event) {
final int eventType = event.getType();
final ServiceReference ref = event.getServiceReference();
- blueprintContainer.getExecutors().submit(new Runnable() {
- public void run() {
- switch (eventType) {
- case ServiceEvent.REGISTERED:
- serviceAdded(ref);
- break;
- case ServiceEvent.MODIFIED:
- serviceModified(ref);
- break;
- case ServiceEvent.UNREGISTERING:
- serviceRemoved(ref);
- break;
+ try {
+ blueprintContainer.getExecutors().submit(new Runnable() {
+ public void run() {
+ switch (eventType) {
+ case ServiceEvent.REGISTERED:
+ serviceAdded(ref);
+ break;
+ case ServiceEvent.MODIFIED:
+ serviceModified(ref);
+ break;
+ case ServiceEvent.UNREGISTERING:
+ serviceRemoved(ref);
+ break;
+ }
}
- }
- });
+ });
+ } catch (RejectedExecutionException e) {
+ // The job has been rejected because the executor is shut down
+ // so ignore the exception
+ }
}
private void serviceAdded(ServiceReference ref) {
Please sign in to comment.
Something went wrong with that request. Please try again.