@Override protected void appendFields(StringBuilder buff) { super.appendFields(buff); buff.append("; membershipID="); buff.append(this.context == null ? "" : this.context.toString()); }
@Test public void shouldBeMockable() throws Exception { DestroyMessage mockDestroyOperation = mock(DestroyMessage.class); DistributedRegion mockDistributedRegion = mock(DistributedRegion.class); InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class); when(mockDestroyOperation.createEvent(eq(mockDistributedRegion))) .thenReturn(mockInternalCacheEvent); assertThat(mockDestroyOperation.createEvent(mockDistributedRegion)) .isEqualTo(mockInternalCacheEvent); } }
@Override protected boolean operateOnRegion(CacheEvent event, ClusterDistributionManager dm) throws EntryNotFoundException { EntryEventImpl ev = (EntryEventImpl) event; DistributedRegion rgn = (DistributedRegion) ev.getRegion(); try { if (!rgn.isCacheContentProxy()) { rgn.basicDestroy(ev, false, null); // expectedOldValue not supported on // non- partitioned regions } this.appliedOperation = true; } catch (ConcurrentCacheModificationException e) { dispatchElidedEvent(rgn, ev); return true; // concurrent modifications are not reported to the sender } catch (EntryNotFoundException e) { dispatchElidedEvent(rgn, ev); if (!ev.isConcurrencyConflict()) { rgn.notifyGatewaySender(EnumListenerEvent.AFTER_DESTROY, ev); } throw e; } catch (CacheWriterException e) { throw new Error( "CacheWriter should not be called", e); } catch (TimeoutException e) { throw new Error("DistributedLock should not be acquired", e); } return true; }
@Override @Retained protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException { EntryEventImpl ev = createEntryEvent(rgn); boolean evReturned = false; try { ev.setEventId(this.eventId); ev.setOldValueFromRegion(); ev.setVersionTag(this.versionTag); if (this.filterRouting != null) { ev.setLocalFilterInfo(this.filterRouting.getFilterInfo(rgn.getMyId())); } ev.setTailKey(tailKey); ev.setInhibitAllNotifications(this.inhibitAllNotifications); evReturned = true; return ev; } finally { if (!evReturned) { ev.release(); } } }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.context = ClientProxyMembershipID.readCanonicalized(in); }
@Override protected boolean mayAddToMultipleSerialGateways(ClusterDistributionManager dm) { return _mayAddToMultipleSerialGateways(dm); } }
@Override protected CacheOperationMessage createMessage() { if (this.event.hasClientOrigin()) { DestroyWithContextMessage msgwithContxt = new DestroyWithContextMessage(event); msgwithContxt.context = ((EntryEventImpl) this.event).getContext(); return msgwithContxt; } else { return new DestroyMessage(event); } }
@Retained EntryEventImpl createEntryEvent(DistributedRegion rgn) { @Retained EntryEventImpl event = EntryEventImpl.create(rgn, getOperation(), this.key, null, this.callbackArg, true, getSender()); // event.setNewEventId(); Don't set the event here... setOldValueInEvent(event); event.setTailKey(this.tailKey); return event; }
@Override public ConflationKey getConflationKey() { if (!super.regionAllowsConflation || getProcessorId() != 0) { // if the publisher's region attributes do not support conflation // or if it is an ack region // then don't even bother with a conflation key return null; } else { // don't conflate destroys return new ConflationKey(this.key, super.regionPath, false); } }