public T getValue() { return hasException()? null : (T)value; }
public Throwable getException() { return hasException()? (Throwable)value : null; }
public String toString() { StringBuilder sb=new StringBuilder(); if(value != null) { if(!hasException()) sb.append("value=").append(value); else sb.append("exception=").append(getException()); sb.append(", "); } sb.append("received=").append(wasReceived()).append(", suspected=").append(wasSuspected()); if(wasUnreachable()) sb.append(" (unreachable)"); return sb.toString(); } }
public Throwable getException() { return hasException()? (Throwable)value : null; }
public T getValue() { return hasException()? null : (T)value; }
public String toString() { StringBuilder sb=new StringBuilder(); if(value != null) { if(!hasException()) sb.append("value=").append(value); else sb.append("exception=").append(getException()); sb.append(", "); } sb.append("received=").append(wasReceived()).append(", suspected=").append(wasSuspected()); if(wasUnreachable()) sb.append(" (unreachable)"); return sb.toString(); } }
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; }
private void throwWorkExceptionIfHasExption(RspList<ResponseValues> rspList) throws WorkException { if (rspList != null && rspList.getFirst() != null) { for (Rsp<ResponseValues> rsp : rspList) { if (rsp.hasException()) { Throwable t = rsp.getException(); if (t instanceof WorkException) { throw (WorkException)t; } else { WorkException we = new WorkException(rsp.getException().getMessage()); we.initCause(rsp.getException()); throw we; } } } } }