public Iterator<Rsp<T>> iterator() { return values().iterator(); } }
public int numReceived() { return (int)values().stream().filter(Rsp::wasReceived).count(); }
public int numSuspectedMembers() { return (int)values().stream().filter(Rsp::wasSuspected).count(); }
/** Returns the first value in the response set. This is random, but we try to return a non-null value first */ public T getFirst() { Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst(); return retval.isPresent()? retval.get().getValue() : null; }
/** * Returns the results from non-suspected members that are not null. */ public List<T> getResults() { return values().stream().filter(rsp -> rsp.wasReceived() && rsp.getValue() != null) .collect(() -> new ArrayList<>(size()), (list,rsp) -> list.add(rsp.getValue()), (l,r) -> {}); }
if(i > 0 && i % print == 0) System.out.print("."); boolean all_received=rsps.values().stream().allMatch(Rsp::wasReceived); if(!all_received) System.err.printf("didn't receive all responses: %s\n", rsps);
new MethodCall(GET, key), new RequestOptions(ResponseMode.GET_ALL, call_timeout)); for(Rsp rsp: rsps.values()) { Object obj=rsp.getValue(); if(obj == null || obj instanceof Throwable)
public Iterator<Rsp<T>> iterator() { return values().iterator(); } }
public int numSuspectedMembers() { return (int)values().stream().filter(Rsp::wasSuspected).count(); }
public int numReceived() { return (int)values().stream().filter(Rsp::wasReceived).count(); }
public String toString() { StringBuffer ret=new StringBuffer(); Rsp rsp; for(Iterator it=values().iterator(); it.hasNext();) { rsp=(Rsp)it.next(); ret.append("[" + rsp + "]\n"); } return ret.toString(); }
public int numSuspectedMembers() { int num=0; Rsp rsp; Collection values=values(); for(Iterator it=values.iterator(); it.hasNext();) { rsp=(Rsp)it.next(); if(rsp.wasSuspected()) num++; } return num; }
/** Returns the first value in the response set. This is random, but we try to return a non-null value first */ public T getFirst() { Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst(); return retval.isPresent()? retval.get().getValue() : null; }
public Vector getSuspectedMembers() { Vector retval=new Vector(); Rsp rsp; for(Iterator it=values().iterator(); it.hasNext();) { rsp=(Rsp)it.next(); if(rsp.wasSuspected()) retval.addElement(rsp.getSender()); } return retval; }
/** Returns the first value in the response set. This is random, but we try to return a non-null value first */ public Object getFirst() { Collection values=values(); for(Iterator it=values.iterator(); it.hasNext();) { Rsp rsp=(Rsp)it.next(); if(rsp.getValue() != null) return rsp.getValue(); } return null; }
/** * Returns the results from non-suspected members that are not null. */ public Vector getResults() { Vector ret=new Vector(); Rsp rsp; Object val; for(Iterator it=values().iterator(); it.hasNext();) { rsp=(Rsp)it.next(); if(rsp.wasReceived() && (val=rsp.getValue()) != null) ret.addElement(val); } return ret; }
/** * Returns the results from non-suspected members that are not null. */ public List<T> getResults() { return values().stream().filter(rsp -> rsp.wasReceived() && rsp.getValue() != null) .collect(() -> new ArrayList<>(size()), (list,rsp) -> list.add(rsp.getValue()), (l,r) -> {}); }
private boolean containsOnlyNulls(RspList l) { for (Rsp r : l.values()) { if (r.getValue() != null || !r.wasReceived() || r.wasSuspected()) return false; } return true; }
private <T> List<T> processResponseList(RspList<T> rspList, String serviceName, String methodName, Object[] args, boolean trace) { List<T> result = new ArrayList<T>(rspList.size()); if (rspList != null) { for (Rsp<T> response : rspList.values()) { // Only include successful received responses if (response.hasException()) { Throwable e = response.getException(); ClusteringImplLogger.ROOT_LOGGER.debugf(e, "%s invocation failure from %s: %s(%s)", serviceName, response.getSender(), methodName, (args != null) ? Arrays.asList(args) : ""); } else if (response.wasReceived()) { result.add(response.getValue()); } else if (trace) { ClusteringImplLogger.ROOT_LOGGER.tracef("Ignoring non-received response: %s", response); } } } return result; }