private void makeRemoteCall(List<Address> recipients, ReplicableCommand call) throws Exception { // remove non-members from dest list if (recipients != null) { Iterator<Address> recipientsIt = recipients.iterator(); List<Address> members = cache.getMembers(); while (recipientsIt.hasNext()) { if (!members.contains(recipientsIt.next())) { recipientsIt.remove(); } } } rpcManager.callRemoteMethods(recipients == null ? null : new Vector<Address>(recipients), call, true, config.getBuddyCommunicationTimeout(), false); }
/** * Flushes existing method calls. */ public void flush() { List<ReplicableCommand> toReplicate; synchronized (elements) { if (log.isTraceEnabled()) log.trace("flush(): flushing repl queue (num elements=" + elements.size() + ")"); toReplicate = new ArrayList<ReplicableCommand>(elements); elements.clear(); } if (toReplicate.size() > 0) { try { ReplicateCommand replicateCommand = commandsFactory.buildReplicateCommand(toReplicate); // send to all live nodes in the cluster rpcManager.callRemoteMethods(null, replicateCommand, false, configuration.getSyncReplTimeout(), false); } catch (Throwable t) { log.error("failed replicating " + toReplicate.size() + " elements in replication queue", t); } } } }
/** * Mimics a partial flush between the current instance and the address to flush, by opening and closing the necessary * latches on both ends. * @param addressToFlush address to flush in addition to the current address * @param block if true, mimics setting a flush. Otherwise, mimics un-setting a flush. * @throws Exception if there are issues */ private void mimicPartialFlushViaRPC(Address addressToFlush, boolean block) throws Exception { StateTransferControlCommand cmd = commandsFactory.buildStateTransferControlCommand(block); Vector<Address> recipient = new Vector<Address>(); recipient.add(addressToFlush); if (!block) rpcManager.getFlushTracker().unblock(); rpcManager.callRemoteMethods(recipient, cmd, true, cfg.getStateRetrievalTimeout(), true); if (block) rpcManager.getFlushTracker().block(); }
protected void replicateCall(Vector<Address> recipients, ReplicableCommand call, boolean sync, boolean wrapCacheCommandInReplicateMethod, boolean useOutOfBandMessage, boolean isBroadcast, long timeout) throws Throwable { if (trace) log.trace("Broadcasting call " + call + " to recipient list " + recipients); if (!sync && replicationQueue != null && !usingBuddyReplication) { if (trace) log.trace("Putting call " + call + " on the replication queue."); replicationQueue.add(commandsFactory.buildReplicateCommand(call)); } else { if (usingBuddyReplication && !isBroadcast) call = buddyManager.transformFqns((VisitableCommand) call); Vector<Address> callRecipients = recipients; if (callRecipients == null) { callRecipients = usingBuddyReplication && !isBroadcast ? buddyManager.getBuddyAddressesAsVector() : null; if (trace) log.trace("Setting call recipients to " + callRecipients + " since the original list of recipients passed in is null."); } ReplicableCommand toCall = wrapCacheCommandInReplicateMethod ? commandsFactory.buildReplicateCommand(call) : call; List rsps = rpcManager.callRemoteMethods(callRecipients, toCall, sync, // is synchronised? timeout, useOutOfBandMessage ); if (trace) log.trace("responses=" + rsps); if (sync) checkResponses(rsps); } }
List resps; resps = cache.getRPCManager().callRemoteMethods(null, clusteredGet, GroupRequest.GET_ALL, config.getTimeout(), new ResponseValidityFilter(cache.getMembers(), cache.getLocalAddress()), false);
List resps = rpcManager.callRemoteMethods(null, command, GroupRequest.GET_ALL, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(rpcManager.getMembers().size()), false);