if (isClosed()) { return false;
/** * Called from catch blocks in {@link #doVolunteerForPrimary()}. Handles * the exception properly based on advisor settings and shutdown condition. * * @param e the RuntimeException that was caught while volunteering * @param loggit true if message should be logged if shutdown condition * is not met */ private void handleException(Exception e, boolean loggit) { boolean safe = isClosed() || getAdvisee().getCancelCriterion().cancelInProgress() != null; if (!safe) { if (ENFORCE_SAFE_CLOSE) { Assert.assertTrue(safe, LocalizedStrings.BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY.toLocalizedString()); } else if (loggit) { logger.warn(LocalizedMessage.create(LocalizedStrings.BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY), e); } } }
if (isClosed()) { return false;
if (isClosed()) { return false;
if (isClosed()) { return false;
this.pRegion.getRedundantCopies(); int numBucketHosts = getNumInitializedBuckets(); if (isClosed()) { return numBucketHosts;
this.pRegion.getRedundantCopies(); int numBucketHosts = getNumInitializedBuckets(); if (isClosed()) { return numBucketHosts;
/** * Actually close this advisor for real. Called by ProxyBucketRegion only. * Calling this method actually closes this advisor whereas {@link #close()} * only sets hosting to false. */ protected void closeAdvisor() { boolean wasPrimary; synchronized(this) { if (isClosed()) { return; } wasPrimary = isPrimary(); super.close(); this.requestPrimaryState(CLOSED); if (!this.redundancySatisfied){ incLowRedundancyBucketCount(-1); this.redundancySatisfied = true; } this.localProfile = null; } if(wasPrimary) { releasePrimaryLock(); } }
/** * Actually close this advisor for real. Called by ProxyBucketRegion only. * Calling this method actually closes this advisor whereas {@link #close()} * only sets hosting to false. */ protected void closeAdvisor() { boolean wasPrimary; synchronized(this) { if (isClosed()) { return; } wasPrimary = isPrimary(); super.close(); this.requestPrimaryState(CLOSED); if (!this.redundancySatisfied){ incLowRedundancyBucketCount(-1); this.redundancySatisfied = true; } this.localProfile = null; } if(wasPrimary) { releasePrimaryLock(); } }
if (isClosed()) { return false;
/** * Called from catch blocks in {@link #doVolunteerForPrimary()}. Handles * the exception properly based on advisor settings and shutdown condition. * * @param e the RuntimeException that was caught while volunteering * @param loggit true if message should be logged if shutdown condition * is not met */ private void handleException(Exception e, boolean loggit) { boolean safe = isClosed() || getAdvisee().getCancelCriterion().cancelInProgress() != null; if (!safe) { if (ENFORCE_SAFE_CLOSE) { Assert.assertTrue(safe, LocalizedStrings.BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY.toLocalizedString()); } else if (loggit) { getLogWriter().warning(LocalizedStrings.BucketAdvisor_BUCKETADVISOR_WAS_NOT_CLOSED_PROPERLY, e); } } }
if (isClosed()) { return false;
Assert.assertTrue(isClosed(), "BucketAdvisor was not closed before destroying PR lock service");
Assert.assertTrue(isClosed(), "BucketAdvisor was not closed before destroying PR lock service");
/** * Attempt to acquire lock for primary until a primary exists. Caller hands * off responsibility to an executor (waiting pool) and returns early. */ public void volunteerForPrimary() { if (primaryElector != null) { return; } initializationGate(); synchronized (this) { if (isVolunteering() || isClosed() || !isHosting()) { // only one thread should be attempting to volunteer at one time return; } // if member is still not initialized then don't volunteer for primary final GemFireCacheImpl cache = (GemFireCacheImpl)getBucket().getCache(); if (!cache.doVolunteerForPrimary(this)) { return; } if (this.volunteeringDelegate == null) { this.volunteeringDelegate = new VolunteeringDelegate(); } this.volunteeringDelegate.volunteerForPrimary(); } }
/** * Attempt to acquire lock for primary until a primary exists. Caller hands * off responsibility to an executor (waiting pool) and returns early. */ public void volunteerForPrimary() { if (primaryElector != null) { return; } initializationGate(); synchronized (this) { if (isVolunteering() || isClosed() || !isHosting()) { // only one thread should be attempting to volunteer at one time return; } // if member is still not initialized then don't volunteer for primary final GemFireCacheImpl cache = (GemFireCacheImpl)getBucket().getCache(); if (!cache.doVolunteerForPrimary(this)) { return; } if (this.volunteeringDelegate == null) { this.volunteeringDelegate = new VolunteeringDelegate(); } this.volunteeringDelegate.volunteerForPrimary(); } }
synchronized(this) { wasPrimary = isPrimary(); if (isClosed()) { return;