@Override public void profileRemoved(Profile profile, boolean destroyed) { /* * Don't bother logging membership activity if our region isn't ready. */ if(isInitialized()) { CacheProfile cacheProfile = ((profile instanceof CacheProfile) ? (CacheProfile) profile : null); Set<String> onlineMembers = new HashSet<String>(); TransformUtils.transform(PartitionedRegion.this.distAdvisor.advisePersistentMembers().values(),onlineMembers,TransformUtils.persistentMemberIdToLogEntryTransformer); logger.info(LocalizedMessage.create(LocalizedStrings.PersistenceAdvisorImpl_PERSISTENT_VIEW, new Object[] {PartitionedRegion.this.getName(),TransformUtils.persistentMemberIdToLogEntryTransformer.transform(cacheProfile.persistentID),onlineMembers})); } } });
@Override public void remoteRegionInitialized(CacheProfile profile) { if (isInitialized() && hasListener()) { Object callback = DistributedRegion.TEST_HOOK_ADD_PROFILE? profile : null; RegionEventImpl event = new RegionEventImpl(PartitionedRegion.this, Operation.REGION_CREATE, callback, true, profile.peerMemberId); dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_CREATE, event); } }
@Override public void remoteRegionInitialized(CacheProfile profile) { if (isInitialized() && hasListener()) { Object callback = DistributedRegion.TEST_HOOK_ADD_PROFILE? profile : null; RegionEventImpl event = new RegionEventImpl(PartitionedRegion.this, Operation.REGION_CREATE, callback, true, profile.peerMemberId); dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_CREATE, event); } }
@Override public void profileRemoved(Profile profile, boolean destroyed) { /* * Don't bother logging membership activity if our region isn't ready. */ if(isInitialized()) { CacheProfile cacheProfile = ((profile instanceof CacheProfile) ? (CacheProfile) profile : null); Set<String> onlineMembers = new HashSet<String>(); TransformUtils.transform(PartitionedRegion.this.distAdvisor.advisePersistentMembers().values(),onlineMembers,TransformUtils.persistentMemberIdToLogEntryTransformer); PartitionedRegion.this.logger.info(LocalizedStrings.PersistenceAdvisorImpl_PERSISTENT_VIEW, new Object[] {PartitionedRegion.this.getName(),TransformUtils.persistentMemberIdToLogEntryTransformer.transform(cacheProfile.persistentID),onlineMembers}); } } });
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException { // This call has come to an uninitialized region. if(pr == null || !pr.isInitialized()) { return true; } org.apache.logging.log4j.Logger logger = LogService.getLogger(); if (logger.isTraceEnabled(LogMarker.DM)) { logger.trace("DestroyRegionOnDataStore operateOnRegion: " + pr.getFullPath()); } pr.destroyRegion(callbackArg); return true; }
protected synchronized void initRMLWrappers() { if (PartitionedRegion.this.isInitialized() && hasListener()) { initPostCreateRegionMembershipListeners(getRegionAdvisor().adviseAllPRNodes()); } }
protected synchronized void initRMLWrappers() { if (PartitionedRegion.this.isInitialized() && hasListener()) { initPostCreateRegionMembershipListeners(getRegionAdvisor().adviseAllPRNodes()); } }
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException { // This call has come to an uninitialized region. if(pr == null || !pr.isInitialized()) { return true; } LogWriterI18n l = pr.getCache().getLoggerI18n(); if (DistributionManager.VERBOSE) { l.fine("DestroyRegionOnDataStore operateOnRegion: " + pr.getFullPath()); } pr.destroyRegion(callbackArg); return true; }
/** * Set the colocated with region path and adjust the BucketAdvisor's. This * should *only* be invoked when region is just newly created and has no data * or existing buckets else will have undefined behaviour. * * @since 6.5 */ public void setColocatedWith(String colocatedRegionFullPath) { ((PartitionAttributesImpl)this.partitionAttributes) .setColocatedWith(colocatedRegionFullPath); this.colocatedWithRegion = null; setColocatedWithRegion(ColocationHelper.getColocatedRegion(this)); if (isInitialized()) { this.getRegionAdvisor().resetBucketAdvisorParents(); } }
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException { // This call has come to an uninitialized region. // This can occur as bucket grab Op is done outside the // d-lock. if(pr == null || !pr.isInitialized()) { return false; } if (logger.isTraceEnabled(LogMarker.DM)) { logger.trace(LogMarker.DM, "BucketBackupMessage operateOnRegion: {}", pr.getFullPath()); } PartitionedRegionDataStore ds = pr.getDataStore(); if (ds != null) { pr.getRedundancyProvider().finishIncompleteBucketCreation(bucketId); } else { logger.warn(LocalizedMessage.create( LocalizedStrings.BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER)); } pr.getPrStats().endPartitionMessagesProcessing(startTime); return false; }
public synchronized void memberDeparted(InternalDistributedMember id, boolean crashed) { if (PartitionedRegion.this.isInitialized() && hasListener()) { RegionEventImpl event = new RegionEventImpl(PartitionedRegion.this, Operation.REGION_CLOSE, null, true, id); if (crashed) { dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_CRASH, event); } else { // @todo darrel: it would be nice to know if what actual op was done // could be close, local destroy, or destroy (or load snap?) if (DestroyRegionOperation.isRegionDepartureNotificationOk()) { dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_DEPARTURE, event); } } } // required-roles functionality is not implemented for partitioned regions, // or it would be done here } }
public synchronized void memberDeparted(InternalDistributedMember id, boolean crashed) { if (PartitionedRegion.this.isInitialized() && hasListener()) { RegionEventImpl event = new RegionEventImpl(PartitionedRegion.this, Operation.REGION_CLOSE, null, true, id); if (crashed) { dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_CRASH, event); } else { // @todo darrel: it would be nice to know if what actual op was done // could be close, local destroy, or destroy (or load snap?) if (DestroyRegionOperation.isRegionDepartureNotificationOk()) { dispatchListenerEvent(EnumListenerEvent.AFTER_REMOTE_REGION_DEPARTURE, event); } } } // required-roles functionality is not implemented for partitioned regions, // or it would be done here } }
@Override public void invokeDestroyCallbacks( final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent, boolean notifyGateways) { // bucket events may make it to this point even though the bucket is still // initializing. We can't block while initializing or a GII state flush // may hang, so we avoid notifying the bucket if (this.isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && this.eventTracker.isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeDestroyCallbacks(eventType, event, callThem, notifyGateways); } final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeDestroyCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false, false); } finally { prevent.release(); } }
@Override public void invokeDestroyCallbacks( final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent, boolean notifyGateways) { // bucket events may make it to this point even though the bucket is still // initializing. We can't block while initializing or a GII state flush // may hang, so we avoid notifying the bucket if (this.isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && this.eventTracker.isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeDestroyCallbacks(eventType, event, callThem, notifyGateways); } final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeDestroyCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false, false); } finally { prevent.release(); } }
@Override public void invokeInvalidateCallbacks( final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent) { // bucket events may make it to this point even though the bucket is still // initializing. We can't block while initializing or a GII state flush // may hang, so we avoid notifying the bucket if (this.isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && this.eventTracker.isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeInvalidateCallbacks(eventType, event, callThem); } final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeInvalidateCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false); } finally { prevent.release(); } }
@Override public void invokeInvalidateCallbacks( final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent) { // bucket events may make it to this point even though the bucket is still // initializing. We can't block while initializing or a GII state flush // may hang, so we avoid notifying the bucket if (this.isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && this.eventTracker.isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeInvalidateCallbacks(eventType, event, callThem); } final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeInvalidateCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false); } finally { prevent.release(); } }
@Override void basicInvalidate(EntryEventImpl event) throws EntryNotFoundException { final long startTime = PartitionedRegionStats.startTime(); try { if (event.getEventId() == null) { event.setNewEventId(this.cache.getDistributedSystem()); } final TXStateInterface tx = discoverJTA(event); getDataView(tx).invalidateExistingEntry(event, isInitialized(), false); } catch (RegionDestroyedException rde) { if (!rde.getRegionFullPath().equals(getFullPath())) { // Handle when a bucket is destroyed RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath()); rde2.initCause(rde); throw rde2; } } finally { this.prStats.endInvalidate(startTime); } return; }
@Override void basicInvalidate(EntryEventImpl event) throws EntryNotFoundException { final long startTime = PartitionedRegionStats.startTime(); try { if (event.getEventId() == null) { event.setNewEventId(this.cache.getDistributedSystem()); } discoverJTA(); getDataView().invalidateExistingEntry(event, isInitialized(), false); } catch (RegionDestroyedException rde) { if (!rde.getRegionFullPath().equals(getFullPath())) { // Handle when a bucket is destroyed RegionDestroyedException rde2 = new RegionDestroyedException(toString(), getFullPath()); rde2.initCause(rde); throw rde2; } } finally { this.prStats.endInvalidate(startTime); } return; }
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion pr, long startTime) throws CacheException { // This call has come to an uninitialized region. // This can occur as bucket grab Op is done outside the // d-lock. if(pr == null || !pr.isInitialized()) { return false; } LogWriterI18n l = pr.getCache().getLoggerI18n(); if (DistributionManager.VERBOSE) { l.fine("BucketBackupMessage operateOnRegion: " + pr.getFullPath()); } PartitionedRegionDataStore ds = pr.getDataStore(); if (ds != null) { pr.getRedundancyProvider().finishIncompleteBucketCreation(bucketId); } else { l.warning(LocalizedStrings.BucketBackupMessage_BUCKETBACKUPMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER); } pr.getPrStats().endPartitionMessagesProcessing(startTime); return false; }
@Override public void invokeTXCallbacks( final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent, final boolean notifyGateway) { if (getCache().getLogger().fineEnabled()) { getCache().getLogger().fine("BR.invokeTXCallbacks for event " + event); } // bucket events may make it to this point even though the bucket is still // initializing. We can't block while initializing or a GII state flush // may hang, so we avoid notifying the bucket if (this.isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && this.eventTracker.isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeTXCallbacks(eventType, event, callThem, notifyGateway); } final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeTXCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false, false); } finally { prevent.release(); } }