private void closePreConnAndSendHistory(JSONObject jsonobj, TPushConnection resource) {
    String preConnId = (String) jsonobj.get("preConnId");
    String curConnId = (String) jsonobj.get("curConnId");
    String userId = (String) jsonobj.get("userId");
    String pretstr = (String) jsonobj.get("lastTimestamp");
    // String curtstr = jsonobj.getString("timestamp");

    // 1.close pre conn
    if (preConnId != null && !preConnId.trim().equals("")) {
      // 1.close pre conn
      CommunicationBeanConfig.getTopicCenterBean().remove(preConnId, userId);
    }

    // 2.send history notices
    if (!StringUtil.isEmpty(userId) && !StringUtil.isEmpty(pretstr)) {
      long prets = Long.parseLong(pretstr);
      IPacketNoticeHandler historyNoticeHandler =
          TPushServerBeanFactory.getBean("IPacketNoticeHandler", IPacketNoticeHandler.class);
      historyNoticeHandler.handle(resource, prets, userId, curConnId);
    }
  }
  private void calMessageArrive(JSONObject jsonobj, String message) {
    try {
      // process the arrive message
      String sn = jsonobj.getString(AbstractBaseMessage.FIELD_ARRIVE_ID);

      String str = MessageContainer.remove(Long.valueOf(sn));
      if (StringUtil.isEmpty(str)) {
        logger.error("MessageStatModel in not exist in map.arriveId:" + sn);
      }
    } catch (Exception e) {
      logger.error(e.getMessage());
    }
  }