use of org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage in project geode by apache.
the class BucketRegion method notifyClientsOfTombstoneGC.
@Override
protected void notifyClientsOfTombstoneGC(Map<VersionSource, Long> regionGCVersions, Set<Object> removedKeys, EventID eventID, FilterInfo routing) {
if (CacheClientNotifier.getInstance() != null) {
// Only route the event to clients interested in the partitioned region.
// We do this by constructing a region-level event and then use it to
// have the filter profile ferret out all of the clients that have interest
// in this region
FilterProfile fp = getFilterProfile();
// fix for bug #46309 - don't send null/empty key set to clients
if (// bug #51877 - NPE in clients
(removedKeys != null && !removedKeys.isEmpty()) && (routing != null || (fp != null && fp.hasInterest()))) {
RegionEventImpl regionEvent = new RegionEventImpl(getPartitionedRegion(), Operation.REGION_DESTROY, null, true, getMyId());
FilterInfo clientRouting = routing;
if (clientRouting == null) {
clientRouting = fp.getLocalFilterRouting(regionEvent);
}
regionEvent.setLocalFilterInfo(clientRouting);
ClientUpdateMessage clientMessage = ClientTombstoneMessage.gc(getPartitionedRegion(), removedKeys, eventID);
CacheClientNotifier.notifyClients(regionEvent, clientMessage);
}
}
}
use of org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage in project geode by apache.
the class PRTombstoneMessage method operateOnPartitionedRegion.
@Override
protected boolean operateOnPartitionedRegion(final DistributionManager dm, PartitionedRegion r, long startTime) throws ForceReattemptException {
if (logger.isTraceEnabled(LogMarker.DM)) {
logger.debug("PRTombstoneMessage operateOnRegion: {}", r.getFullPath());
}
FilterProfile fp = r.getFilterProfile();
if (this.keys != null && this.keys.size() > 0) {
// sanity check
if (fp != null && CacheClientNotifier.getInstance() != null && this.eventID != null) {
RegionEventImpl regionEvent = new RegionEventImpl(r, Operation.REGION_DESTROY, null, true, r.getGemFireCache().getMyId());
regionEvent.setLocalFilterInfo(fp.getLocalFilterRouting(regionEvent));
ClientUpdateMessage clientMessage = ClientTombstoneMessage.gc(r, this.keys, this.eventID);
CacheClientNotifier.notifyClients(regionEvent, clientMessage);
}
}
return true;
}
use of org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage in project geode by apache.
the class LocalRegion method notifyClientsOfTombstoneGC.
/**
* pass tombstone garbage-collection info to clients
*
* @param eventID the ID of the event (see bug #50683)
* @param routing routing info (routing is computed if this is null)
*/
protected void notifyClientsOfTombstoneGC(Map<VersionSource, Long> regionGCVersions, Set<Object> keysRemoved, EventID eventID, FilterInfo routing) {
if (CacheClientNotifier.getInstance() != null) {
// Only route the event to clients interested in the partitioned region.
// We do this by constructing a region-level event and then use it to
// have the filter profile ferret out all of the clients that have interest
// in this region
FilterProfile fp = getFilterProfile();
if (fp != null || routing != null) {
// null check - fix for bug #45614
RegionEventImpl regionEvent = new RegionEventImpl(this, Operation.REGION_DESTROY, null, true, getMyId());
regionEvent.setEventID(eventID);
FilterInfo clientRouting = routing;
if (clientRouting == null) {
clientRouting = fp.getLocalFilterRouting(regionEvent);
}
regionEvent.setLocalFilterInfo(clientRouting);
ClientUpdateMessage clientMessage = ClientTombstoneMessage.gc(this, regionGCVersions, eventID);
CacheClientNotifier.notifyClients(regionEvent, clientMessage);
}
}
}
use of org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage in project geode by apache.
the class HARegionQueue method maintainCqStats.
private void maintainCqStats(Object event, long incrementAmount) {
CqService cqService = region.getGemFireCache().getCqService();
if (cqService != null) {
try {
if (event instanceof HAEventWrapper) {
HAEventWrapper hw = (HAEventWrapper) event;
if (hw.getClientUpdateMessage() != null) {
event = hw.getClientUpdateMessage();
} else {
event = (Conflatable) this.haContainer.get(event);
}
if (event instanceof ClientUpdateMessage) {
if (((ClientUpdateMessage) event).hasCqs() && ((ClientUpdateMessage) event).hasCqs(clientProxyID)) {
CqNameToOp cqNames = ((ClientUpdateMessage) event).getClientCq(clientProxyID);
if (cqNames != null) {
for (String cqName : cqNames.getNames()) {
InternalCqQuery cq = ((InternalCqQuery) cqService.getClientCqFromServer(clientProxyID, cqName));
CqQueryVsdStats cqStats = cq.getVsdStats();
if (cq != null && cqStats != null) {
cqStats.incNumHAQueuedEvents(incrementAmount);
}
}
}
}
}
}
} catch (Exception e) {
// as maintaining cq stats should not affect the system.
if (logger.isTraceEnabled()) {
logger.trace("Exception while maintaining cq events stats.", e);
}
}
}
}
use of org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessage in project geode by apache.
the class HARQueueNewImplDUnitTest method verifyQueueData.
public static void verifyQueueData(Integer regionsize, Integer msgsRegionsize, Integer port) {
try {
// Get the clientMessagesRegion and check the size.
Region msgsRegion = cache.getRegion(CacheServerImpl.generateNameForClientMsgsRegion(port.intValue()));
Region region = cache.getRegion("/" + regionName);
logger.fine("size<serverRegion, clientMsgsRegion>: " + region.size() + ", " + msgsRegion.size());
assertEquals(regionsize.intValue(), region.size());
assertEquals(msgsRegionsize.intValue(), msgsRegion.size());
Iterator iter = msgsRegion.entrySet().iterator();
while (iter.hasNext()) {
Region.Entry entry = (Region.Entry) iter.next();
HAEventWrapper wrapper = (HAEventWrapper) entry.getKey();
ClientUpdateMessage cum = (ClientUpdateMessage) entry.getValue();
Object key = cum.getKeyOfInterest();
logger.fine("key<feedCount, regionCount>: " + key + "<" + ((Long) map.get(key)).longValue() + ", " + wrapper.getReferenceCount() + ">");
assertEquals(((Long) map.get(key)).longValue(), wrapper.getReferenceCount());
}
} catch (Exception e) {
fail("failed in verifyQueueData()" + e);
}
}
Aggregations