Пример #1
0
 /** 检查本机与注册中心的时间误差秒数是否在允许范围. */
 public void checkMaxTimeDiffSecondsTolerable() {
   int maxTimeDiffSeconds =
       Integer.parseInt(jobNodeStorage.getJobNodeData(ConfigurationNode.MAX_TIME_DIFF_SECONDS));
   if (-1 == maxTimeDiffSeconds) {
     return;
   }
   long timeDiff = Math.abs(System.currentTimeMillis() - jobNodeStorage.getRegistryCenterTime());
   if (timeDiff > maxTimeDiffSeconds * 1000L) {
     throw new TimeDiffIntolerableException(
         Long.valueOf(timeDiff / 1000).intValue(), maxTimeDiffSeconds);
   }
 }