/** * Returns the lock that prevents the parent's primary from moving while active writes are in * progress. This should be locked before checking if the local bucket is primary. * * @return the lock for in-progress write operations */ Lock getParentPrimaryMoveReadLock() { if (parentAdvisor != null) { return parentAdvisor.getPrimaryMoveReadLock(); } return null; }
public void doUnlockForPrimary() { Lock primaryMoveReadLock = getBucketAdvisor().getPrimaryMoveReadLock(); primaryMoveReadLock.unlock(); Lock parentLock = getBucketAdvisor().getParentPrimaryMoveReadLock(); if (parentLock != null) { parentLock.unlock(); } }
private boolean lockPrimaryStateReadLock(boolean tryLock) { Lock primaryMoveReadLock = getBucketAdvisor().getPrimaryMoveReadLock(); Lock parentLock = getBucketAdvisor().getParentPrimaryMoveReadLock(); for (;;) {
@Override protected void setInternalRegionArguments(InternalRegionArguments ira) { // PR specific PartitionedRegion pr = mock(PartitionedRegion.class); BucketAdvisor ba = mock(BucketAdvisor.class); ReadWriteLock primaryMoveLock = new ReentrantReadWriteLock(); Lock primaryMoveReadLock = primaryMoveLock.readLock(); when(ba.getPrimaryMoveReadLock()).thenReturn(primaryMoveReadLock); when(ba.getProxyBucketRegion()).thenReturn(mock(ProxyBucketRegion.class)); when(ba.isPrimary()).thenReturn(true); ira.setPartitionedRegion(pr).setPartitionedRegionBucketRedundancy(1).setBucketAdvisor(ba); }
InternalDistributedMember myId = this.partitionedRegion.getDistributionManager().getDistributionManagerId(); Lock primaryMoveReadLock = bucketAdvisor.getPrimaryMoveReadLock();