Search in sources :

Example 1 with ReadCommittedEntry

use of org.infinispan.container.entries.ReadCommittedEntry in project infinispan by infinispan.

the class EntryFactoryImpl method createWrappedEntry.

protected MVCCEntry<?, ?> createWrappedEntry(Object key, CacheEntry<?, ?> cacheEntry) {
    Object value = null;
    Metadata metadata = null;
    PrivateMetadata internalMetadata = null;
    if (cacheEntry != null) {
        synchronized (cacheEntry) {
            value = cacheEntry.getValue();
            metadata = cacheEntry.getMetadata();
            internalMetadata = cacheEntry.getInternalMetadata();
        }
    }
    if (log.isTraceEnabled())
        log.tracef("Creating new entry for key %s", toStr(key));
    MVCCEntry<?, ?> mvccEntry;
    if (useRepeatableRead) {
        if (useVersioning) {
            if (internalMetadata == null) {
                internalMetadata = nonExistingPrivateMetadata;
            }
            mvccEntry = new VersionedRepeatableReadEntry(key, value, metadata);
        } else {
            mvccEntry = new RepeatableReadEntry(key, value, metadata);
        }
    } else {
        mvccEntry = new ReadCommittedEntry(key, value, metadata);
    }
    mvccEntry.setInternalMetadata(internalMetadata);
    if (cacheEntry != null) {
        mvccEntry.setCreated(cacheEntry.getCreated());
        mvccEntry.setLastUsed(cacheEntry.getLastUsed());
    }
    return mvccEntry;
}
Also used : ReadCommittedEntry(org.infinispan.container.entries.ReadCommittedEntry) RepeatableReadEntry(org.infinispan.container.entries.RepeatableReadEntry) VersionedRepeatableReadEntry(org.infinispan.container.entries.VersionedRepeatableReadEntry) Metadata(org.infinispan.metadata.Metadata) PrivateMetadata(org.infinispan.metadata.impl.PrivateMetadata) PrivateMetadata(org.infinispan.metadata.impl.PrivateMetadata) VersionedRepeatableReadEntry(org.infinispan.container.entries.VersionedRepeatableReadEntry)

Aggregations

ReadCommittedEntry (org.infinispan.container.entries.ReadCommittedEntry)1 RepeatableReadEntry (org.infinispan.container.entries.RepeatableReadEntry)1 VersionedRepeatableReadEntry (org.infinispan.container.entries.VersionedRepeatableReadEntry)1 Metadata (org.infinispan.metadata.Metadata)1 PrivateMetadata (org.infinispan.metadata.impl.PrivateMetadata)1