/** * @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<>())); }
/** Returns the results as a RspList */ public RspList getResults() { synchronized(requests) { Collection rsps=requests.values(); return new RspList(rsps); } }
/** * @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<>())); }
return new RspList();
public RspList callRemoteMethods(Vector dests, MethodCall method_call, int mode, long timeout, boolean use_anycasting, boolean oob) { if(dests != null && dests.isEmpty()) { // don't send if dest list is empty if(log.isTraceEnabled()) log.trace(new StringBuffer("destination list of ").append(method_call.getName()). append("() is empty: no need to send message")); return new RspList(); } if(log.isTraceEnabled()) log.trace(new StringBuffer("dests=").append(dests).append(", method_call=").append(method_call). append(", mode=").append(mode).append(", timeout=").append(timeout)); byte[] buf; try { buf=req_marshaller != null? req_marshaller.objectToByteBuffer(method_call) : Util.objectToByteBuffer(method_call); } catch(Exception e) { // if(log.isErrorEnabled()) log.error("exception", e); // we will change this in 2.4 to add the exception to the signature // (see http://jira.jboss.com/jira/browse/JGRP-193). The reason for a RTE is that we cannot change the // signature in 2.3, otherwise 2.3 would be *not* API compatible to prev releases throw new RuntimeException("failure to marshal argument(s)", e); } Message msg=new Message(null, null, buf); if(oob) msg.setFlag(Message.OOB); RspList retval=super.castMessage(dests, msg, mode, timeout, use_anycasting); if(log.isTraceEnabled()) log.trace("responses: " + retval); return retval; }
if(log.isTraceEnabled()) log.trace("destination list is empty, won't send message"); return new RspList(); // return empty response list