Java虚拟机默认内存,用到Limit设置的限额的一半时,就会引发报警,进而导致服务重起。需要调整Java起动配置,经验值为Limit设置的限额的80%
就为这个80%的计算,费了劲啦
问题:
- 变量不知咋用。不用带%{},而是直接用
- 类型转换。数值转字符时,直接带上个字符+上数字变量即可
- 保留到整数。强制(Int)Double变量
//下面方法太TM笨啦
/*
def XImemory = Integer.parseInt(lMemory) * 0.8
XImemory = "" + XImemory
def Xpos = XImemory.indexOf('.')
def XSmemory
if (Xpos > -1){
XSmemory = XImemory.substring(0,Xpos)
}else{
XSmemory = XImemory
}
*/
def XImemory = (int)(Integer.parseInt(lMemory) * 0.8 + 0.5)
def XSmemory = "" + XImemory + "m"
//def XSmemory = "2000"+"m"
echo "======拼======XSmemory=${XSmemory}"