This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new 01deaf9a0d Update MemoryStatusChecker.java (#10442)
01deaf9a0d is described below
commit 01deaf9a0d0c45d89c3c6a99fa6c36bb16f58b6f
Author: Tianjc <[email protected]>
AuthorDate: Fri Aug 12 14:38:38 2022 +0800
Update MemoryStatusChecker.java (#10442)
Alarm when spare memory < 2M,not <2K
---
.../org/apache/dubbo/common/status/support/MemoryStatusChecker.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/status/support/MemoryStatusChecker.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/status/support/MemoryStatusChecker.java
index 0f13000872..411fa2f3d9 100644
---
a/dubbo-common/src/main/java/org/apache/dubbo/common/status/support/MemoryStatusChecker.java
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/status/support/MemoryStatusChecker.java
@@ -32,7 +32,7 @@ public class MemoryStatusChecker implements StatusChecker {
long freeMemory = runtime.freeMemory();
long totalMemory = runtime.totalMemory();
long maxMemory = runtime.maxMemory();
- boolean ok = (maxMemory - (totalMemory - freeMemory) > 2048); // Alarm
when spare memory < 2M
+ boolean ok = (maxMemory - (totalMemory - freeMemory) > 2*1024*1024);
// Alarm when spare memory < 2M
String msg = "max:" + (maxMemory / 1024 / 1024) + "M,total:"
+ (totalMemory / 1024 / 1024) + "M,used:" + ((totalMemory /
1024 / 1024) - (freeMemory / 1024 / 1024)) + "M,free:" + (freeMemory / 1024 /
1024) + "M";
return new Status(ok ? Status.Level.OK : Status.Level.WARN, msg);