hb offline not so eager

This commit is contained in:
ZZ 2022-03-28 15:21:23 +08:00
parent c33f2b8f0c
commit c185b895a6
2 changed files with 22 additions and 15 deletions

View File

@ -36,10 +36,15 @@ public class Calc {
expression = parser.parseExpression(ruleExpression); expression = parser.parseExpression(ruleExpression);
rs = expression.getValue(stdContext, String.class); rs = expression.getValue(stdContext, String.class);
System.out.println(rs); System.out.println(rs);
ruleExpression = "#totalPower * 0.03"; ruleExpression = "#totalPower - (0.03% * 2%)";
expression = parser.parseExpression(ruleExpression); // expression = parser.parseExpression(ruleExpression);
rs = expression.getValue(stdContext, String.class); // rs = expression.getValue(stdContext, String.class);
System.out.println(rs); // System.out.println(rs);
String[] split = ruleExpression.split("[()*/\\-+?]");
for (String splitValue : split) {
System.out.println(splitValue);
}
} }
private static void test(String s, double x) { private static void test(String s, double x) {
@ -254,7 +259,7 @@ class Parser extends Object {
*/ */
enum Symbol { enum Symbol {
PLUS('+'), MINUS('-'), STAR('*'), SLASH('/'), PLUS('+'), MINUS('-'), STAR('*'), SLASH('/'),
OPEN('('), CLOSE(')'), COMMA(','), OPEN('('), CLOSE(')'), COMMA(','), PERCENT('%'),
END(StreamTokenizer.TT_EOF), END(StreamTokenizer.TT_EOF),
WORD(StreamTokenizer.TT_WORD), WORD(StreamTokenizer.TT_WORD),
NUMBER(StreamTokenizer.TT_NUMBER); NUMBER(StreamTokenizer.TT_NUMBER);

View File

@ -34,6 +34,7 @@ public class HBCheckTask {
Long hbtime = (Long) cacheGun.get("hbtime"); Long hbtime = (Long) cacheGun.get("hbtime");
hbtime = hbtime == null ? 0 : hbtime; hbtime = hbtime == null ? 0 : hbtime;
if ((now - hbtime) > 75000) { if ((now - hbtime) > 75000) {
if (!DISCONNECTED.equals(cacheGun.get("status"))) {
cacheGun.put("statusInt", OFF_LINE); cacheGun.put("statusInt", OFF_LINE);
cacheGun.put("status", DISCONNECTED); cacheGun.put("status", DISCONNECTED);
REDIS.setCacheMap(gunkey, cacheGun); REDIS.setCacheMap(gunkey, cacheGun);
@ -49,5 +50,6 @@ public class HBCheckTask {
} }
} }
} }
}
} }