Skip to content

Commit

Permalink
[FELIX-4623 - Add test for thread based ordering
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1629621 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cziegeler committed Oct 6, 2014
1 parent 7c1233f commit cabc201
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -117,18 +118,25 @@ public void close()
* @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;
}
}

0 comments on commit cabc201

Please sign in to comment.