@Override public String toString() { return "Bucket id = " + bucketId + " from local member = " + getDistributionManager().getDistributionManagerId() + ": " + super.toString(); } };
public String forceStop() { if (this.dm == null) { return "no distribution manager"; } String reason = dm.getCancelCriterion().cancelInProgress(); return reason; }
@Override public int getDistributedSystemId() { return ((InternalDistributedSystem) this.ds).getDistributionManager().getDistributedSystemId(); }
public static void send(DistributionManager dm, InternalDistributedMember dest, int processorId, Map<? extends DataSerializable, ? extends DataSerializable> eventState, boolean isHARegion) { RegionStateMessage msg = new RegionStateMessage(dest, processorId, eventState, isHARegion); msg.setSender(dm.getId()); // for EventStateHelper.dataSerialize dm.putOutgoing(msg); }
@Override protected void preWait() { this.waiting = true; DistributionManager 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); // } // } // } } }
private InternalDistributedMember getElderId() { InternalDistributedMember elder = this.dm.getElderId(); if (elder == null) { this.dm.getSystem().getCancelCriterion().checkCancelInProgress(null); } Assert.assertTrue(elder != null); return elder; }
when(distributionManager.getDistributedSystemId()).thenReturn(-1); when(distributionManager.getCancelCriterion()).thenReturn(cancelCriterion); when(distributionManager.getId()).thenReturn(distributedMember); when(distributionManager.getElderId()).thenReturn(distributedMember); when(distributionManager.getSystem()).thenReturn(distributedSystem);
@Before public void setUp() throws Exception { resultCollector = mock(BackupResultCollector.class); dm = mock(DistributionManager.class); sender = mock(InternalDistributedMember.class); member = mock(InternalDistributedMember.class); cache = mock(InternalCache.class); recipients = new HashSet<>(); when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class)); when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); finishBackupFactory = new FinishBackupFactory(); }
/** * Execute basicProcess inside Pooled Executor because grantor may not be initializing which * will require us to wait. * <p> * this.svc and this.grantor must be set before calling this method. */ private void executeBasicProcess(final DistributionManager dm) { final DLockQueryMessage msg = this; dm.getWaitingThreadPool().execute(new Runnable() { @Override public void run() { if (logger.isTraceEnabled(LogMarker.DLS_VERBOSE)) { logger.trace(LogMarker.DLS_VERBOSE, "[executeBasicProcess] {}", msg); } basicProcess(dm, true); } }); }
/** * Return true if our owner already knows that this endpoint is departing */ protected boolean isEndpointShuttingDown(DistributedMember id) { return giveUpOnMember(owner.getDM().getMembershipManager(), id); }
/** * Sends a message and does not wait for a response */ void sendAsync(DistributionMessage msg) { if (system != null) { system.getDistributionManager().putOutgoing(msg); } }
@Override protected AdminResponse createResponse(DistributionManager dm) { HashSet<PersistentID> persistentIds; try { persistentIds = prepareBackupFactory .createPrepareBackup(dm.getDistributionManagerId(), dm.getCache(), properties).run(); } catch (IOException | InterruptedException e) { logger.error(String.format("Error processing request %s.", getClass()), e); return AdminFailureResponse.create(getSender(), e); } return prepareBackupFactory.createBackupResponse(getSender(), persistentIds); }
/** * Creates a new <code>ReplyProcessor</code> that wants replies from some number of members of a * distributed system. Call this method with * {@link ClusterDistributionManager#getDistributionManagerIds} if you want replies from all DMs * including the one hosted in this VM. * * @param dm the DistributionManager to use for messaging and membership * @param initMembers the Set of members this processor wants replies from */ public DirectReplyProcessor(DistributionManager dm, Collection initMembers) { this(dm, dm.getSystem(), initMembers, null); }
InternalDistributedMember idm = dm.getDistributionManagerId(); synchronized (idm) { if (idm.getPort() == 0 && dm instanceof LonerDistributionManager) { int port = sock.getLocalPort(); ((LonerDistributionManager) dm).updateLonerPort(port); this.id.updateID(dm.getDistributionManagerId()); int remoteDistributedSystemId = in.read(); int localDistributedSystemId = ((InternalDistributedSystem) system).getDistributionManager().getDistributedSystemId(); if (localDistributedSystemId >= 0 && localDistributedSystemId == remoteDistributedSystemId) {
@Override protected void process(ClusterDistributionManager dm) { this.dm = dm; // Remove this node from the set of recipients if (this.farSiders != null) { this.farSiders.remove(dm.getId()); } if (this.processorId != 0) { TXLockService.createDTLS(this.dm.getSystem()); // fix bug 38843; no-op if already created synchronized (this) { // Handle potential origin departure this.dm.addMembershipListener(this); // Assume ACK mode, defer processing until we receive a // CommitProcess message if (logger.isDebugEnabled()) { final Object key = getTrackerKey(); logger.debug("Adding key:{} class{} to tracker list", key, key.getClass().getName()); } txTracker.add(this); } if (!this.dm.getDistributionManagerIds().contains(getSender())) { memberDeparted(this.dm, getSender(), false /* don't care */); } } else { basicProcess(); } }
final boolean DEBUG = SystemFailure.TRACE_CLOSE; if (dm != null) { MembershipManager mm = dm.getMembershipManager(); if (mm != null) { if (DEBUG) { dm.setRootCause(SystemFailure.getFailure());
/** * 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; DistributionManager 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."); } }
private void postWait() { waiting = false; removeListener(); final DistributionManager mgr = getDistributionManager(); mgr.getStats().endReplyWait(this.statStart, this.initTime); mgr.getCancelCriterion().checkCancelInProgress(null); }
this.dm.addMembershipListener(this); DistributionConfig dsc = dm.getSystem().getConfig(); String locators = dsc.getLocators(); if (locators == null || locators.equals("")) {
public InternalCache getCache() { return this.dm == null ? null : this.dm.getCache(); }