private void ensureEventTrackerInitialization() { try { getEventTracker().waitOnInitialization(); } catch (InterruptedException ie) { stopper.checkCancelInProgress(ie); Thread.currentThread().interrupt(); } }
@Override protected DistributedRegion createAndDefineRegion(boolean isConcurrencyChecksEnabled, RegionAttributes ra, InternalRegionArguments ira, GemFireCacheImpl cache) { BucketRegion br = new BucketRegion("testRegion", ra, null, cache, ira); // it is necessary to set the event tracker to initialized, since initialize() in not being // called on the instantiated region br.getEventTracker().setInitialized(); // since br is a real bucket region object, we need to tell mockito to monitor it br = spy(br); // doNothing().when(dm).addMembershipListener(any()); doNothing().when(br).distributeUpdateOperation(any(), anyLong()); doNothing().when(br).distributeDestroyOperation(any()); doNothing().when(br).distributeInvalidateOperation(any()); doNothing().when(br).distributeUpdateEntryVersionOperation(any()); doNothing().when(br).checkForPrimary(); doNothing().when(br).handleWANEvent(any()); doReturn(false).when(br).needWriteLock(any()); return br; }
@Override public void invokeTXCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent) { if (logger.isDebugEnabled()) { logger.debug("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() && getEventTracker().isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeTXCallbacks(eventType, event, callThem); } @Released final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeTXCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false); } finally { prevent.release(); } }
@Override public void invokePutCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event, final boolean callDispatchListenerEvent, boolean notifyGateways) { if (logger.isTraceEnabled()) { logger.trace("invoking put callbacks on bucket 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 (callThem && event.isPossibleDuplicate() && this.getEventTracker().isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokePutCallbacks(eventType, event, callThem, notifyGateways); } @Released final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokePutCallbacks(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.getEventTracker().isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeDestroyCallbacks(eventType, event, callThem, notifyGateways); } @Released 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.getEventTracker().isInitialImageProvider(event.getDistributedMember())) { callThem = false; } super.invokeInvalidateCallbacks(eventType, event, callThem); } @Released final EntryEventImpl prevent = createEventForPR(event); try { this.partitionedRegion.invokeInvalidateCallbacks(eventType, prevent, this.partitionedRegion.isInitialized() ? callDispatchListenerEvent : false); } finally { prevent.release(); } }