EntryVersionsMap updatedVersions =
((TxInvocationContext) ctx).getCacheTransaction().getUpdatedEntryVersions();
if (updatedVersions != null) {
EntryVersion version = updatedVersions.get(entry.getKey());
if (version != null) {
Metadata metadata = entry.getMetadata();
if (metadata == null) {
// If no metadata passed, assumed embedded metadata
metadata = new EmbeddedMetadata.Builder()
.lifespan(entry.getLifespan()).maxIdle(entry.getMaxIdle())
.version(version).build();
return entryFactory.create(entry.getKey(), entry.getValue(), metadata);
} else {
metadata = metadata.builder().version(version).build();
return entryFactory.create(entry.getKey(), entry.getValue(), metadata);
}
}
}
}