/** * Extracts the {@link ClusterMetaInfo} of the {@link Cluster} from where the {@link EntryEvent} originated. * * @param entryEvent The {@link DistributableEntryEvent} from which to determine the {@link ClusterMetaInfo}. * * @return {@link ClusterMetaInfo} */ @SuppressWarnings({"rawtypes"}) private ClusterMetaInfo getSourceClusterMetaInfo(DistributableEntryEvent entryEvent) { Binary binaryValue = entryEvent.getEntry().getBinaryValue(); Map decorations = binaryValue == null ? null : (Map) entryEvent.getEntry().getContext().getInternalValueDecoration(binaryValue, BackingMapManagerContext .DECO_CUSTOM); if (decorations == null) { throw new IllegalStateException("Can't extract the CLUSTER_INFO_DECORATION_KEY from the EntryEvent. The BinaryValue is not decorated"); } ClusterMetaInfo sourceClusterMetaInfo = (ClusterMetaInfo) decorations.get(DistributableEntry.CLUSTER_META_INFO_DECORATION_KEY); if (sourceClusterMetaInfo == null) { throw new IllegalStateException("Expecting a non-null value for CLUSTER_INFO_DECORATION_KEY"); } return sourceClusterMetaInfo; }
? null : (Map) entryEvent.getEntry().getContext().getInternalValueDecoration(binaryValue, BackingMapManagerContext .DECO_CUSTOM);
@Override public Object getOriginalValue() { Object originalValue; if (originalBinaryValue == null || originalBinaryValue.length() == 0) { originalValue = null; } else { try { if (getContext() == null && getSerializer() != null) { originalValue = serializer.deserialize(originalBinaryValue.getBufferInput()); } else { originalValue = getContext().getValueFromInternalConverter().convert(originalBinaryValue); } } catch (Exception e) { throw Base.ensureRuntimeException(e); } } // TODO: we should hold a weak reference to the result as we might call this method again. return originalValue; }
@Override public Object getKey() { Object key; if (binaryKey == null || binaryKey.length() == 0) { key = null; } else { try { if (getContext() == null && getSerializer() != null) { key = serializer.deserialize(binaryKey.getBufferInput()); } else { key = getContext().getKeyFromInternalConverter().convert(binaryKey); } } catch (Exception e) { throw Base.ensureRuntimeException(e); } } // TODO: we should hold a weak reference to the result as we might call this method again. return key; }
@Override public Object getValue() { Object value; if (binaryValue == null || binaryValue.length() == 0) { value = null; } else { try { if (getContext() == null && getSerializer() != null) { value = serializer.deserialize(binaryValue.getBufferInput()); } else { value = getContext().getValueFromInternalConverter().convert(binaryValue); } } catch (Exception e) { throw Base.ensureRuntimeException(e); } } // TODO: we should hold a weak reference to the result as we might call this method again. return value; }