@Override public CancelCriterion getCancelCriterion() { return this.ds.getCancelCriterion(); }
public ManagementListener(InternalDistributedSystem system) { this(system.getCancelCriterion(), system, new ManagementAdapter(), new ReentrantReadWriteLock()); }
public TXCommitMessage waitForMessage(Object key, DistributionManager dm) { TXCommitMessage msg = null; synchronized (this.txInProgress) { msg = (TXCommitMessage) this.txInProgress.get(key); while (msg == null) { try { dm.getSystem().getCancelCriterion().checkCancelInProgress(null); this.txInProgress.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } msg = (TXCommitMessage) this.txInProgress.get(key); } } return msg; }
/** * Places a <code>SnapshotResultMessage</code> on a queue to be processed asynchronously. */ void enqueueSnapshotResults(SnapshotResultMessage msg) { if (!isListening()) { return; } for (;;) { this.system.getCancelCriterion().checkCancelInProgress(null); boolean interrupted = Thread.interrupted(); try { snapshotResults.put(msg); break; } catch (InterruptedException ignore) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } }
@Override public boolean isDestroyed() { return this.dlock.isDestroyed() || this.system.getCancelCriterion().isCancelInProgress(); }
public GemFireStatSampler(InternalDistributedSystem con) { super(con.getCancelCriterion(), new StatSamplerStats(con, con.getId())); this.con = con; }
public GemFireStatSampler(InternalDistributedSystem con, LogFile logFile) { super(con.getCancelCriterion(), new StatSamplerStats(con, con.getId()), logFile); this.con = con; }
for (;;) { try { this.system.getCancelCriterion().checkCancelInProgress(null); } catch (DistributedSystemDisconnectedException de) {
return null; this.system.getCancelCriterion().checkCancelInProgress(null);
ds.getCancelCriterion().checkCancelInProgress(null); if (services.get(serviceName) != null) { throw new IllegalArgumentException(
private void join() { daemon = new DSConnectionDaemon(); daemon.start(); // give the daemon some time to get us connected // we don't want to wait forever since there may be no one to connect to try { long endTime = System.currentTimeMillis() + 2000; // wait 2 seconds while (!connected && daemon.isAlive() && System.currentTimeMillis() < endTime) { daemon.join(200); } } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); // Peremptory cancellation check, but keep going this.system.getCancelCriterion().checkCancelInProgress(ignore); } }
this.system.getCancelCriterion().checkCancelInProgress(null); boolean interrupted = Thread.interrupted(); try {
private static void elderSyncWait(InternalDistributedSystem sys, InternalDistributedMember newElder, DLockService dls) { GrantorRequestContext grc = sys.getGrantorRequestContext(); grc.waitingToChangeElder = true; final String message = String.format( "GrantorRequestProcessor.elderSyncWait: The current Elder %s is waiting for the new Elder %s.", new Object[] {grc.currentElder, newElder}); while (grc.waitingToChangeElder) { logger.info(LogMarker.DLS_MARKER, message); boolean interrupted = Thread.interrupted(); try { grc.elderLockCondition.await(sys.getConfig().getMemberTimeout()); } catch (InterruptedException ignore) { interrupted = true; sys.getCancelCriterion().checkCancelInProgress(ignore); } finally { if (interrupted) Thread.currentThread().interrupt(); } } }
TXLockServiceImpl(String name, InternalDistributedSystem sys) { if (sys == null) { throw new IllegalStateException( "TXLockService cannot be created until connected to distributed system."); } sys.getCancelCriterion().checkCancelInProgress(null); this.system = sys; this.recoveryLock = new StoppableReentrantReadWriteLock(sys.getCancelCriterion()); this.dlock = (DLockService) DLockService.create(name, sys, true /* distributed */, true /* destroyOnDisconnect */, true /* automateFreeResources */); this.dlock.setDLockRecoverGrantorMessageProcessor(new TXRecoverGrantorMessageProcessor()); this.dlock.setDLockLessorDepartureHandler(new TXLessorDepartureHandler()); }
private RemoteGfManagerAgent mockConnectedAgent(GfManagerAgentConfig config) { RemoteGfManagerAgent agent = spy(new RemoteGfManagerAgent(config)); InternalDistributedSystem system = mock(InternalDistributedSystem.class); when(system.isConnected()).thenReturn(true); when(system.getCancelCriterion()).thenReturn(mock(Services.Stopper.class)); agent.system = system; agent.connected = true; return agent; }
when(system.getConfig()).thenReturn(config); when(system.getDistributionManager()).thenReturn(distributionManager); when(system.getCancelCriterion()).thenReturn(systemCancelCriterion); when(system.getClock()).thenReturn(clock); when(system.getLogWriter()).thenReturn(logger);
/** * get the distribution manager for this processor. If the distributed system has a distribution * manager, it is used. Otherwise, we expect a distribution manager has been set with * setDistributionManager and we'll use that */ public DistributionManager getDistributionManager() { try { DistributionManager result = this.system.getDistributionManager(); if (result == null) { result = this.dmgr; Assert.assertTrue(result != null, "null DistributionManager"); } return result; } catch (IllegalStateException ex) { // fix for bug 35000 this.system.getCancelCriterion().checkCancelInProgress(null); throw new DistributedSystemDisconnectedException(ex.getMessage()); } }
@Before public void before() { member0 = mock(InternalDistributedMember.class); clusterDistributionManager = mock(ClusterDistributionManager.class); cancelCriterion = mock(CancelCriterion.class); system = mock(InternalDistributedSystem.class); systemCancelCriterion = mock(CancelCriterion.class); memberManager = mock(MembershipManager.class); when(clusterDistributionManager.getCancelCriterion()).thenReturn(cancelCriterion); when(clusterDistributionManager.getSystem()).thenReturn(system); when(system.getCancelCriterion()).thenReturn(systemCancelCriterion); when(clusterDistributionManager.getMembershipManager()).thenReturn(memberManager); }
private InternalDistributedMember getElderId() { InternalDistributedMember elder = this.dm.getElderId(); if (elder == null) { this.dm.getSystem().getCancelCriterion().checkCancelInProgress(null); } Assert.assertTrue(elder != null); return elder; }
public InternalDistributedMember getElderId() throws DistributedSystemDisconnectedException { if (clusterDistributionManager.isCloseInProgress()) { throw new DistributedSystemDisconnectedException( "no valid elder when system is shutting down", clusterDistributionManager.getRootCause()); } clusterDistributionManager.getSystem().getCancelCriterion().checkCancelInProgress(null); return getElderCandidate(); }