public EventWrapper(EntryEvent ee, int type) { this.event = ee; this.key = ee.getKey(); this.val = ee.getNewValue(); this.arg = ee.getCallbackArgument(); this.type = type; }
@Override public void afterCreate(EntryEvent event) { final String regionName = event.getRegion().getName(); final Object key = event.getKey(); final Object newValue = event.getNewValue(); log.debug("In region [" + regionName + "] created key [" + key + "] value [" + newValue + "]"); }
@Override public void afterDestroy(EntryEvent event) { final String regionName = event.getRegion().getName(); final Object key = event.getKey(); final Object newValue = event.getNewValue(); System.out.println("In region " + regionName + " destroyed key " + key + " value " + newValue); }
private void handleUpdates(EntryEvent event) { Object obj = event.getNewValue(); if (obj instanceof PdxInstance) { updateDeviceLocation((String) ((PdxInstance) obj).getField("deviceId")); } else { updateDeviceLocation(((DeviceDistance) obj).getDeviceId()); } };
private void registerPI(EntryEvent event) { Object obj = event.getNewValue(); String piId = null; if (obj instanceof PdxInstance) { piId = (String) ((PdxInstance) obj).getField("piId"); } else { piId = ((DeviceDistance) obj).getPiId(); } if (GeodeClient.getInstance().getPILocation(piId) == null) { GeodeClient.getInstance().setPILocation(new DeviceLocation(piId, 0, 0)); } }
@Override public void afterUpdate(EntryEvent event) { final String regionName = event.getRegion().getName(); final Object key = event.getKey(); final Object newValue = event.getNewValue(); final Object oldValue = event.getOldValue(); System.out.println( "In region " + regionName + " updated key " + key + " oldValue " + oldValue + "new value " + newValue); }
@Override public void afterCreate(EntryEvent<SensorAnomalyKey, SensorAnomaly> event) { SensorAnomalyKey key = event.getKey(); SensorAnomaly anomaly = event.getNewValue(); LOG.error("afterCreate: key={}, anomaly={}", key, anomaly); }