public List<Address> getMembers() { if (rpcManager == null) return null; return rpcManager.getMembers(); }
public List<Address> getMembersOutsideBuddyGroup() { List<Address> members = new ArrayList<Address>(rpcManager.getMembers()); members.remove(rpcManager.getLocalAddress()); members.removeAll(getBuddyAddresses()); return members; }
protected void broadcastRollback(GlobalTransaction gtx, InvocationContext ctx) throws Throwable { boolean remoteCallSync = configuration.isSyncRollbackPhase(); if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1) { // Broadcast rollback() to all other members (excluding myself) try { broadcastTxs.remove(gtx); RollbackCommand rollbackCommand = commandsFactory.buildRollbackCommand(gtx); if (log.isDebugEnabled()) log.debug("running remote rollback for " + gtx + " and coord=" + rpcManager.getLocalAddress()); replicateCall(ctx, rollbackCommand, remoteCallSync, ctx.getOptionOverrides()); } catch (Exception e) { log.error("Rollback failed", e); throw e; } } }
protected void broadcastCommit(GlobalTransaction gtx, InvocationContext ctx) throws Throwable { boolean remoteCallSync = configuration.isSyncCommitPhase(); // Broadcast commit() to all members (exclude myself though) if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1) { try { broadcastTxs.remove(gtx); CommitCommand commitCommand = commandsFactory.buildCommitCommand(gtx); if (log.isDebugEnabled()) log.debug("running remote commit for " + gtx + " and coord=" + rpcManager.getLocalAddress()); // for an optimistic commit we don't need to force an OOB message since O/L means we have non-blocking reads. replicateCall(ctx, commitCommand, remoteCallSync, ctx.getOptionOverrides(), false); } catch (Exception e) { log.error("Commit failed", e); throw e; } } }
protected void broadcastPrepare(OptimisticPrepareCommand command, GlobalTransaction gtx, InvocationContext ctx) throws Throwable { // this method will return immediately if we're the only member if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1) { // Map method calls to data versioned equivalents. // See JBCACHE-843 and docs/design/DataVersioning.txt DataVersionPopulator populator = new DataVersionPopulator(getTransactionWorkspace(ctx), command.getModifications().size()); // visit all elements in the collection and apply the DataVersionPopulator to ensure all commands have data versions set. populator.visitCollection(null, command.getModifications()); ReplicableCommand toBroadcast = commandsFactory.buildOptimisticPrepareCommand(gtx, populator.versionedCommands, command.getLocalAddress(), command.isOnePhaseCommit()); //record the things we have possibly sent broadcastTxs.add(gtx); if (log.isDebugEnabled()) { log.debug("(" + rpcManager.getLocalAddress() + "): broadcasting prepare for " + gtx + " (" + command.getModificationsCount() + " modifications"); } replicateCall(ctx, toBroadcast, defaultSynchronous, ctx.getOptionOverrides()); } else { //no members, ignoring if (log.isDebugEnabled()) { log.debug("(" + rpcManager.getLocalAddress() + "):not broadcasting prepare as members are " + rpcManager.getMembers()); } } }
List<Address> mbrs = rpcManager.getMembers(); Boolean searchSubtrees = buddyManager.isDataGravitationSearchBackupTrees(); GravitateDataCommand command = commandsFactory.buildGravitateDataCommand(fqn, searchSubtrees); List resps = rpcManager.callRemoteMethods(null, command, GroupRequest.GET_ALL, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(rpcManager.getMembers().size()), false);
/** * If we are within one transaction we won't do any replication as replication would only be performed at commit time. * If the operation didn't originate locally we won't do any replication either. */ private Object handleCrudMethod(InvocationContext ctx, VisitableCommand command, boolean forceAsync) throws Throwable { boolean local = isLocalModeForced(ctx); if (local && ctx.getTransaction() == null) return invokeNextInterceptor(ctx, command); // FIRST pass this call up the chain. Only if it succeeds (no exceptions) locally do we attempt to replicate. Object returnValue = invokeNextInterceptor(ctx, command); if (ctx.getTransaction() == null && ctx.isOriginLocal()) { if (trace) { log.trace("invoking method " + command.getClass().getSimpleName() + ", members=" + rpcManager.getMembers() + ", mode=" + configuration.getCacheMode() + ", exclude_self=" + true + ", timeout=" + configuration.getSyncReplTimeout()); } replicateCall(ctx, command, !forceAsync && isSynchronous(ctx.getOptionOverrides()), ctx.getOptionOverrides()); } else { if (local) ctx.getTransactionContext().addLocalModification((WriteCommand) command); } return returnValue; }