diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java index e550c972ae4..19a2c7bd419 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/monitor/RMAppLifetimeMonitor.java @@ -100,7 +100,10 @@ public class RMAppLifetimeMonitor ApplicationTimeoutType timeoutType, long monitorStartTime, long timeout) { RMAppToMonitor appToMonitor = new RMAppToMonitor(appId, timeoutType); register(appToMonitor, monitorStartTime); - monitoredApps.putIfAbsent(appToMonitor, timeout); + Long oldTimeout = monitoredApps.get(appToMonitor); + if (oldTimeout == null) { + monitoredApps.put(appToMonitor, timeout); + } } @Override