/** * Sets volunteering to true. Returns true if the state of volunteering was changed. Returns false * if voluntering was already equal to true. Caller should do nothing if false is returned. */ protected boolean setVolunteering() { synchronized (this) { return requestPrimaryState(VOLUNTEERING_HOSTING); } }
/** * Sets becoming primary to true. Returns true if the state of becoming was changed. Returns false * if becoming was already equal to true. Caller should do nothing if false is returned. */ protected boolean setBecoming() { synchronized (this) { return requestPrimaryState(BECOMING_HOSTING); } }
/** * Sets primaryMember and notifies all. Caller must be synced on this. * * @param id the member to use as primary for this bucket */ void setPrimaryMember(InternalDistributedMember id) { if (!getDistributionManager().getId().equals(id)) { // volunteerForPrimary handles primary state change if its our id if (isHosting()) { requestPrimaryState(OTHER_PRIMARY_HOSTING); } else { requestPrimaryState(OTHER_PRIMARY_NOT_HOSTING); } } this.primaryMember.set(id); this.everHadPrimary = true; if (id != null && id.equals(primaryElector)) { primaryElector = null; } this.notifyAll(); // wake up any threads in waitForPrimaryMember }
requestPrimaryState(OTHER_PRIMARY_HOSTING); } else { requestPrimaryState(NO_PRIMARY_HOSTING); needToVolunteerForPrimary = true; if (hasPrimary()) { // has primary... if (isPrimary()) { requestPrimaryState(NO_PRIMARY_NOT_HOSTING); this.primaryMember.set(null); findAndSetPrimaryMember(); } else { requestPrimaryState(OTHER_PRIMARY_NOT_HOSTING); requestPrimaryState(NO_PRIMARY_NOT_HOSTING);
/** * 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); this.redundancyTracker.closeBucket(); this.localProfile = null; } if (wasPrimary) { releasePrimaryLock(); } }
requestPrimaryState(NO_PRIMARY_HOSTING); if (this.pRegion.isFixedPartitionedRegion()) { InternalDistributedMember primaryMember = requestPrimaryState(NO_PRIMARY_NOT_HOSTING);
((BucketRegion) br).beforeAcquiringPrimaryState(); if (requestPrimaryState(IS_PRIMARY_HOSTING)) { if (logger.isDebugEnabled()) { logger.debug("Acquired primary lock for setting primary now BucketID {} PR : {}",