Class MemoryLimitCalculator
java.lang.Object
org.apache.dubbo.common.threadpool.MemoryLimitCalculator
Runtime.freeMemory() technology is used to calculate the
memory limit by using the percentage of the current maximum available memory,
which can be used with MemoryLimiter.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcalculate(float percentage) Take the current JVM's maximum available memory as a percentage of the result as the limit.static longBy default, it takes 80% of the maximum available memory of the current JVM.static longGet the maximum available memory of the current JVM.
-
Constructor Details
-
MemoryLimitCalculator
public MemoryLimitCalculator()
-
-
Method Details
-
maxAvailable
public static long maxAvailable()Get the maximum available memory of the current JVM.- Returns:
- maximum available memory
-
calculate
public static long calculate(float percentage) Take the current JVM's maximum available memory as a percentage of the result as the limit.- Parameters:
percentage- percentage- Returns:
- available memory
-
defaultLimit
public static long defaultLimit()By default, it takes 80% of the maximum available memory of the current JVM.- Returns:
- available memory
-