/** * @param corr The request correlator to be used. A request correlator sends requests tagged with a unique ID and * notifies the sender when matching responses are received. The reason {@code GroupRequest} uses * it instead of a {@code Transport} is that multiple requests/responses might be sent/received concurrently * @param targets The targets, which are supposed to receive the message. Any receiver not in this set will * discard the message. Targets are always a subset of the current membership * @param options The request options to be used for this call */ public GroupRequest(RequestCorrelator corr, Collection<Address> targets, RequestOptions options) { super(corr, options); rsps=new RspList<>(targets.size()); targets.forEach(target -> rsps.put(target, new Rsp<>())); }
public RspList<T> addRsp(Address sender, T retval) { Rsp<T> rsp=get(sender); if(rsp != null) { rsp.setValue(retval); return this; } put(sender, new Rsp<>(retval)); return this; }
public void addRsp(Address sender, Object retval) { Rsp rsp=(Rsp)get(sender); if(rsp != null) { rsp.sender=sender; rsp.retval=retval; rsp.received=true; rsp.suspected=false; return; } rsps.put(sender, new Rsp(sender, retval)); }
public void addSuspect(Address sender) { Rsp rsp=(Rsp)get(sender); if(rsp != null) { rsp.sender=sender; rsp.retval=null; rsp.received=false; rsp.suspected=true; return; } rsps.put(sender, new Rsp(sender, true)); }
public void addNotReceived(Address sender) { Rsp rsp=(Rsp)get(sender); if(rsp == null) rsps.put(sender, new Rsp(sender)); }
/** * @param corr The request correlator to be used. A request correlator sends requests tagged with a unique ID and * notifies the sender when matching responses are received. The reason {@code GroupRequest} uses * it instead of a {@code Transport} is that multiple requests/responses might be sent/received concurrently * @param targets The targets, which are supposed to receive the message. Any receiver not in this set will * discard the message. Targets are always a subset of the current membership * @param options The request options to be used for this call */ public GroupRequest(RequestCorrelator corr, Collection<Address> targets, RequestOptions options) { super(corr, options); rsps=new RspList<>(targets.size()); targets.forEach(target -> rsps.put(target, new Rsp<>())); }
/** * This method sets the <code>membership</code> variable to the value of * <code>members</code>. It requires that the caller already hold the * <code>rsp_mutex</code> lock. * @param mbrs The new list of members */ public final void reset(Vector<Address> mbrs) { if(mbrs != null) { synchronized(requests) { requests.clear(); for(Address mbr: mbrs) { requests.put(mbr, new Rsp(mbr)); } } // maintain local membership synchronized(this.members) { this.members.clear(); this.members.addAll(mbrs); } } else { synchronized(requests) { for(Rsp rsp: requests.values()) { rsp.setReceived(false); rsp.setValue(null); } } } }
public RspList<T> addRsp(Address sender, T retval) { Rsp<T> rsp=get(sender); if(rsp != null) { rsp.setValue(retval); return this; } put(sender, new Rsp<>(retval)); return this; }