public PartitionedRegion removeShadowPR(String fullpath) { try { this.sender.getLifeCycleLock().writeLock().lock(); this.sender.setEnqueuedAllTempQueueEvents(false); return this.userRegionNameToshadowPRMap.remove(fullpath); } finally { sender.getLifeCycleLock().writeLock().unlock(); } }
public void addShadowPartitionedRegionForUserPR(PartitionedRegion pr) { // Reset enqueuedAllTempQueueEvents if the sender is running // This is done so that any events received while the shadow PR is added are queued in the // tmpQueuedEvents // instead of blocking the distribute call which could cause a deadlock. See GEM-801. if (this.sender.isRunning()) { this.sender.setEnqueuedAllTempQueueEvents(false); } this.sender.getLifeCycleLock().writeLock().lock(); try { for (int i = 0; i < processors.length; i++) { processors[i].addShadowPartitionedRegionForUserPR(pr); } } finally { this.sender.getLifeCycleLock().writeLock().unlock(); } }
@Override public void resume() { if (this.eventProcessor != null) { this.getLifeCycleLock().writeLock().lock(); try { if (this.eventProcessor.isStopped()) { return; } this.eventProcessor.resumeDispatching(); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_RESUME, this); logger.info("Resumed {}", this); enqueueTempEvents(); } finally { this.getLifeCycleLock().writeLock().unlock(); } } }
@Override public void pause() { if (this.eventProcessor != null) { this.getLifeCycleLock().writeLock().lock(); try { if (this.eventProcessor.isStopped()) { return; } this.eventProcessor.pauseDispatching(); InternalDistributedSystem system = (InternalDistributedSystem) this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_PAUSE, this); logger.info("Paused {}", this); enqueueTempEvents(); } finally { this.getLifeCycleLock().writeLock().unlock(); } } }
public void launchLockObtainingVolunteerThread() { String threadName = "Gateway Sender Primary Lock Acquisition Thread Volunteer"; this.lockObtainingThread = new LoggingThread(threadName, () -> { GatewaySenderAdvisor.this.sender.getLifeCycleLock().readLock().lock(); try { GatewaySenderAdvisor.this.sender.getLifeCycleLock().readLock().unlock();
@Before public void createParallelGatewaySenderQueue() { cache = mock(GemFireCacheImpl.class); sender = mock(AbstractGatewaySender.class); CancelCriterion cancelCriterion = mock(CancelCriterion.class); when(sender.getCancelCriterion()).thenReturn(cancelCriterion); when(sender.getCache()).thenReturn(cache); when(sender.getMaximumQueueMemory()).thenReturn(100); when(sender.getLifeCycleLock()).thenReturn(new ReentrantReadWriteLock()); metaRegionFactory = mock(MetaRegionFactory.class); queue = new ParallelGatewaySenderQueue(sender, Collections.emptySet(), 0, 1, metaRegionFactory); }
@Override public void destroy(boolean initiator) { try { this.getLifeCycleLock().writeLock().lock(); this.getLifeCycleLock().writeLock().unlock();
e); sender.getLifeCycleLock().writeLock().lock(); try { processor.stopProcessing(); sender.clearTempEventsAfterSenderStopped(); } finally { sender.getLifeCycleLock().writeLock().unlock();
public void addShadowPartitionedRegionForUserRR(DistributedRegion userRegion) { this.sender.getLifeCycleLock().writeLock().lock(); PartitionedRegion prQ = null; this.userRegionNameToshadowPRMap.put(userRegion.getFullPath(), prQ); this.sender.getLifeCycleLock().writeLock().unlock();
if (!this.getLifeCycleLock().readLock().tryLock()) { synchronized (this.queuedEventsSync) { if (!this.enqueuedAllTempQueueEvents) { if (!this.getLifeCycleLock().readLock().tryLock()) { Object substituteValue = getSubstituteValue(clonedEvent, operation); this.tmpQueuedEvents.add(new TmpQueueEvent(operation, clonedEvent, substituteValue)); this.getLifeCycleLock().readLock().lock(); this.getLifeCycleLock().readLock().unlock();
this, userPR.getDisplayName()); this.sender.getLifeCycleLock().writeLock().lock(); this.sender.getLifeCycleLock().writeLock().unlock();