diff options
Diffstat (limited to 'container-core')
2 files changed, 11 insertions, 3 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java b/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java index b27efcc13f0..8d07e7c3757 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java +++ b/container-core/src/main/java/com/yahoo/container/handler/threadpool/DefaultContainerThreadpool.java @@ -56,7 +56,7 @@ public class DefaultContainerThreadpool extends AbstractComponent implements Aut threadPoolMetric); // Prestart needed, if not all threads will be created by the fist N tasks and hence they might also // get the dreaded thread locals initialized even if they will never run. - // That counters what we we want to achieve with the Q that will prefer thread locality. + // That counters what we want to achieve with the Q that will prefer thread locality. executor.prestartAllCoreThreads(); threadpool = new ExecutorServiceWrapper( executor, threadPoolMetric, processTerminator, config.maxThreadExecutionTimeSeconds() * 1000L, diff --git a/container-core/src/main/java/com/yahoo/processing/execution/AsyncExecution.java b/container-core/src/main/java/com/yahoo/processing/execution/AsyncExecution.java index a92bf5ec9f7..0a112945682 100644 --- a/container-core/src/main/java/com/yahoo/processing/execution/AsyncExecution.java +++ b/container-core/src/main/java/com/yahoo/processing/execution/AsyncExecution.java @@ -100,13 +100,21 @@ public class AsyncExecution { private static <T> Future<T> getFuture(final Callable<T> callable) { FutureTask<T> future = new FutureTask<>(callable); - executorMain.execute(future); + try { + executorMain.execute(future); + } catch (RejectedExecutionException e) { + future.run(); + } return future; } private FutureResponse getFutureResponse(Callable<Response> callable, Request request) { FutureResponse future = new FutureResponse(callable, execution, request); - executorMain.execute(future.delegate()); + try { + executorMain.execute(future.delegate()); + } catch (RejectedExecutionException e) { + future.delegate().run(); + } return future; } |