diff --git a/store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java b/store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java index 3483c9921784d3f66d64c07906ee66304b27eb70..75b7597feade1c34092d8f6fee8d0d12f4126fe2 100644 --- a/store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java +++ b/store/src/main/java/org/apache/rocketmq/store/ha/WaitNotifyObject.java @@ -21,6 +21,7 @@ import org.apache.rocketmq.logging.InternalLogger; import org.apache.rocketmq.logging.InternalLoggerFactory; import java.util.HashMap; +import java.util.Map; public class WaitNotifyObject { private static final InternalLogger log = InternalLoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME); @@ -65,9 +66,9 @@ public class WaitNotifyObject { synchronized (this) { boolean needNotify = false; - for (Boolean value : this.waitingThreadTable.values()) { - needNotify = needNotify || !value; - value = true; + for (Map.Entry entry : this.waitingThreadTable.entrySet()) { + needNotify = needNotify || !entry.getValue(); + entry.setValue(true); } if (needNotify) {