You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2014/10/06 14:12:49 UTC

svn commit: r1629621 - /felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java

Author: cziegeler
Date: Mon Oct  6 12:12:48 2014
New Revision: 1629621

URL: http://svn.apache.org/r1629621
Log:
[FELIX-4623 - Add test for thread based ordering

Modified:
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java?rev=1629621&r1=1629620&r2=1629621&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java Mon Oct  6 12:12:48 2014
@@ -18,6 +18,7 @@ package org.apache.felix.eventadmin.impl
 
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 
 import org.apache.felix.eventadmin.impl.util.LogWrapper;
@@ -117,18 +118,25 @@ public class DefaultThreadPool
      * @param task The task to execute
      * @return {@code true} if the task execution could be scheduled, {@code false} otherwise.
      */
-    public boolean executeTask(final Runnable task) {
+    public boolean executeTask(final Runnable task)
+    {
         try
         {
             this.executor.submit(task);
-            return true;
+        }
+        catch ( final RejectedExecutionException ree )
+        {
+            LogWrapper.getLogger().log(
+                    LogWrapper.LOG_WARNING,
+                    "Exception: " + ree, ree);
+            return false;
         }
         catch (final Throwable t)
         {
             LogWrapper.getLogger().log(
                     LogWrapper.LOG_WARNING,
                     "Exception: " + t, t);
-            return false;
         }
+        return true;
     }
 }