BucketRegion extends DistributedRegion implements Bucket { @Override public void invokeTXCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent) { if (logger.isDebugEnabled()) { logger.debug("BR.invokeTXCallbacks for event {}", event); } if (isInitialized()) { boolean callThem = callDispatchListenerEvent; if (event.isPossibleDuplicate() && getEventTracker().isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeTXCallbacks(eventType, event, callThem); } if (skipPrEvent(event, callDispatchListenerEvent)) { return; } @Released final EntryEventImpl prEvent = createEventForPR(event); try { partitionedRegion.invokeTXCallbacks(eventType, prEvent, partitionedRegion.isInitialized() && callDispatchListenerEvent); } finally { prEvent.release(); } } BucketRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
      InternalCache cache, InternalRegionArguments internalRegionArgs,
      StatisticsClock statisticsClock); @Override void initialize(InputStream snapshotInputStream, InternalDistributedMember imageTarget,
      InternalRegionArguments internalRegionArgs); @Override void registerCreateRegionReplyProcessor(CreateRegionReplyProcessor processor); @Override BucketAdvisor getBucketAdvisor(); @Override boolean isHosting(); void removeAndNotifyKeys(Object[] keys); boolean waitUntilLocked(Object[] keys); @Override boolean virtualPut(EntryEventImpl event, boolean ifNew, boolean ifOld,
      Object expectedOldValue, boolean requireOldValue, long lastModified,
      boolean overwriteDestroyed, boolean invokeCallbacks,
      boolean throwConcurrentModification); @Override void handleWANEvent(EntryEventImpl event); @Override long basicPutPart2(EntryEventImpl event, RegionEntry entry, boolean isInitialized,
      long lastModified, boolean clearConflict); void checkForPrimary(); boolean doLockForPrimary(boolean tryLock); void doUnlockForPrimary(); @Override void basicInvalidate(EntryEventImpl event); @Override void basicDestroy(final EntryEventImpl event, final boolean cacheWrite,
      Object expectedOldValue); @Override void basicDestroyBeforeRemoval(RegionEntry entry, EntryEventImpl event); void forceSerialized(EntryEventImpl event); int getRedundancyLevel(); @Override boolean isPrimary(); @Override boolean isDestroyed(); boolean isBucketDestroyed(); @Override void checkReadiness(); @Override PartitionedRegion getPartitionedRegion(); @Override void fillInProfile(Profile profile); RawValue getSerialized(KeyInfo keyInfo, boolean generateCallbacks, boolean doNotLockEntry,
      ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent,
      boolean returnTombstones); @Override String toString(); @Override void invokeTXCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent); @Override void invokeDestroyCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent, boolean notifyGateways); @Override void invokeInvalidateCallbacks(final EnumListenerEvent eventType,
      final EntryEventImpl event, final boolean callDispatchListenerEvent); @Override void invokePutCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent, boolean notifyGateways); @Override int getId(); @Override void cacheWriteBeforePut(EntryEventImpl event, Set netWriteRecipients,
      CacheWriter localWriter, boolean requireOldValue, Object expectedOldValue); @Override boolean cacheWriteBeforeDestroy(EntryEventImpl event, Object expectedOldValue); @Override CacheWriter basicGetWriter(); @Override Set<InternalDistributedMember> getBucketOwners(); long getCounter(); void setCounter(AtomicLong counter); void resetCounter(); long getLimit(); void setLimit(long limit); @Override int calculateValueSize(Object value); @Override int calculateRegionEntryValueSize(RegionEntry regionEntry); @Override void updateSizeOnPut(Object key, int oldSize, int newSize); @Override void updateSizeOnCreate(Object key, int newSize); @Override void updateSizeOnRemove(Object key, int oldSize); @Override int updateSizeOnEvict(Object key, int oldSize); @Override void updateSizeOnFaultIn(Object key, int newMemSize, int oldDiskSize); @Override void initializeStats(long numEntriesInVM, long numOverflowOnDisk,
      long numOverflowBytesOnDisk); long getTotalBytes(); long getBytesInMemory(); @Override void cleanupFailedInitialization(); long getNumOverflowOnDisk(); long getNumOverflowBytesOnDisk(); long getNumEntriesInVM(); void incNumOverflowOnDisk(long delta); void incNumOverflowBytesOnDisk(long delta); void incNumEntriesInVM(long delta); long getBucketEvictions(); int getSizeForEviction(); @Override FilterProfile getFilterProfile(); @Override void setCloningEnabled(boolean isCloningEnabled); @Override boolean getCloningEnabled(); void beforeAcquiringPrimaryState(); void afterAcquiringPrimaryState(); @Override RegionAttributes getAttributes(); @Override boolean notifiesSerialGatewaySender(); @Override boolean hasSeenEvent(EntryEventImpl event); @Override EvictionController getExistingController(InternalRegionArguments internalArgs); @Override String getNameForStats(); @Override void closeEntries(); @Override Set<VersionSource> clearEntries(RegionVersionVector rvv); @Immutable
  static final RawValue REQUIRES_ENTRY_LOCK; }
@Test public void invokeTXCallbacksDoesNotInvokeCallbacksIfEventIsNotGenerateCallbacks() { BucketRegion bucketRegion = spy(new BucketRegion(regionName, regionAttributes, partitionedRegion, cache, internalRegionArgs, disabledClock())); doReturn(false).when(bucketRegion).isInitialized(); doReturn(false).when(event).isGenerateCallbacks(); bucketRegion.invokeTXCallbacks(EnumListenerEvent.AFTER_UPDATE, event, false); verify(partitionedRegion, never()).invokeTXCallbacks(EnumListenerEvent.AFTER_UPDATE, event, false); }
@Test public void invokeTXCallbacksDoesNotInvokeCallbacksIfPartitionedRegionIsNotInitialized() { BucketRegion bucketRegion = spy(new BucketRegion(regionName, regionAttributes, partitionedRegion, cache, internalRegionArgs, disabledClock())); doReturn(false).when(bucketRegion).isInitialized(); doReturn(true).when(event).isGenerateCallbacks(); doReturn(false).when(partitionedRegion).isInitialized(); doReturn(true).when(partitionedRegion).shouldDispatchListenerEvent(); bucketRegion.invokeTXCallbacks(EnumListenerEvent.AFTER_UPDATE, event, false); verify(partitionedRegion, never()).invokeTXCallbacks(EnumListenerEvent.AFTER_UPDATE, event, false); }