/** * Returns the value associated with address key * @param key * @return Object value */ public T getValue(Object key) { Rsp<T> rsp=get(key); return rsp != null? rsp.getValue() : null; }
Address mbr=entry.getKey(); Rsp<Results> rsp=entry.getValue(); Results result=rsp.getValue(); if(result != null) { total_reqs+=result.num_gets + result.num_puts;
/** 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 value associated with address key * @param key * @return Object value */ public T getValue(Object key) { Rsp<T> rsp=get(key); return rsp != null? rsp.getValue() : null; }
/** * Returns the value associated with address key * @param key * @return Object value */ public Object getValue(Object key) { Rsp rsp=(Rsp)get(key); return rsp != null? rsp.getValue() : 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; }
Object item = response.getValue(); if (item instanceof NoHandlerForRPC || item instanceof NoMuxHandler)
private boolean containsOnlyNulls(RspList l) { for (Rsp r : l.values()) { if (r.getValue() != null || !r.wasReceived() || r.wasSuspected()) return false; } return true; }
VoteResult result = (VoteResult)response.getValue();
for (Map.Entry<Address, Rsp> entry : retval.entrySet()) Object value = entry.getValue().getValue(); if (value instanceof RequestIgnoredResponse)
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; }
Object object = response.getValue();
@SuppressWarnings({"unchecked"}) public List<Response> sendSynchronous(ResponseCommand command, long timeout) throws MessageException { List<Response> values = new ArrayList<Response>(); List<Address> addresses = helper.getRuntimeAddressesInZone(zoneName, domainChannel.getView()); Vector<Address> dest = new Vector<Address>(addresses); byte[] payload = helper.serialize(command); Message message = new Message(null, domainChannel.getAddress(), payload); RequestOptions options = new RequestOptions(ResponseMode.GET_ALL, timeout); RspList responses; try { responses = domainDispatcher.castMessage(dest, message, options); } catch (Exception e) { throw new MessageException("Error sending message", e); } Set<Map.Entry<Address, Rsp<?>>> set = responses.entrySet(); for (Map.Entry<Address, Rsp<?>> entry : set) { Object val = entry.getValue().getValue(); assert val instanceof byte[] : " expected byte[] for response"; Response response = (Response) helper.deserialize((byte[]) val); values.add(response); } return values; }