use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method readBackupData.
/**
* This method is called directly by user threads, in other words
* it is called outside of the partition threads.
*/
@Override
public Data readBackupData(Data key) {
Record record = getRecord(key);
if (record == null) {
return null;
} else {
if (partitionService.isPartitionOwner(partitionId)) {
// set last access time to prevent
// premature removal of the entry because
// of idleness based expiry
record.setLastAccessTime(getNow());
}
}
Object value = record.getValue();
mapServiceContext.interceptAfterGet(interceptorRegistry, value);
// this serialization step is needed not to expose the object, see issue 1292
return mapServiceContext.toData(value);
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method forEach.
@Override
public void forEach(BiConsumer<Data, Record> consumer, boolean backup, boolean includeExpiredRecords) {
long now = getNow();
Iterator<Map.Entry<Data, Record>> entries = storage.mutationTolerantIterator();
while (entries.hasNext()) {
Map.Entry<Data, Record> entry = entries.next();
Data key = entry.getKey();
Record record = entry.getValue();
if (includeExpiredRecords || hasExpired(key, now, backup) == ExpiryReason.NOT_EXPIRED) {
consumer.accept(key, record);
}
}
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method removeOrEvictEntries.
private int removeOrEvictEntries(ArrayList<Data> dataKeys, ArrayList<Record> records, boolean eviction) {
for (int i = 0; i < dataKeys.size(); i++) {
Data dataKey = dataKeys.get(i);
Record record = records.get(i);
removeOrEvictEntry(dataKey, record, eviction);
}
return dataKeys.size();
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method delete.
@Override
public boolean delete(Data key, CallerProvenance provenance) {
checkIfLoaded();
long now = getNow();
Record record = getRecordOrNull(key, now, false);
if (record == null) {
if (persistenceEnabledFor(provenance)) {
mapDataStore.remove(key, now, null);
}
} else {
return removeRecord(key, record, now, provenance, null) != null;
}
return false;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method putBackupInternal.
private Record putBackupInternal(Data key, Object value, long ttl, long maxIdle, long expiryTime, boolean putTransient, CallerProvenance provenance, UUID transactionId) {
long now = getNow();
putInternal(key, value, ttl, maxIdle, expiryTime, now, false, false, false, false, false, false, null, false, false, null, null, true, true);
Record record = getRecord(key);
if (persistenceEnabledFor(provenance)) {
if (putTransient) {
mapDataStore.addTransient(key, now);
} else {
mapDataStore.addBackup(key, value, expirySystem.getExpiryMetadata(key).getExpirationTime(), now, transactionId);
}
}
return record;
}
Aggregations