[FELIX-4623 - Add test for thread based ordering
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1629621 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java
index 3051b81..26c1e5e 100644
--- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java
+++ b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java
@@ -18,6 +18,7 @@
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 @@
* @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;
}
}