aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1421112 - /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
Date Thu, 13 Dec 2012 08:11:04 GMT
Author: gnodet
Date: Thu Dec 13 08:11:03 2012
New Revision: 1421112

URL: http://svn.apache.org/viewvc?rev=1421112&view=rev
Log:
Ignore RejectedExecutinException caused by the executor being shut down while receiving a
service event

Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java?rev=1421112&r1=1421111&r2=1421112&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
Thu Dec 13 08:11:03 2012
@@ -35,6 +35,7 @@ import java.util.List;
 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 @@ public abstract class AbstractServiceRef
     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) {



Mime
View raw message