private void waitBeforeUpdate() { synchronized (indexes) { ++numCreators; // Asif : If there exists any updater thread in progress // we should not allow index creation to proceed. while (numUpdatersInProgress > 0) { ((LocalRegion) getRegion()).getCancelCriterion().checkCancelInProgress(null); boolean interrupted = Thread.interrupted(); try { indexes.wait(); } catch (InterruptedException ignored) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } // while } }
/** * Wait for index initialization before entry create, update, invalidate or destroy operation. * * Note: If the region has a disk region then we should wait for index initialization before * getting region entry lock to avoid deadlock (#44431). */ public void waitForIndexInit() { synchronized (this.indexes) { ++this.numUpdatersInWaiting; while (this.numCreators > 0) { ((LocalRegion) this.getRegion()).getCancelCriterion().checkCancelInProgress(null); boolean interrupted = Thread.interrupted(); try { this.indexes.wait(); } catch (InterruptedException ignored) { interrupted = true; } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } // while --this.numUpdatersInWaiting; ++this.numUpdatersInProgress; } }
/** * Wait until permission is given for expiration to be done. Tests are allowed to suspend * expiration. * * @since GemFire 5.0 */ private void waitOnExpirationSuspension() { for (;;) { getLocalRegion().getCancelCriterion().checkCancelInProgress(null); synchronized (suspendLock) { boolean interrupted = Thread.interrupted(); try { while (expirationSuspended) { suspendLock.wait(); } break; } catch (InterruptedException ex) { interrupted = true; getLocalRegion().getCancelCriterion().checkCancelInProgress(null); // keep going, we can't cancel } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } // synchronized } // for }
this.region.getCancelCriterion().checkCancelInProgress(null); interrupted = Thread.interrupted() || interrupted; long wt = Math.min(RETRY_TIME, waitTimeMs); } catch (InterruptedException ignore) { interrupted = true; region.getCancelCriterion().checkCancelInProgress(null);
@Override public void run() { // async writers main loop // logger.debug("DiskRegion writer started (writer=" + this + ")"); org.apache.geode.CancelCriterion stopper = ((LocalRegion) region).getCancelCriterion(); try { while (!this.shutdownRequested) { // Termination checks SystemFailure.checkFailure(); if (stopper.isCancelInProgress()) { break; } try { Object[] task = (Object[]) pendingTasks.take(); if (this.shutdownRequested) { break; } updateIndexes(task); } catch (InterruptedException ignore) { return; // give up (exit the thread) } } } finally { this.running = false; } }
long startTime = System.currentTimeMillis(); boolean interrupted = false; CancelCriterion stopper = region.getCancelCriterion(); try { do {
@Before public void setup() { region = mock(LocalRegion.class); event = mock(EntryEventImpl.class); serverRegionProxy = mock(ServerRegionProxy.class); cancelCriterion = mock(CancelCriterion.class); regionAttributes = mock(RegionAttributes.class); when(region.getServerProxy()).thenReturn(serverRegionProxy); when(event.isFromServer()).thenReturn(false); when(event.getKey()).thenReturn(key); when(event.getRawNewValue()).thenReturn(value); when(region.getCancelCriterion()).thenReturn(cancelCriterion); when(region.getAttributes()).thenReturn(regionAttributes); }
@Before public void setup() { region = mock(LocalRegion.class); event = mock(EntryEventImpl.class); eventID = mock(EventID.class); serverRegionProxy = mock(ServerRegionProxy.class); cancelCriterion = mock(CancelCriterion.class); exception = mock(PutAllPartialResultException.class); when(event.getEventId()).thenReturn(eventID); when(event.getCallbackArgument()).thenReturn(callbacks); when(region.hasServerProxy()).thenReturn(true); when(region.getServerProxy()).thenReturn(serverRegionProxy); when(region.getRegionMap()).thenReturn(mock(RegionMap.class)); when(region.getDataView()).thenReturn(mock(InternalDataView.class)); when(region.getCancelCriterion()).thenReturn(cancelCriterion); when(exception.getFailure()).thenReturn(cacheClosedException); when(cancelCriterion.generateCancelledException(cacheClosedException)) .thenReturn(cacheClosedException); }
boolean locked = false; try { final CancelCriterion stopper = region.getCancelCriterion(); for (;;) { stopper.checkCancelInProgress(null); } catch (InterruptedException ignore) { interrupted = true; region.getCancelCriterion().checkCancelInProgress(null);
getCancelCriterion(), this, getAttributes(), diskFlags, "NO_PARTITITON", -1, getCompressor(), getOffHeap());
try { if (dr.isRegionClosed()) { region.getCancelCriterion().checkCancelInProgress(null); throw new RegionDestroyedException( "The DiskRegion has been closed or destroyed",
runtimeException = getCancelCriterion().generateCancelledException(e.getFailure()); if (runtimeException == null) { runtimeException = new ServerOperationException(
runtimeException = getCancelCriterion().generateCancelledException(e.getFailure()); if (runtimeException == null) { runtimeException = new ServerOperationException(
getCancelCriterion().checkCancelInProgress(null);