Permalink
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...
1 parent adae953 commit 2c635b14c3fbf34990e0f4868465fa64a42719c2 @gnodet gnodet committed Dec 13, 2012
@@ -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) {

0 comments on commit 2c635b1

Please sign in to comment.