public DM getDistributionManager() { return getAdvisee().getDistributionManager(); }
public DM getDistributionManager() { return getAdvisee().getDistributionManager(); }
/** * Dumps out all profiles in this advisor. * @param infoMsg prefix message to log */ public void dumpProfiles(String infoMsg) { Profile[] profs = this.profiles; final StringBuffer buf = new StringBuffer(2000); if (infoMsg != null) { buf.append(infoMsg); buf.append(": "); } buf.append("FYI, DUMPING PROFILES IN "); buf.append(toString()); buf.append(":\n"); buf.append("My Profile="); buf.append(getAdvisee().getProfile()); buf.append("\nOther Profiles:\n"); for (int i = 0; i < profs.length; i++) { buf.append("\t"); buf.append(profs[i].toString()); buf.append("\n"); } if (logger.isDebugEnabled()) { logger.debug(buf.toString()); } }
/** * Dumps out all profiles in this advisor. * @param log the LogWriter to write profile dump to * @param infoMsg prefix message to log */ public void dumpProfiles(LogWriterI18n log, String infoMsg) { Profile[] profs = this.profiles; final StringBuilder buf = new StringBuilder(2000); if (infoMsg != null) { buf.append(infoMsg); buf.append(": "); } buf.append("FYI, DUMPING PROFILES IN "); buf.append(toString()); buf.append(":\n"); buf.append("My Profile="); buf.append(getAdvisee().getProfile()); buf.append("\nOther Profiles:\n"); for (int i = 0; i < profs.length; i++) { buf.append("\t"); buf.append(profs[i].toString()); buf.append("\n"); } log.info(LocalizedStrings.DEBUG, buf.toString()); }
/** * Create a new version of the membership profile set. This is * used in flushing state out of the VM for previous versions of * the set. * @since 5.1 */ public synchronized void forceNewMembershipVersion() { if (!membershipClosed) { membershipVersion++; if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) { logger.trace(LogMarker.STATE_FLUSH_OP, "StateFlush forced new membership version: {}", membershipVersion); } synchronized(this.opCountLock) { previousVersionOpCount += currentVersionOpCount; currentVersionOpCount = 0; if (logger.isTraceEnabled(LogMarker.DISTRIBUTION_STATE_FLUSH_OP)) { logger.trace(LogMarker.DISTRIBUTION_STATE_FLUSH_OP, "advisor for {} forced new membership version to {} previousOpCount={}", getAdvisee(), membershipVersion, previousVersionOpCount); } } } }
/** * Create a new version of the membership profile set. This is * used in flushing state out of the VM for previous versions of * the set. * @since 5.1 */ public synchronized void forceNewMembershipVersion() { if (!membershipClosed) { membershipVersion++; if (StateFlushOperation.DEBUG) { InternalDistributedSystem.getLoggerI18n().info(LocalizedStrings.DEBUG, "StateFlush forced new membership version: " + membershipVersion); } previousVersionOpCount.addAndGet(currentVersionOpCount); //previousVersionOpCount += currentVersionOpCount; currentVersionOpCount = 0; if (VERBOSE || StateFlushOperation.DEBUG) { LogWriterI18n log = getLogWriter(); log.info(LocalizedStrings.DEBUG, "advisor for " + getAdvisee() + " forced new membership version to " + membershipVersion + " previousOpCount=" + previousVersionOpCount.get()); } } }
/** * Removes the profile for the specified member and serial number * * @param memberId the member to remove the profile for * @param serialNum specific serial number to remove * @return true if a matching profile for the member was found */ // TODO could this be merged with removeId? public boolean removeIdWithSerial(InternalDistributedMember memberId, int serialNum, boolean regionDestroyed) { if (logger.isTraceEnabled(LogMarker.DA)) { logger.trace(LogMarker.DA, "removeIdWithSerial: removing member {} with serial {} from resource {}", memberId, serialNum, getAdvisee().getName()); } Assert.assertTrue(serialNum != ILLEGAL_SERIAL); return updateRemovedProfiles(memberId, serialNum, regionDestroyed); }
/** 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(); }
/** Creates the current distribution profile for this member */ public Profile createProfile() { Profile newProfile = instantiateProfile( getDistributionManager().getId(), incrementAndGetVersion()); getAdvisee().fillInProfile(newProfile); return newProfile; }
/** Creates the current distribution profile for this member */ public Profile createProfile() { Profile newProfile = instantiateProfile( getDistributionManager().getId(), incrementAndGetVersion()); getAdvisee().fillInProfile(newProfile); return newProfile; }
@Override public boolean execute(Object o, long viewVersion) { if (viewVersion != -1) { DistributionAdvisor advisor = (DistributionAdvisor)o; advisor.endOperation(viewVersion); if (LOG_VERSIONS) { LogWriterI18n logger = InternalDistributedSystem.getLoggerI18n(); if (logger != null) { logger.info(LocalizedStrings.DEBUG, "TXBatch: done dispatching operation for " + advisor.getAdvisee().getFullPath() + " in view version " + viewVersion); } } } return true; } };
/** 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); } }
final boolean isDebugEnabled_DA = logger.isTraceEnabled(LogMarker.DA); if (isDebugEnabled_DA) { logger.trace(LogMarker.DA, "removeId: removing member {} from resource {}", memberId, getAdvisee().getFullPath());
/** * Removes the profile for the specified member and serial number * * @param memberId the member to remove the profile for * @param serialNum specific serial number to remove * @return true if a matching profile for the member was found */ // TODO could this be merged with removeId? public boolean removeIdWithSerial(InternalDistributedMember memberId, int serialNum, boolean regionDestroyed) { //try { if (VERBOSE) { getLogWriter().info( LocalizedStrings.DEBUG, "removeIdWithSerial: removing member " + memberId + " with serial " + serialNum + " from resource " + getAdvisee().getName() //, new Exception("stack trace") ); } Assert.assertTrue(serialNum != ILLEGAL_SERIAL); return updateRemovedProfiles(memberId, serialNum, regionDestroyed); /*} finally { if (DEBUG) { getLogWriter().info("removeIdWithSerial " + memberId + " exiting " + toStringWithProfiles()); } }*/ }
public final void endOperationSend(TXStateProxy proxy) { final long[] viewVersions = this.viewVersions; final DistributionAdvisor[] advisors; LogWriterI18n logger = null; long viewVersion = -1; if (viewVersions != null) { advisors = this.viewAdvisors; if (LOG_VERSIONS) { logger = InternalDistributedSystem.getLoggerI18n(); } int numOps = viewVersions.length; while (--numOps >= 0) { viewVersion = viewVersions[numOps]; if (viewVersion != -1) { advisors[numOps].endOperation(viewVersion); if (logger != null) { logger.info(LocalizedStrings.DEBUG, "TXCommit: " + proxy.getTransactionId().shortToString() + " done dispatching operation for " + advisors[numOps].getAdvisee().getFullPath() + " in view version " + viewVersion); } } } this.viewVersions = null; this.viewAdvisors = null; } }
/** Provide recipients for profile exchange, * called by UpdateAttributesProcessor and CreateRegionProcessor. * Can not be initialized at this point because it is only called in * the following scenarios: * 1) We're doing a lazy initialization and synchronization on initializeLock * prevents other threads from causing initialization on this advisor. * 2) We're creating a new region and doing profile exchange as part of region * initialization, in which case no other threads have access to the region * or this advisor. */ public Set adviseProfileExchange() { // Get the list of recipients from the nearest initialized advisor // in the parent chain Assert.assertTrue(!isInitialized()); DistributionAdvisor advisor; DistributionAdvisee advisee = getAdvisee(); do { advisee = advisee.getParentAdvisee(); if (advisee == null) return getDefaultDistributionMembers(); advisor = advisee.getDistributionAdvisor(); } while (!advisor.isInitialized()); // do not call adviseGeneric because we don't want to trigger another // profile exchange on the parent return advisor.adviseFilter(null); }
/** Provide recipients for profile exchange, * called by UpdateAttributesProcessor and CreateRegionProcessor. * Can not be initialized at this point because it is only called in * the following scenarios: * 1) We're doing a lazy initialization and synchronization on initializeLock * prevents other threads from causing initialization on this advisor. * 2) We're creating a new region and doing profile exchange as part of region * initialization, in which case no other threads have access to the region * or this advisor. */ public Set adviseProfileExchange() { // Get the list of recipients from the nearest initialized advisor // in the parent chain Assert.assertTrue(!isInitialized()); DistributionAdvisor advisor; DistributionAdvisee advisee = getAdvisee(); do { advisee = advisee.getParentAdvisee(); if (advisee == null) return getDefaultDistributionMembers(); advisor = advisee.getDistributionAdvisor(); } while (!advisor.isInitialized()); // do not call adviseGeneric because we don't want to trigger another // profile exchange on the parent return advisor.adviseFilter(null); }
@Override public boolean shallExclude(ClassTraverser c) { if (super.shallExclude(c)) return true; if (c.member instanceof GemFireContainer) { return !containerInFocus.equals(c.member); } if (c.member instanceof Region<?, ?>) { return !super.regionNameCheck(regionInFocus, ((Region<?, ?>)c.member).getFullPath()); } if (c.member instanceof Bucket) { return !super.regionNameCheck(regionInFocus, ((Bucket)c.member) .getPartitionedRegion().getFullPath()); } if (c.member instanceof DistributionAdvisor) { return !super.regionNameCheck(regionInFocus, ((DistributionAdvisor)c.member).getAdvisee().getFullPath()); } if (c.member instanceof ProxyBucketRegion) { return !super.regionNameCheck(regionInFocus, ((ProxyBucketRegion)c.member).getBucketAdvisor().getAdvisee() .getFullPath()); } if (c.member instanceof GfxdIndexManager) { return true; } return false; } };
@Override public boolean shallExclude(ClassTraverser c) { if (super.shallExclude(c)) return true; if (c.member instanceof GemFireContainer) { return !containerInFocus.equals(c.member); } if (c.member instanceof Region<?, ?>) { return !super.regionNameCheck(regionInFocus, ((Region<?, ?>)c.member).getFullPath()); } if (c.member instanceof Bucket) { return !super.regionNameCheck(regionInFocus, ((Bucket)c.member) .getPartitionedRegion().getFullPath()); } if (c.member instanceof DistributionAdvisor) { return !super.regionNameCheck(regionInFocus, ((DistributionAdvisor)c.member).getAdvisee().getFullPath()); } if (c.member instanceof ProxyBucketRegion) { return !super.regionNameCheck(regionInFocus, ((ProxyBucketRegion)c.member).getBucketAdvisor().getAdvisee() .getFullPath()); } if (c.member instanceof GfxdIndexManager) { return true; } return false; } };
@Override public boolean shallExclude(ClassTraverser c) { if (super.shallExclude(c)) return true; if (c.member instanceof GemFireContainer) { return !containerInFocus.equals(c.member); } if (c.member instanceof Region<?, ?>) { return !super.regionNameCheck(regionInFocus, ((Region<?, ?>)c.member).getFullPath()); } if (c.member instanceof Bucket) { return !super.regionNameCheck(regionInFocus, ((Bucket)c.member) .getPartitionedRegion().getFullPath()); } if (c.member instanceof DistributionAdvisor) { return !super.regionNameCheck(regionInFocus, ((DistributionAdvisor)c.member).getAdvisee().getFullPath()); } if (c.member instanceof ProxyBucketRegion) { return !super.regionNameCheck(regionInFocus, ((ProxyBucketRegion)c.member).getBucketAdvisor().getAdvisee() .getFullPath()); } if (c.member instanceof GfxdIndexManager) { return true; } return false; } };