You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by jb...@apache.org on 2021/02/15 06:45:26 UTC
[aries] branch trunk updated: [ARIES-1990] Introduce
BLUEPRINT_EXECUTOR_TIMEOUT env variable and blueprint.executor.timeout
system property allowing user to define the blueprint executor timeout
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/aries.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6487e1e [ARIES-1990] Introduce BLUEPRINT_EXECUTOR_TIMEOUT env variable and blueprint.executor.timeout system property allowing user to define the blueprint executor timeout
6487e1e is described below
commit 6487e1ec1a45ebbea663505cd5aa26af606bfb65
Author: jbonofre <jb...@apache.org>
AuthorDate: Mon Feb 15 07:44:34 2021 +0100
[ARIES-1990] Introduce BLUEPRINT_EXECUTOR_TIMEOUT env variable and blueprint.executor.timeout system property allowing user to define the blueprint executor timeout
---
.../blueprint/container/BlueprintEventDispatcher.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
index bfe584e..d7faee9 100644
--- a/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
+++ b/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintEventDispatcher.java
@@ -185,12 +185,19 @@ class BlueprintEventDispatcher implements BlueprintListener {
private void callListener(final BlueprintListener listener, final BlueprintEvent event) throws RejectedExecutionException {
try {
+ long executorTimeout = 60L;
+ if (System.getenv("BLUEPRINT_EXECUTOR_TIMEOUT") != null) {
+ executorTimeout = Long.parseLong(System.getenv("BLUEPRINT_EXECUTOR_TIMEOUT"));
+ }
+ if (System.getProperty("blueprint.executor.timeout") != null) {
+ executorTimeout = Long.parseLong(System.getProperty("blueprint.executor.timeout"));
+ }
executor.invokeAny(Collections.<Callable<Void>>singleton(new Callable<Void>() {
public Void call() throws Exception {
listener.blueprintEvent(event);
return null;
}
- }), 60L, TimeUnit.SECONDS);
+ }), executorTimeout, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
LOGGER.warn("Thread interrupted", ie);
Thread.currentThread().interrupt();
@@ -207,7 +214,14 @@ class BlueprintEventDispatcher implements BlueprintListener {
executor.shutdown();
// wait for the queued tasks to execute
try {
- executor.awaitTermination(60, TimeUnit.SECONDS);
+ long executorTimeout = 60L;
+ if (System.getenv("BLUEPRINT_EXECUTOR_TIMEOUT") != null) {
+ executorTimeout = Long.parseLong(System.getenv("BLUEPRINT_EXECUTOR_TIMEOUT"));
+ }
+ if (System.getProperty("blueprint.executor.timeout") != null) {
+ executorTimeout = Long.parseLong(System.getProperty("blueprint.executor.timeout"));
+ }
+ executor.awaitTermination(executorTimeout, TimeUnit.SECONDS);
} catch (InterruptedException e) {
// ignore
}