use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class AbstractRecordStore method createRecord.
@Override
public Record createRecord(Object value, long ttlMillis, long now) {
MapConfig mapConfig = mapContainer.getMapConfig();
Record record = recordFactory.newRecord(value);
record.setCreationTime(now);
record.setLastUpdateTime(now);
final long ttlMillisFromConfig = calculateTTLMillis(mapConfig);
final long ttl = pickTTL(ttlMillis, ttlMillisFromConfig);
record.setTtl(ttl);
final long maxIdleMillis = calculateMaxIdleMillis(mapConfig);
setExpirationTime(record, maxIdleMillis);
updateStatsOnPut(true, now);
return record;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method removeRecords.
protected int removeRecords(Collection<Record> recordsToRemove) {
if (CollectionUtil.isEmpty(recordsToRemove)) {
return 0;
}
int removalSize = recordsToRemove.size();
Iterator<Record> iterator = recordsToRemove.iterator();
while (iterator.hasNext()) {
Record record = iterator.next();
storage.removeRecord(record);
updateStatsOnRemove(record.getHits());
iterator.remove();
}
return removalSize;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method getNotLockedRecords.
protected Collection<Record> getNotLockedRecords() {
Set<Data> lockedKeySet = lockStore == null ? null : lockStore.getLockedKeys();
if (CollectionUtil.isEmpty(lockedKeySet)) {
return storage.values();
}
int notLockedKeyCount = storage.size() - lockedKeySet.size();
if (notLockedKeyCount <= 0) {
return emptyList();
}
List<Record> notLockedRecords = new ArrayList<Record>(notLockedKeyCount);
Collection<Record> records = storage.values();
for (Record record : records) {
if (!lockedKeySet.contains(record.getKey())) {
notLockedRecords.add(record);
}
}
return notLockedRecords;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method putBackup.
@Override
public Record putBackup(Data key, Object value, long ttl, boolean putTransient) {
final long now = getNow();
markRecordStoreExpirable(ttl);
Record record = getRecordOrNull(key, now, true);
if (record == null) {
record = createRecord(value, ttl, now);
storage.put(key, record);
} else {
updateRecord(key, record, value, now);
}
if (putTransient) {
mapDataStore.addTransient(key, now);
} else {
mapDataStore.addBackup(key, value, now);
}
return record;
}
use of com.hazelcast.map.impl.record.Record in project hazelcast by hazelcast.
the class DefaultRecordStore method removeBackup.
@Override
public void removeBackup(Data key) {
final long now = getNow();
final Record record = getRecordOrNull(key, now, true);
if (record == null) {
return;
}
storage.removeRecord(record);
updateStatsOnRemove(record.getHits());
mapDataStore.removeBackup(key, now);
}
Aggregations