From 5750bb94edc98436723975e2f84c38f513e59bef Mon Sep 17 00:00:00 2001 From: Nanda kumar Date: Fri, 5 Apr 2019 23:12:00 +0530 Subject: [PATCH] HDDS-1389. Fix testSCMChillModeRestrictedOp. (#696) --- .../hdds/scm/chillmode/ChillModeHandler.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/chillmode/ChillModeHandler.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/chillmode/ChillModeHandler.java index fff1fb2463a..ae41821c0f6 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/chillmode/ChillModeHandler.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/chillmode/ChillModeHandler.java @@ -88,16 +88,25 @@ public ChillModeHandler(Configuration configuration, @Override public void onMessage(ChillModeStatus chillModeStatus, EventPublisher publisher) { - try { - isInChillMode.set(chillModeStatus.getChillModeStatus()); - scmClientProtocolServer.setChillModeStatus(isInChillMode.get()); - scmBlockManager.setChillModeStatus(isInChillMode.get()); - Thread.sleep(waitTime); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } finally { - replicationManager.start(); + + isInChillMode.set(chillModeStatus.getChillModeStatus()); + scmClientProtocolServer.setChillModeStatus(isInChillMode.get()); + scmBlockManager.setChillModeStatus(isInChillMode.get()); + + if (!isInChillMode.get()) { + final Thread chillModeExitThread = new Thread(() -> { + try { + Thread.sleep(waitTime); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + replicationManager.start(); + }); + + chillModeExitThread.setDaemon(true); + chillModeExitThread.start(); } + } public boolean getChillModeStatus() {