/** * Returns the DistributedMember for the current cache */ public static DistributedMember getMemberId() { return _getDM().getDistributionManagerId(); }
/** * Returns the set of members that this processor should care about. * @return a Set of the current members * @since 5.7 */ protected Set getDistributionManagerIds() { return getDistributionManager().getDistributionManagerIds(); }
/** adds the log as a membership listener to the given system and logs the view when members join */ public void monitorUse(InternalDistributedSystem system) { this.system = system; DM dmgr = system.getDistributionManager(); dmgr.addMembershipListener(this); MembershipManager mmgr = dmgr.getMembershipManager(); if (mmgr != null) { log("Log opened with new distributed system connection. " + system.getDM().getMembershipManager().getView()); } else { // membership manager not initialized? log("Log opened with new distributed system connection. Membership view not yet available in this VM."); } }
public void run() { DM dm = getSystem().getDistributionManager(); assertEquals("For DM " + dm.getId(), 3, dm.getOtherNormalDistributionManagerIds().size()); FirstMessage message = new FirstMessage(); dm.putOutgoing(message); } });
/** * Sends a shutdownAll request to all other members and performs local * shutdownAll processing in the waitingThreadPool. */ public static Set<?> send(final DM dm, long timeout) { Set<?> recipients = dm.getOtherNormalDistributionManagerIds(); recipients.remove(dm.getDistributionManagerId()); return new ShutdownAllRequest().send(dm, recipients, timeout); }
@Override protected final Set<?> addListenerAndGetMembers() { if (!this.allowExecutionOnAdminMembers) { return getDistributionManager() .addMembershipListenerAndGetDistributionManagerIds(this); } else { // add to all membership listener to enable reading replies from // admin members for GfxdConfigMessage for example return getDistributionManager().addAllMembershipListenerAndGetAllIds( this); } }
@Override public double getEstimatedRowCount(VTIEnvironment vtiEnvironment) throws SQLException { return this.dm.getDistributionManagerIdsIncludingAdmin().size(); }
private int getDSID(LocalRegion lr) { return lr.getDistributionManager().getDistributedSystemId(); } }
static boolean sendChunk(InternalDistributedMember recipient, int processorId, int bucketId, DM dm, HeapDataOutputStream chunk, int seriesNum, int msgNum, int numSeries, boolean lastInSeries, FetchEntriesMessage sourceMessage, boolean hasRVV) { FetchEntriesReplyMessage reply = new FetchEntriesReplyMessage(recipient, processorId, bucketId, chunk, seriesNum, msgNum, numSeries, lastInSeries, sourceMessage, hasRVV); Set failures = dm.putOutgoing(reply); return (failures == null) || (failures.size() == 0); }
public void run() { InternalDistributedSystem ds = getSystem(); int retry = 100; while (retry-- > 0 && ds.getDistributionManager().getAdminMemberSet().size() > 0) { pause(100); } assertEquals(new HashSet(), ds.getDistributionManager().getOtherNormalDistributionManagerIds()); assertEquals(0, ds.getDistributionManager().getAdminMemberSet().size()); } };
/** * Creates a new <code>ReplyProcessor</code> that wants replies from * a single member of a distributed system. * * @param dm the DistributionManager to use for messaging and membership * @param member the member this processor wants a reply from */ public ReplyProcessor21(DM dm, InternalDistributedMember member) { this(dm, dm.getSystem(), member, null, true); }
private InternalDistributedMember getElderId() { InternalDistributedMember elder = this.dm.getElderId(); if (elder == null) { this.dm.getSystem().getCancelCriterion().checkCancelInProgress(null); } Assert.assertTrue(elder != null); return elder; }
protected final void initialize() { subInit(); getDistributionManager().addMembershipListener(this.ml); }
@Override protected void preWait() { this.waiting = true; DM mgr = getDistributionManager(); this.statStart = mgr.getStats().startReplyWait(); // Note we do not use addMembershipListenerAndGetDistributionManagerIds // because this is the startup message and we do not yet have any // members in the dm's list. mgr.addMembershipListener(this); // Set activeMembers = mgr.addMembershipListenerAndGetDistributionManagerIds(this); // synchronized (this.members) { // for (int i = 0; i < getMembers().length; i++) { // if (!activeMembers.contains(getMembers()[i])) { // memberDeparted(getMembers()[i], false); // } // } // } }
public Set<DistributedMember> getMembers() { return Collections.unmodifiableSet(this.dm.getOtherNormalDistributionManagerIds()); }
/** * Creates instance of grantor for the lock service. * * @param dlock the lock service the grantor is authority for * @param vId unique id that the elder increments for each new grantor */ private DLockGrantor(DLockService dlock, long vId) { this.dm = dlock.getDistributionManager(); CancelCriterion stopper = this.dm.getCancelCriterion(); this.whileInitializing = new StoppableCountDownLatch(stopper, 1); this.untilDestroyed = new StoppableCountDownLatch(stopper, 1); this.dlock = dlock; this.destroyLock = new StoppableReentrantReadWriteLock(stopper); this.versionId.set(vId); this.dm.addMembershipListener(this.membershipListener); this.thread = new DLockGrantorThread(this, stopper); this.dlock.getStats().incGrantors(1); }
public void start() { final DM distributionManager = cache.getDistributedSystem().getDistributionManager(); //We need to watch for pure admin guys that depart. this allMembershipListener set //looks like it should receive those events. Set allIds = distributionManager.addAllMembershipListenerAndGetAllIds(this); if(!allIds.contains(sender)) { cleanup(); throw new IllegalStateException("The admin member requesting a backup has already departed"); } }
private boolean identifyElder() { SharedMap map = DLockBlackboard.getInstance().getSharedMap(); DistributedSystem system = getDistributedSystem(); DM dm = ((InternalDistributedSystem)system).getDistributionManager(); Serializable whoIThinkElderIs = dm.getElderId(); log().info("ElderID is: " + whoIThinkElderIs); Assert.assertTrue(whoIThinkElderIs != null, "null elder"); boolean elderIsMe = whoIThinkElderIs.equals(dm.getId()); if (elderIsMe) { log().info("Elder identified: " + RemoteTestModule.getMyClientName()); log().info("ElderID is: " + whoIThinkElderIs); map.put(ELDER_ID, whoIThinkElderIs); map.put(ELDER_CLIENT_NAME, RemoteTestModule.getMyClientName()); return true; } else { return false; } }
@Override public Set<DistributedMember> findDistributedMembers(InetAddress address) { Set<InternalDistributedMember> allMembers = dm.getDistributionManagerIdsIncludingAdmin(); Set<DistributedMember> results = new HashSet<DistributedMember>(2); //Search through the set of all members for(InternalDistributedMember member: allMembers) { Set<InetAddress> equivalentAddresses = dm.getEquivalents(member.getInetAddress()); //Check to see if the passed in address is matches one of the addresses on //the given member. if(address.equals(member.getInetAddress()) || equivalentAddresses.contains(address)) { results.add(member); } } return results; }
@Override public boolean getBoolean(int columnNumber) throws SQLException { ResultColumnDescriptor desc = columnInfo[columnNumber - 1]; if (desc.getType().getJDBCTypeId() != Types.BOOLEAN) { throw dataTypeConversion("boolean", desc); } this.wasNull = false; final String columnName = desc.getName(); if (HOSTDATA.equals(columnName)) { final VMKind vmKind = GemFireXDUtils.getVMKind(this.currentMember); if (vmKind != null) { return (vmKind == VMKind.DATASTORE); } else { this.wasNull = true; return false; } } else if (ISELDER.equals(columnName)) { return this.currentMember.equals(this.dm.getElderId()); } throw new GemFireXDRuntimeException("unexpected columnName " + columnName); }