Tabnine Logo
Assert.assertHoldsLock
Code IndexAdd Tabnine to your IDE (free)

How to use
assertHoldsLock
method
in
com.gemstone.gemfire.internal.Assert

Best Java code snippets using com.gemstone.gemfire.internal.Assert.assertHoldsLock (Showing top 20 results out of 315)

origin: io.snappydata/gemfire-core

public DLockGrantor getGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.grantor;
 }
}

origin: org.apache.geode/gemfire-core

public DLockGrantor getGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.grantor;
 }
}

origin: org.apache.geode/gemfire-core

/** 
 * Returns true if locking has been suspended. 
 * <p>
 * Caller must synchronize on suspendLock.
 * 
 * @return true if locking has been suspended
 * @guarded.By {@link #suspendLock}
 */
protected boolean isLockingSuspended() {
 if (DEBUG_SUSPEND_LOCK) {
  Assert.assertHoldsLock(this.suspendLock,true);
 }
 return this.lockingSuspendedBy != null;
}

origin: io.snappydata/gemfire-core

private void basicRemoveIndex(int index) {
 Assert.assertHoldsLock(this,true);    
 // minimize volatile reads by copying ref to local var
 Profile[] oldProfiles = this.profiles; // volatile read
 Profile[] newProfiles = new Profile[oldProfiles.length - 1];
 System.arraycopy(oldProfiles, 0, newProfiles, 0, index);
 System.arraycopy(oldProfiles, index + 1, newProfiles, index,
          newProfiles.length - index);
 this.profiles = newProfiles; // volatile write
 if (this.numActiveProfiles > 0) {
  this.numActiveProfiles--;
 }
}

origin: org.apache.geode/gemfire-core

private void basicRemoveIndex(int index) {
 Assert.assertHoldsLock(this,true);    
 // minimize volatile reads by copying ref to local var
 Profile[] oldProfiles = this.profiles; // volatile read
 Profile[] newProfiles = new Profile[oldProfiles.length - 1];
 System.arraycopy(oldProfiles, 0, newProfiles, 0, index);
 System.arraycopy(oldProfiles, index + 1, newProfiles, index,
          newProfiles.length - index);
 this.profiles = newProfiles; // volatile write
 if (this.numActiveProfiles > 0) {
  this.numActiveProfiles--;
 }
}

origin: io.snappydata/gemfire-core

/**
 * Returns true if {@link #lockGrantorId} is the same as the specified
 * LockGrantorId. Caller must synchronize on {@link #lockGrantorIdLock}.
 * 
 * @param someLockGrantorId the LockGrantorId to check 
 */
private boolean checkLockGrantorId(LockGrantorId someLockGrantorId) {
 Assert.assertHoldsLock(this.lockGrantorIdLock,true);
 if (this.lockGrantorId == null) {
  return false;
 }
 return this.lockGrantorId.sameAs(someLockGrantorId);
}

origin: org.apache.geode/gemfire-core

/**
 * Returns true if {@link #lockGrantorId} is the same as the specified
 * LockGrantorId. Caller must synchronize on {@link #lockGrantorIdLock}.
 * 
 * @param someLockGrantorId the LockGrantorId to check 
 */
private boolean checkLockGrantorId(LockGrantorId someLockGrantorId) {
 Assert.assertHoldsLock(this.lockGrantorIdLock,true);
 if (this.lockGrantorId == null) {
  return false;
 }
 return this.lockGrantorId.sameAs(someLockGrantorId);
}

origin: org.apache.geode/gemfire-core

/**
 * Returns true if <code>someLockGrantor</code> equals the current
 * {@link #lockGrantorId}.
 * 
 * @param someLockGrantor
 * @return true if someLockGrantor equals the current lockGrantorId
 */
private boolean equalsLockGrantorId(LockGrantorId someLockGrantor) {
 Assert.assertHoldsLock(this.lockGrantorIdLock,true);
 if (someLockGrantor == null) {
  return this.lockGrantorId == null;
 }
 return someLockGrantor.equals(this.lockGrantorId);
}

origin: io.snappydata/gemfire-core

protected boolean isCurrentlyOrIsMakingLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber());
 }
}
origin: org.apache.geode/gemfire-core

