public long getExpiry() { // obtain the date/time the entry will expire long expiryTime = ExternalizableHelper.decodeExpiry(getBinaryValue()); if (expiryTime == CacheMap.EXPIRY_DEFAULT || expiryTime == CacheMap.EXPIRY_NEVER) { return expiryTime; } else { long deltaTime = expiryTime - Base.getSafeTimeMillis(); return deltaTime <= 0 ? -2 : deltaTime; } }
/** * 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; }
Binary binaryValue = entryEvent.getEntry().getBinaryValue();
@Override public String toString() { Object key = null; Object value = null; Object originalValue = null; if (context != null) { try { key = getKey(); value = getValue(); originalValue = getOriginalValue(); } catch (RuntimeException e) { // no op we just can deserialize the key or the value we'll use the binary version } } return String.format("DistributableEntry{key=%s, value=%s, originalValue=%s}", (key == null ? getBinaryKey() : key), (value == null ? getBinaryValue() : value), (originalValue == null ? getOriginalBinaryValue() : originalValue)); } }
targetEntry.updateBinaryValue((Binary) entryEvent.getEntry().getBinaryValue()); Binary binaryValue = entryEvent.getEntry().getBinaryValue(); Map srcDecorations = binaryValue == null ? new HashMap()