public int accept(int ins_num, int income_seq, String content) throws RemoteException {
    if (!work) return -1;

    Instance res = instances.get(ins_num);

    if (res == null) return -1;
    else {

      if (income_seq >= res.n_p) {

        res.n_p = income_seq;

        res.n_a = income_seq;

        res.content = content;

        res.decided = true;

        INS_NUM++;

        return income_seq;
      }
    }

    return -1;
  }
  public void decide(int income_seq, Operation op) throws RemoteException {

    // set corresponding Op decided, assume no collision happens

    if (!work) return;

    if (op == null) return;

    Instance ins = instances.get(op.op_num);

    if (!ins.decided) {

      ins.decided = true;

      INS_NUM++;

      ins.n_a = income_seq;

      ins.content = op.content;
    }

    return;
  }