com.hazelcast.cache.impl
Class CacheEntryProcessorEntry<K,V,R extends CacheRecord>

java.lang.Object
  extended by com.hazelcast.cache.impl.CacheEntryProcessorEntry<K,V,R>
Type Parameters:
K - the type of key.
V - the type of value.
All Implemented Interfaces:
javax.cache.Cache.Entry<K,V>, javax.cache.processor.MutableEntry<K,V>

public class CacheEntryProcessorEntry<K,V,R extends CacheRecord>
extends Object
implements javax.cache.processor.MutableEntry<K,V>

This class is an implementation of MutableEntry which is provided into EntryProcessor.process(javax.cache.processor.MutableEntry, Object...).

CacheEntryProcessorEntry may face multiple mutating operations like setValue, remove or CacheLoading, etc.

This implementation may handle multiple operations executed on this entry and persist the resultant state into CacheRecordStore after entry processor get completed.

See Also:
EntryProcessor.process(javax.cache.processor.MutableEntry, Object...)

Nested Class Summary
protected static class CacheEntryProcessorEntry.State
           
 
Field Summary
protected  AbstractCacheRecordStore cacheRecordStore
           
protected  int completionId
           
protected  javax.cache.expiry.ExpiryPolicy expiryPolicy
           
protected  K key
           
protected  Data keyData
           
protected  long now
           
protected  R record
           
protected  R recordLoaded
           
protected  long start
           
protected  CacheEntryProcessorEntry.State state
           
protected  V value
           
 
Constructor Summary
CacheEntryProcessorEntry(Data keyData, R record, AbstractCacheRecordStore cacheRecordStore, long now, int completionId)
           
 
Method Summary
 void applyChanges()
          Provides a similar functionality as committing a transaction.
 boolean exists()
           
 K getKey()
           
protected  V getRecordValue(R record)
           
 V getValue()
           
 void remove()
           
 void setValue(V value)
           
<T> T
unwrap(Class<T> clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected K key

value

protected V value

state

protected CacheEntryProcessorEntry.State state

keyData

protected final Data keyData

record

protected R extends CacheRecord record

recordLoaded

protected R extends CacheRecord recordLoaded

cacheRecordStore

protected final AbstractCacheRecordStore cacheRecordStore

now

protected final long now

start

protected final long start

expiryPolicy

protected final javax.cache.expiry.ExpiryPolicy expiryPolicy

completionId

protected final int completionId
Constructor Detail

CacheEntryProcessorEntry

public CacheEntryProcessorEntry(Data keyData,
                                R record,
                                AbstractCacheRecordStore cacheRecordStore,
                                long now,
                                int completionId)
Method Detail

exists

public boolean exists()
Specified by:
exists in interface javax.cache.processor.MutableEntry<K,V>

remove

public void remove()
Specified by:
remove in interface javax.cache.processor.MutableEntry<K,V>

setValue

public void setValue(V value)
Specified by:
setValue in interface javax.cache.processor.MutableEntry<K,V>

getKey

public K getKey()
Specified by:
getKey in interface javax.cache.Cache.Entry<K,V>

getValue

public V getValue()
Specified by:
getValue in interface javax.cache.Cache.Entry<K,V>

getRecordValue

protected V getRecordValue(R record)

applyChanges

public void applyChanges()
Provides a similar functionality as committing a transaction. So, at the end of the process method, applyChanges will be called to apply latest data into CacheRecordStore.


unwrap

public <T> T unwrap(Class<T> clazz)
Specified by:
unwrap in interface javax.cache.Cache.Entry<K,V>


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.