public boolean lockSharedConfiguration() { return this.sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME, -1, -1); }
getLockService().lockInterruptibly(this.key, waitInterval, getLockLeaseForLock()); } else { gotLock = getLockService().lock(this.key, waitInterval, getLockLeaseForLock());
/** * Grab the PartitionedRegionID Lock, this MUST be done in a try block since it may throw an * exception * * @return true if the lock was acquired */ private static boolean grabPRIDLock(final DistributedLockService lockService) { final boolean isDebugEnabled = logger.isDebugEnabled(); boolean ownership = false; int n = 0; while (!ownership) { if (isDebugEnabled) { logger.debug("grabPRIDLock: Trying to get the dlock in allPartitionedRegions for {}: {}", PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID, (n + 1)); } ownership = lockService.lock(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID, VM_OWNERSHIP_WAIT_TIME, -1); } return ownership; }
/** * Try to acquire the distributed lock which members must grab for in the case of a tie. Whoever * gets the lock initializes first. */ @Override public boolean acquireTieLock() { // We're tied for the latest copy of the data. try to get the distributed lock. holdingTieLock = distributedLockService.lock("PERSISTENCE_" + regionPath, 0, -1); if (!holdingTieLock) { if (logger.isDebugEnabled(LogMarker.PERSIST_ADVISOR_VERBOSE)) { logger.debug(LogMarker.PERSIST_ADVISOR_VERBOSE, "{}-{}: Failed to acquire the lock.", shortDiskStoreId(), regionPath); } } return holdingTieLock; }
boolean obtainLock(DistributionManager dm) { return getLockService(dm).lock(LOCK_NAME, 0, -1); }
@Override public boolean acquireAutoBalanceLock() { // TODO: delete this double-checking if (!isLockAcquired.get()) { synchronized (isLockAcquired) { if (!isLockAcquired.get()) { DistributedLockService dls = getDLS(); boolean result = dls.lock(AUTO_BALANCER_LOCK, 0, -1); if (result) { isLockAcquired.set(true); if (logger.isDebugEnabled()) { logger.debug("Grabbed AutoBalancer lock"); } } else { if (logger.isDebugEnabled()) { logger.debug( "Another member owns auto-balance lock. Skip this attempt to rebalance the cluster"); } } } } } return isLockAcquired.get(); }
public boolean volunteerForPrimary() { if (logger.isDebugEnabled()) { logger.debug("Sender : {} is volunteering for Primary ", this.sender.getId()); } if (advisePrimaryGatewaySender() == null) { if (!adviseEldestGatewaySender()) { if (logger.isDebugEnabled()) { logger.debug( "Sender {} is not the eldest in the system. Giving preference to eldest sender to become primary...", this.sender); } return false; } if (logger.isDebugEnabled()) { logger.debug("Sender : {} no Primary available. So going to acquire distributed lock", this.sender); } this.lockService.lock(this.lockToken, 10000, -1); return this.lockService.isHeldByCurrentThread(this.lockToken); } return false; }
/** * Obtain a distributed lock for the clear operation. */ private void distributedLockForClear() { if (!this.scope.isGlobal()) { // non-global regions must lock when using RVV try { getLockService().lock("_clearOperation", -1, -1); } catch (IllegalStateException e) { lockCheckReadiness(); throw e; } } }
private void lock() { DistributedLockService dls = getLockService(); try { if (!dls.lock(LOCK_NAME, -1, -1)) { // this should be impossible throw new InternalGemFireException("Could not obtain pdx lock"); } } catch (LockServiceDestroyedException e) { // fix for bug 43172 cache.getCancelCriterion().checkCancelInProgress(e); throw e; } }
@Override public boolean tryLock() { try { ReplyProcessor21.forceSevereAlertProcessing(); return getLockService().lock(this.key, 0, getLockLeaseForLock()); } catch (IllegalStateException ex) { lockCheckReadiness(); throw ex; } finally { ReplyProcessor21.unforceSevereAlertProcessing(); } }
@Test public void locksAreReleasedDuringDisconnect() { assertThat(lockService.lock("MyLock", 0, -1)).isTrue(); assertThat(lockService.isHeldByCurrentThread("MyLock")).isTrue(); ((InternalDistributedSystem) system).setIsDisconnectThread(); lockService.unlock("MyLock"); assertThat(lockService.isHeldByCurrentThread("MyLock")).isFalse(); } }
try { gotLock = getCache().getGatewaySenderLockService().lock(META_DATA_REGION_NAME, -1, -1); if (!gotLock) { throw new IllegalStateException(
while (!lockService.lock(lockName, 100, -1)) { if (!fileAndChunkBucket.getBucketAdvisor().isPrimary()) { return null;