public abstract class AbstractEvictableRecordStore extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractEvictableRecordStore.ReadOnlyRecordIterator
Read only iterator.
|
DEFAULT_MAX_IDLE, DEFAULT_TTL
Modifier | Constructor and Description |
---|---|
protected |
AbstractEvictableRecordStore(MapContainer mapContainer,
int partitionId) |
Modifier and Type | Method and Description |
---|---|
void |
accessRecord(Record record,
long now)
Touches the given record, updating its last access time to
now and
maintaining statistics. |
protected LockStore |
createLockStore() |
Record |
createRecord(Data key,
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.
|
Object |
get(Data dataKey,
boolean backup,
Address callerAddress)
|
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 |
isMaxIdleDefined(long maxIdle) |
protected boolean |
isTtlDefined(long ttl) |
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) |
void |
sampleAndForceRemoveEntries(int entryCountToRemove) |
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 Address thisAddress
protected final EventService eventService
protected final MapEventPublisher mapEventPublisher
protected final ClearExpiredRecordsTask clearExpiredRecordsTask
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 Object get(Data dataKey, boolean backup, Address callerAddress)
RecordStore
public void evictEntries(Data excludedKey)
RecordStore
excludedKey
- this key has lowest priority to be selected for evictionpublic void sampleAndForceRemoveEntries(int entryCountToRemove)
public 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 isTtlDefined(long ttl)
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()
public void accessRecord(Record record, long now)
RecordStore
now
and
maintaining statistics.
An implementation is not supposed to be thread safe.
record
- the accessed recordnow
- the current timeprotected 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(Data key, 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 © 2021 Hazelcast, Inc.. All Rights Reserved.