/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void processData(DefaultData defaultData, Map<?, ?> kryoPreferences) { Long key = Long.valueOf(defaultData.getPlatformIdent()); AggregationPerformer<E> aggregationPerformer = aggregationPerformerMap.get(key); if (null == aggregationPerformer) { aggregationPerformer = aggregationPerformerMap.putIfAbsent(key, new AggregationPerformer<>(aggregator)); if (null == aggregationPerformer) { aggregationPerformer = aggregationPerformerMap.get(key); } } // deal with no saving of the invocation affiliation for cached views as well if (Boolean.FALSE.equals(kryoPreferences.get(KryoSerializationPreferences.WRITE_INVOCATION_AFFILIATION_DATA)) && (defaultData instanceof InvocationAwareData)) { InvocationAwareData invocationAwareData = (InvocationAwareData) defaultData; Map<Long, MutableInt> temp = invocationAwareData.getInvocationsParentsIdMap(); invocationAwareData.setInvocationsParentsIdMap(Collections.<Long, MutableInt> emptyMap()); aggregationPerformer.processElement((E) defaultData); invocationAwareData.setInvocationsParentsIdMap(temp); } else { aggregationPerformer.processElement((E) defaultData); } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void write(Kryo kryo, Output output, T object) { ObjectMap<Object, Object> garphContext = kryo.getGraphContext(); if (Boolean.FALSE.equals(garphContext.get(KryoSerializationPreferences.WRITE_INVOCATION_AFFILIATION_DATA))) { Map<Long, MutableInt> temp = object.getInvocationsParentsIdMap(); object.setInvocationsParentsIdMap(Collections.<Long, MutableInt> emptyMap()); super.write(kryo, output, object); object.setInvocationsParentsIdMap(temp); } else { super.write(kryo, output, object); } } }