From e401e830cd5eb2c52ad1a2749bd3cb9a3a2690b6 Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Thu, 21 Sep 2017 13:57:31 +0200 Subject: [PATCH] SONAR-8902 let thread interruptions fail the change log level webservice call --- .../sonar/server/platform/ws/ChangeLogLevelAction.java | 2 +- .../platform/ws/ChangeLogLevelClusterService.java | 10 +++------- .../server/platform/ws/ChangeLogLevelService.java | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelAction.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelAction.java index a62a78962ec..c65f35a8c39 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelAction.java @@ -55,7 +55,7 @@ public class ChangeLogLevelAction implements SystemWsAction { } @Override - public void handle(Request wsRequest, Response wsResponse) { + public void handle(Request wsRequest, Response wsResponse) throws InterruptedException { userSession.checkIsSystemAdministrator(); LoggerLevel level = LoggerLevel.valueOf(wsRequest.mandatoryParam(PARAM_LEVEL)); diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java index 362fa62114e..e26cf710cf2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelClusterService.java @@ -39,13 +39,9 @@ public class ChangeLogLevelClusterService implements ChangeLogLevelService { this.member = member; } - public void changeLogLevel(LoggerLevel level) { - try { - member.call(setLogLevelForNode(level), HazelcastMemberSelectors.selectorForProcessIds(ProcessId.WEB_SERVER, ProcessId.COMPUTE_ENGINE), CLUSTER_TIMEOUT_MILLIS) - .propagateExceptions(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } + public void changeLogLevel(LoggerLevel level) throws InterruptedException { + member.call(setLogLevelForNode(level), HazelcastMemberSelectors.selectorForProcessIds(ProcessId.WEB_SERVER, ProcessId.COMPUTE_ENGINE), CLUSTER_TIMEOUT_MILLIS) + .propagateExceptions(); } private static DistributedCall setLogLevelForNode(LoggerLevel level) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelService.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelService.java index 1ef59c76b7d..6bf080af695 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelService.java @@ -23,6 +23,6 @@ import org.sonar.api.utils.log.LoggerLevel; public interface ChangeLogLevelService { - void changeLogLevel(LoggerLevel level); + void changeLogLevel(LoggerLevel level) throws InterruptedException; } -- 2.39.5