/** * Returns the previous counter if any for the Conflatable object * * @param event * Object to be conflated * @param newPosition * New Conflatable object's position * @return Long object denoting the position of the previous conflatable * object */ protected Long addToConflationMap(Conflatable event, Long newPosition) { String r = event.getRegionToConflate(); ConcurrentMap latestIndexesForRegion = (ConcurrentMap)this.indexes.get(r); if (latestIndexesForRegion == null) { synchronized (HARegionQueue.this) { if ((latestIndexesForRegion = (ConcurrentMap)this.indexes.get(r)) == null) { latestIndexesForRegion = createConcurrentMap(); Map newMap = new HashMap(this.indexes); newMap.put(r, latestIndexesForRegion); this.indexes = Collections.unmodifiableMap(newMap); } } } Object key = event.getKeyToConflate(); Long previousPosition = (Long)latestIndexesForRegion.put(key, newPosition); return previousPosition; }
/** * Returns the previous counter if any for the Conflatable object * * @param event * Object to be conflated * @param newPosition * New Conflatable object's position * @return Long object denoting the position of the previous conflatable * object */ protected Long addToConflationMap(Conflatable event, Long newPosition) { String r = event.getRegionToConflate(); ConcurrentHashMap latestIndexesForRegion = (ConcurrentHashMap)this.indexes.get(r); if (latestIndexesForRegion == null) { synchronized (HARegionQueue.this) { if ((latestIndexesForRegion = (ConcurrentHashMap)this.indexes.get(r)) == null) { latestIndexesForRegion = createConcurrentMap(); Map newMap = new HashMap(this.indexes); newMap.put(r, latestIndexesForRegion); this.indexes = Collections.unmodifiableMap(newMap); } } } Object key = event.getKeyToConflate(); Long previousPosition = (Long)latestIndexesForRegion.put(key, newPosition); return previousPosition; }
private static boolean skipConflation(Conflatable current, Conflatable check) { return check.shouldBeConflated() && current.shouldBeMerged() == check.shouldBeMerged() && current.getClass().equals(check.getClass()) && ArrayUtils.objectEquals(current.getRegionToConflate(), check.getRegionToConflate()) && ArrayUtils.objectEquals(current.getKeyToConflate(), check.getKeyToConflate()); }
return ((Comparable<Object>)first).compareTo(second); int res = first.getRegionToConflate().compareTo( second.getRegionToConflate()); if (res != 0) { return res;
return ((Comparable<Object>)first).compareTo(second); int res = first.getRegionToConflate().compareTo( second.getRegionToConflate()); if (res != 0) { return res;
return ((Comparable<Object>)first).compareTo(second); int res = first.getRegionToConflate().compareTo( second.getRegionToConflate()); if (res != 0) { return res;
if (object.shouldBeConflated()) { String rName = object.getRegionToConflate(); Object key = object.getKeyToConflate();
private void removeIndex(Long qkey) { // Determine whether conflation is enabled for this queue and object Object o = getNoLRU(qkey, true, false, false); if (o instanceof Conflatable) { Conflatable object = (Conflatable)o; if (object.shouldBeConflated()) { // Otherwise, remove the index from the indexes map. String rName = object.getRegionToConflate(); Object key = object.getKeyToConflate(); Map latestIndexesForRegion = (Map)this.indexes.get(rName); if (latestIndexesForRegion != null) { // Remove the index. Long index = (Long)latestIndexesForRegion.remove(key); if (index != null) { this.getPartitionedRegion().getParallelGatewaySender() .getStatistics().decConflationIndexesMapSize(); if (logger.isDebugEnabled()) { logger.debug("{}: Removed index {} for {}", this, index, object); } } } } } }
if (region.isConflationEnabled() && conflatableObject.shouldBeConflated()) { Object keyToConflate = conflatableObject.getKeyToConflate(); String rName = object.getRegionToConflate(); if (logger.isDebugEnabled()) { logger.debug(" The region name is : {}", rName);
/** * Find conflatable items and remove from queue, if required, for the given * queue entry but do not add this entry to the conflation index or remove * conflated items from conflation index. */ public final boolean conflate(Conflatable confVal, Object confValEntry, boolean removeFromQueue, List<QueueValue> conflatedItems) { if (confVal.getRegionToConflate() != null) { lockQueue(true); try { return this.conflationHandler.applyConflate(confVal, confVal.getKeyToConflate(), confValEntry, conflatedItems, null, (removeFromQueue ? this.queue : null), false, false); } finally { unlockQueue(true); } } return false; }
private void removeIndex(Long qkey) { // Determine whether conflation is enabled for this queue and object if (this._enableConflation) { // only call get after checking enableConflation for bug 40508 Object o = optimalGet(qkey); if (o instanceof Conflatable) { Conflatable object = (Conflatable)o; if (object.shouldBeConflated()) { // Otherwise, remove the index from the indexes map. String regionName = object.getRegionToConflate(); Object key = object.getKeyToConflate(); Map latestIndexesForRegion = (Map)this._indexes.get(regionName); if (latestIndexesForRegion != null) { // Remove the index. Long index = (Long)latestIndexesForRegion.remove(key); this._stats.decConflationIndexesMapSize(); if (_logger.fineEnabled()) { if (index != null) { _logger.fine(this + ": Removed index " + index + " for " + object); } } } } } } }
private void removeIndex(Long qkey) { // Determine whether conflation is enabled for this queue and object if (this.enableConflation) { // only call get after checking enableConflation for bug 40508 Object o = optimalGet(qkey); if (o instanceof Conflatable) { Conflatable object = (Conflatable)o; if (object.shouldBeConflated()) { // Otherwise, remove the index from the indexes map. String rName = object.getRegionToConflate(); Object key = object.getKeyToConflate(); Map<Object, Long> latestIndexesForRegion = this.indexes.get(rName); if (latestIndexesForRegion != null) { // Remove the index. Long index = latestIndexesForRegion.remove(key); this.stats.decConflationIndexesMapSize(); if (logger.fineEnabled()) { if (index != null) { logger.fine(this + ": Removed index " + index + " for " + object); } } } } } } }
/** * Find conflatable items and remove from queue, if required, for the given * queue entry but do not add this entry to the conflation index or remove * conflated items from conflation index. */ public final boolean conflate(Conflatable confVal, Object confValEntry, boolean removeFromQueue, List<QueueValue> conflatedItems) { if (confVal.getRegionToConflate() != null) { lockQueue(true); try { return this.conflationHandler.applyConflate(confVal, confVal.getKeyToConflate(), confValEntry, conflatedItems, null, (removeFromQueue ? this.queue : null), false, false); } finally { unlockQueue(true); } } return false; }
/** * Find conflatable items and remove from queue, if required, for the given * queue entry but do not add this entry to the conflation index or remove * conflated items from conflation index. */ public final boolean conflate(Conflatable confVal, Object confValEntry, boolean removeFromQueue, List<QueueValue> conflatedItems) { if (confVal.getRegionToConflate() != null) { lockQueue(true); try { return this.conflationHandler.applyConflate(confVal, confVal.getKeyToConflate(), confValEntry, conflatedItems, null, (removeFromQueue ? this.queue : null), false, false); } finally { unlockQueue(true); } } return false; }
if (confVal.getRegionToConflate() != null) { if (this.conflationHandler.doConflate(confVal, confVal.getKeyToConflate(), qValue, conflatedItems, queue, true, SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONFLATION, toString() + ": adding conflatable entry " + qValue + " with region=" + confVal.getRegionToConflate() + " key=" + confVal.getKeyToConflate() + " value=" + confVal.getValueToConflate());
private void removeIndex(Long qkey) { // Determine whether conflation is enabled for this queue and object Object o = getNoLRU(qkey, true, false, false); if (o instanceof Conflatable) { Conflatable object = (Conflatable)o; if (object.shouldBeConflated()) { // Otherwise, remove the index from the indexes map. String rName = object.getRegionToConflate(); Object key = object.getKeyToConflate(); Map latestIndexesForRegion = (Map)this.indexes.get(rName); if (latestIndexesForRegion != null) { // Remove the index. Long index = (Long)latestIndexesForRegion.remove(key); if (index != null) { this.getPartitionedRegion().getParallelGatewaySender() .getStatistics().decConflationIndexesMapSize(); if (logger.fineEnabled()) { logger.fine(this + ": Removed index " + index + " for " + object); } } } } } }
/** * Do conflation for the given queue entry and return true if there was * conflation for the entry else return false. Not thread-safe. */ private boolean doConflate(QueueValue qValue, List<QueueValue> conflatedItems, SortedSet<QueueValue> queue, boolean skipExecuting) { final Object val = qValue.getValue(); // if value is a Conflatable then conflate either all entries // corresponding to the key of Conflatable, or for the case when // key is null then conflate all entries corresponding to the "region" // of Conflatable if (val instanceof Conflatable) { final Conflatable confVal = (Conflatable)val; if (confVal.getRegionToConflate() != null) { if (this.conflationHandler.doConflate(confVal, confVal.getKeyToConflate(), qValue, conflatedItems, queue, true, skipExecuting)) { return true; } if (GemFireXDUtils.TraceConflation) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONFLATION, toString() + ": adding conflatable entry " + qValue); } this.conflationHandler.addToConflationIndex(confVal, qValue); } } return false; }
/** * Do conflation for the given queue entry and return true if there was * conflation for the entry else return false. Not thread-safe. */ private boolean doConflate(QueueValue qValue, List<QueueValue> conflatedItems, SortedSet<QueueValue> queue, boolean skipExecuting) { final Object val = qValue.getValue(); // if value is a Conflatable then conflate either all entries // corresponding to the key of Conflatable, or for the case when // key is null then conflate all entries corresponding to the "region" // of Conflatable if (val instanceof Conflatable) { final Conflatable confVal = (Conflatable)val; if (confVal.getRegionToConflate() != null) { if (this.conflationHandler.doConflate(confVal, confVal.getKeyToConflate(), qValue, conflatedItems, queue, true, skipExecuting)) { return true; } if (GemFireXDUtils.TraceConflation) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_CONFLATION, toString() + ": adding conflatable entry " + qValue); } this.conflationHandler.addToConflationIndex(confVal, qValue); } } return false; }
Conflatable conflatableObject = object; Object keyToConflate = conflatableObject.getKeyToConflate(); String rName = object.getRegionToConflate(); if (logger.fineEnabled()) { logger.fine(" The region name is : " + rName);
.getRegionToConflate(), keyToConflate), sequenceId);