Class MemoryLimitCalculator
- java.lang.Object
-
- org.apache.shenyu.common.concurrent.MemoryLimitCalculator
-
public class MemoryLimitCalculator extends java.lang.ObjectRuntime.freeMemory()technology is used to calculate the memory limit by using the percentage of the current maximum available memory, which can be used withMemoryLimiter.- See Also:
MemoryLimiter
-
-
Constructor Summary
Constructors Constructor Description MemoryLimitCalculator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longcalculate(float percentage)Take the current JVM's maximum available memory as a percentage of the result as the limit.static longdefaultLimit()By default, it takes 80% of the maximum available memory of the current JVM.static longmaxAvailable()Get the maximum available memory of the current JVM.
-
-
-
Method Detail
-
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
-
-