コード例 #1
0
    public int onEnd() {
      int ret = super.onEnd();
      SSResponder parent = (SSResponder) getParent();

      // If a reply was sent back, adjust the template and deadline of the
      // RECEIVE_NEXT state
      ACLMessage reply = (ACLMessage) getDataStore().get(parent.REPLY_KEY);
      if (reply != null) {
        MsgReceiver mr = (MsgReceiver) parent.getState(RECEIVE_NEXT);
        mr.setTemplate(createNextMsgTemplate(reply));

        Date d = reply.getReplyByDate();
        if (d != null && d.getTime() > System.currentTimeMillis()) {
          mr.setDeadline(d.getTime());
        } else {
          mr.setDeadline(MsgReceiver.INFINITE);
        }
      }

      parent.afterReply(reply);
      return ret;
    }