Esempio n. 1
0
  public void run() {
    long currTime = System.currentTimeMillis();
    while (running) {
      try {
        currTime = System.currentTimeMillis();
        lastHeartbeat = currTime;
        if (heartbeat == null) {
          return;
        }
        heartbeat.run(currTime);
        if (currTime > logTime) {
          logTime = currTime + LOG_OFFSET;
          LogUtil.warn(getName());
        }

      } catch (Exception e) {
        LogUtil.error(getName() + "-事件线程抛出异常", e);
      }
      try {
        synchronized (this) {
          wait(SLEEP_TIME);
        }
      } catch (InterruptedException e) {
        LogUtil.error(getName() + "-sleep抛出异常", e);
      }
    }
    LogUtil.error(getName() + "线程退出");
    running = false;
  }
Esempio n. 2
0
 @Override
 public void run() {
   try {
     DALFactory.getInstRankDantaDAL().update(data, 0);
   } catch (Exception e) {
     LogUtil.error("更新当日丹塔排行数据异常", e);
   }
 }
Esempio n. 3
0
 public boolean isOvertime(long currTime) {
   boolean overtime = currTime - lastHeartbeat > OVERTIME;
   if (overtime) {
     LogUtil.error(
         (currTime - lastHeartbeat)
             + " , "
             + OVERTIME
             + " --ThreadOvertime "
             + this
             + ", "
             + getRunningName());
   }
   return overtime;
 }
Esempio n. 4
0
 /**
  * 物品出售
  *
  * @author mp
  * @date 2014-8-4 上午10:04:05
  * @param msgMap
  * @param channelId @Description
  */
 public void sell(HashMap<String, Object> msgMap, String channelId) {
   try {
     HandlerFactory.getThingHandler().sell(msgMap, channelId);
   } catch (Exception e) {
     LogUtil.error(
         "instPlayerId = "
             + PlayerMapUtil.getPlayerIdByChannelId(channelId)
             + ", "
             + DictMap.sysMsgRuleMap.get((int) msgMap.get("header") + "").getName()
             + ",  "
             + msgMap,
         e);
     e.printStackTrace();
     MessageUtil.sendFailMsg(channelId, msgMap, errorHint(msgMap));
   }
 }