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 Instance prepare(int ins_num, int income_seq) throws RemoteException { if (!work) return null; Instance res = instances.get(ins_num); if (res == null) return null; else { if (income_seq > res.n_p) { res.n_p = income_seq; return res; } else return null; } }