/** exchange profiles to initialize this advisor */
private void exchangeProfiles() {
 Assert.assertHoldsLock(this,false); // causes deadlock
 Assert.assertHoldsLock(this.initializeLock,true);
 new UpdateAttributesProcessor(getAdvisee()).distribute(true);
 setInitialized();
}
origin: org.apache.geode/gemfire-core

boolean isCurrentlyOrIsMakingLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber());
 }
}

origin: org.apache.geode/gemfire-core

protected int indexOfMemberId(ProfileId id) {
 Assert.assertHoldsLock(this,true);
 Profile[] profs = this.profiles; // volatile read
 for (int i = 0; i < profs.length; i++) {
  Profile p = profs[i];
  if (id instanceof InternalDistributedMember) {
   if (p.getDistributedMember().equals(id)) return i;
  } else {
   if (p.getId().equals(id)) return i;
  }
 }
 return -1;
}

origin: io.snappydata/gemfire-core

protected int indexOfMemberId(ProfileId id) {
 Assert.assertHoldsLock(this,true);
 Profile[] profs = this.profiles; // volatile read
 for (int i = 0; i < profs.length; i++) {
  Profile p = profs[i];
  if (id instanceof InternalDistributedMember) {
   if (p.getDistributedMember().equals(id)) return i;
  } else {
   if (p.getId().equals(id)) return i;
  }
 }
 return -1;
}

origin: io.snappydata/gemfire-core

/** exchange profiles to initialize this advisor */
private void exchangeProfiles() {
 Assert.assertHoldsLock(this,false); // causes deadlock
 Assert.assertHoldsLock(this.initializeLock,true);
 DistributionAdvisee advisee = getAdvisee();
 new UpdateAttributesProcessor(advisee).distribute(true);
 setInitialized();
 if (advisee instanceof LocalRegion) {
  ((LocalRegion)advisee).setProfileExchanged(true);
 }
}
origin: org.apache.geode/gemfire-core

boolean isMakingLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber()) &&
      this.grantor != null &&
      this.grantor.isInitializing();
 }
}

origin: io.snappydata/gemfire-core

protected boolean isCurrentlyLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber()) &&
      this.grantor != null &&
      this.grantor.isReady();
 }
}

origin: org.apache.geode/gemfire-core

boolean isCurrentlyLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber()) &&
      this.grantor != null &&
      this.grantor.isReady();
 }
}

origin: io.snappydata/gemfire-core

protected boolean isMakingLockGrantor() {
 Assert.assertHoldsLock(this.destroyLock,false);
 synchronized (this.lockGrantorIdLock) {
  return this.lockGrantorId != null && 
      this.lockGrantorId.isLocal(getSerialNumber()) &&
      this.grantor != null &&
      this.grantor.isInitializing();
 }
}
origin: org.apache.geode/gemfire-core

/**
 * Early check for resources. This code may be executed for every put operation if
 * there are no datastores present, limit excessive logging.
 * @since gemfire5.8
 */
private void earlySufficientStoresCheck(String partitionName) {
 assert Assert.assertHoldsLock(this,false);
 Set currentStores = getAllStores(partitionName);
 if (currentStores.isEmpty()) {
  if (shouldLogInsufficientStores()) {
   insufficientStores(currentStores, Collections.EMPTY_LIST, true);
  }
  insufficientStores(currentStores, Collections.EMPTY_LIST, false);
 }
}
origin: io.snappydata/gemfire-core

/** 
 * Resume locking after it has been suspended. 
 * <p>
 * Caller must synchronize on suspendLock.
 */ 
private void resumeLocking() {
 if (DEBUG_SUSPEND_LOCK) {
  Assert.assertHoldsLock(this.suspendLock,true);
 }
 if (getLogWriter().fineEnabled()) {
  getLogWriter().fine("Resume locking of " + this.dlock);
 }
 this.lockingSuspendedBy = null;
 this.suspendedLockId = INVALID_LOCK_ID;
}

com.gemstone.gemfire.internalAssertassertHoldsLock

Javadoc

This is a workaround for X bug 38288. JRockit can throw a NullPointerException from Thread.holdsLock, so we catch the NullPointerException if it happens. This method returns true, unless it throws an exception. This is so we can disable these tests for performance reasons with a java assertion, eg assert Assert.assertHoldLock(lock, true);

Popular methods of Assert

  • assertTrue
  • fail
  • throwError

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Path (java.nio.file)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • JFrame (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now