public abstract class AbstractEvictableRecordStore extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractEvictableRecordStore.ReadOnlyRecordIterator
Read only iterator.
|
Modifier and Type | Field and Description |
---|---|
protected EventService |
eventService |
protected Iterator<Record> |
expirationIterator
Iterates over a pre-set entry count/percentage in one round.
|
protected InvalidationQueue<ExpiredKey> |
expiredKeys |
protected long |
expiryDelayMillis |
protected boolean |
hasEntryWithCustomExpiration |
protected InMemoryFormat |
inMemoryFormat |
protected LockStore |
lockStore |
protected MapContainer |
mapContainer |
protected MapDataStore<Data,Object> |
mapDataStore |
protected MapEventPublisher |
mapEventPublisher |
protected MapServiceContext |
mapServiceContext |
protected MapStoreContext |
mapStoreContext |
protected RecordStoreMutationObserver<Record> |
mutationObserver |
protected String |
name |
protected int |
partitionId |
protected RecordFactory |
recordFactory |
protected SerializationService |
serializationService |
protected LocalRecordStoreStatsImpl |
stats |
protected Storage<Data,Record> |
storage |
protected Address |
thisAddress |
protected ValueComparator |
valueComparator |
DEFAULT_MAX_IDLE, DEFAULT_TTL
Modifier | Constructor and Description |
---|---|
protected |
AbstractEvictableRecordStore(MapContainer mapContainer,
int partitionId) |
Modifier and Type | Method and Description |
---|---|
protected void |
accessRecord(Record record,
long now) |
protected LockStore |
createLockStore() |
Record |
createRecord(Object value,
long ttlMillis,
long maxIdle,
long now) |
protected com.hazelcast.map.impl.recordstore.RecordStoreLoader |
createRecordStoreLoader(MapStoreContext mapStoreContext) |
Storage |
createStorage(RecordFactory recordFactory,
InMemoryFormat memoryFormat) |
void |
disposeDeferredBlocks()
This can be used to release unused resources.
|
void |
doPostEvictionOperations(Record record)
Does post eviction operations like sending events
|
void |
evictEntries(Data excludedKey)
Evicts entries from this record-store.
|
void |
evictExpiredEntries(int percentage,
boolean backup)
Do expiration operations.
|
InvalidationQueue<ExpiredKey> |
getExpiredKeysQueue() |
LocalRecordStoreStats |
getLocalRecordStoreStats() |
int |
getLockedEntryCount() |
MapContainer |
getMapContainer() |
String |
getName() |
protected long |
getNow() |
protected Record |
getOrNullIfExpired(Record record,
long now,
boolean backup)
Check if record is reachable according to TTL or idle times.
|
long |
getOwnedEntryCost() |
int |
getPartitionId()
Returns the partition id this RecordStore belongs to.
|
Storage<Data,? extends Record> |
getStorage() |
void |
init()
Initialize the recordStore after creation
|
boolean |
isExpirable() |
boolean |
isExpired(Record record,
long now,
boolean backup)
Checks whether a record is expired or not.
|
protected boolean |
isInfiniteTTL(long ttl) |
protected boolean |
isMaxIdleDefined(long maxIdle) |
protected void |
markRecordStoreExpirable(long ttl,
long maxIdle) |
protected void |
mergeRecordExpiration(Record record,
EntryView mergingEntry) |
protected void |
mergeRecordExpiration(Record record,
SplitBrainMergeTypes.MapMergeTypes mergingEntry) |
protected boolean |
persistenceEnabledFor(CallerProvenance provenance) |
protected void |
removeIndex(Collection<Record> records) |
protected void |
removeIndex(Record record) |
protected void |
saveIndex(Record record,
Object oldValue) |
void |
setSizeEstimator(EntryCostEstimator entryCostEstimator) |
boolean |
shouldEvict()
Returns
true if eviction is allowed on this record-store, otherwise false |
protected Data |
toData(Object value) |
protected void |
updateRecord(Data key,
Record record,
Object value,
long now,
boolean countAsAccess) |
protected void |
updateStatsOnGet(long now) |
protected void |
updateStatsOnPut(boolean countAsAccess,
long now) |
protected void |
updateStatsOnPut(long hits) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canAcquireLock, checkIfLoaded, clear, clearPartition, containsKey, containsValue, delete, destroy, evict, evictAll, existInMemory, extendLock, fetchEntries, fetchKeys, forceUnlock, get, getAll, getLockOwnerInfo, getMapDataStore, getRecord, getRecordOrNull, hasQueryCache, isEmpty, isKeyLoadFinished, isLoaded, isLocked, isLockedBy, isTransactionallyLocked, iterator, iterator, loadAll, loadAllFromStore, loadAwareIterator, loadRecordOrNull, localLock, lock, maybeDoInitialLoad, merge, merge, merge, merge, put, putBackup, putBackup, putFromLoad, putFromLoadBackup, putIfAbsent, putRecord, putTransient, readBackupData, remove, remove, removeBackup, replace, replace, reset, set, setPreMigrationLoadedStatus, setTtl, setWithUncountedAccess, size, softFlush, startLoading, txnLock, unlock, updateLoadStatus
protected final long expiryDelayMillis
protected final EventService eventService
protected final MapEventPublisher mapEventPublisher
protected final Address thisAddress
protected final InvalidationQueue<ExpiredKey> expiredKeys
protected Iterator<Record> expirationIterator
protected volatile boolean hasEntryWithCustomExpiration
protected final int partitionId
protected final String name
protected final LockStore lockStore
protected final MapContainer mapContainer
protected final RecordFactory recordFactory
protected final InMemoryFormat inMemoryFormat
protected final MapStoreContext mapStoreContext
protected final ValueComparator valueComparator
protected final MapServiceContext mapServiceContext
protected final SerializationService serializationService
protected final MapDataStore<Data,Object> mapDataStore
protected final LocalRecordStoreStatsImpl stats
protected final RecordStoreMutationObserver<Record> mutationObserver
protected AbstractEvictableRecordStore(MapContainer mapContainer, int partitionId)
public void evictExpiredEntries(int percentage, boolean backup)
RecordStore
percentage
- of max expirables according to the record store size.backup
- true
if a backup partition, otherwise false
.public boolean isExpirable()
true
if record store has at least one candidate entry
for expiration else return false
.public void evictEntries(Data excludedKey)
RecordStore
excludedKey
- this key has lowest priority to be selected for evictionpublic boolean shouldEvict()
RecordStore
true
if eviction is allowed on this record-store, otherwise false
true
if eviction is allowed on this record-store, otherwise false
protected void markRecordStoreExpirable(long ttl, long maxIdle)
protected boolean isInfiniteTTL(long ttl)
true
if the supplied ttl doesn't not represent infinity and as a result entry should be
removed after some time, otherwise return false
to indicate entry should live forever.protected boolean isMaxIdleDefined(long maxIdle)
protected Record getOrNullIfExpired(Record record, long now, boolean backup)
record
- Record
public boolean isExpired(Record record, long now, boolean backup)
RecordStore
record
- the record from record-store.now
- current time in millisbackup
- true
if a backup partition, otherwise false
.true
if the record is expired, false
otherwise.public void doPostEvictionOperations(Record record)
RecordStore
record
- record to processpublic InvalidationQueue<ExpiredKey> getExpiredKeysQueue()
protected void accessRecord(Record record, long now)
protected void mergeRecordExpiration(Record record, SplitBrainMergeTypes.MapMergeTypes mergingEntry)
protected boolean persistenceEnabledFor(@Nonnull CallerProvenance provenance)
public LocalRecordStoreStats getLocalRecordStoreStats()
getLocalRecordStoreStats
in interface RecordStore<Record>
public void init()
RecordStore
init
in interface RecordStore<Record>
public Record createRecord(Object value, long ttlMillis, long maxIdle, long now)
createRecord
in interface RecordStore<Record>
public Storage createStorage(RecordFactory recordFactory, InMemoryFormat memoryFormat)
createStorage
in interface RecordStore<Record>
public String getName()
getName
in interface RecordStore<Record>
public MapContainer getMapContainer()
getMapContainer
in interface RecordStore<Record>
public long getOwnedEntryCost()
getOwnedEntryCost
in interface RecordStore<Record>
protected long getNow()
protected void updateRecord(Data key, Record record, Object value, long now, boolean countAsAccess)
public int getPartitionId()
RecordStore
getPartitionId
in interface RecordStore<Record>
protected void removeIndex(Record record)
protected void removeIndex(Collection<Record> records)
protected LockStore createLockStore()
public int getLockedEntryCount()
getLockedEntryCount
in interface RecordStore<Record>
protected com.hazelcast.map.impl.recordstore.RecordStoreLoader createRecordStoreLoader(MapStoreContext mapStoreContext)
public void setSizeEstimator(EntryCostEstimator entryCostEstimator)
public void disposeDeferredBlocks()
RecordStore
disposeDeferredBlocks
in interface RecordStore<Record>
public Storage<Data,? extends Record> getStorage()
getStorage
in interface RecordStore<Record>
protected void updateStatsOnPut(boolean countAsAccess, long now)
protected void updateStatsOnPut(long hits)
protected void updateStatsOnGet(long now)
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.