use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.
the class ReplicateUpdateOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
long currentVersion = store.getVersion();
long updateVersion = response.getVersion();
if (currentVersion >= updateVersion) {
ILogger logger = getLogger();
if (logger.isFineEnabled()) {
logger.fine("Rejecting stale update received for replicated map: " + name + " partitionId=" + getPartitionId() + " current version: " + currentVersion + " update version: " + updateVersion);
}
return;
}
Object key = store.marshall(dataKey);
Object value = store.marshall(dataValue);
if (isRemove) {
store.removeWithVersion(key, updateVersion);
} else {
store.putWithVersion(key, value, ttl, TimeUnit.MILLISECONDS, false, updateVersion);
}
publishEvent();
}
use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.
the class ReplicateUpdateToCallerOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
long currentVersion = store.getVersion();
long updateVersion = response.getVersion();
if (currentVersion >= updateVersion) {
if (logger.isFineEnabled()) {
logger.fine("Rejecting stale update received for replicated map: " + name + " partitionId=" + getPartitionId() + " current version: " + currentVersion + " update version: " + updateVersion);
}
return;
}
Object key = store.marshall(dataKey);
Object value = store.marshall(dataValue);
if (isRemove) {
store.removeWithVersion(key, updateVersion);
} else {
store.putWithVersion(key, value, ttl, TimeUnit.MILLISECONDS, true, updateVersion);
}
publishEvent();
}
use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.
the class SyncReplicatedMapDataOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
if (logger.isFineEnabled()) {
logger.fine("Syncing " + recordSet.size() + " records and version: " + version + " for map: " + name + " partitionId=" + getPartitionId() + " from: " + getCallerAddress() + " to: " + getNodeEngine().getThisAddress());
}
ReplicatedMapService service = getService();
AbstractReplicatedRecordStore store = (AbstractReplicatedRecordStore) service.getReplicatedRecordStore(name, true, getPartitionId());
InternalReplicatedMapStorage<K, V> newStorage = new InternalReplicatedMapStorage<K, V>();
for (RecordMigrationInfo record : recordSet) {
K key = (K) store.marshall(record.getKey());
V value = (V) store.marshall(record.getValue());
ReplicatedRecord<K, V> replicatedRecord = buildReplicatedRecord(key, value, record.getTtl());
ReplicatedRecord oldRecord = store.getReplicatedRecord(key);
if (oldRecord != null) {
replicatedRecord.setHits(oldRecord.getHits());
}
newStorage.put(key, replicatedRecord);
if (record.getTtl() > 0) {
store.scheduleTtlEntry(record.getTtl(), key, value);
}
}
newStorage.syncVersion(version);
AtomicReference<InternalReplicatedMapStorage<K, V>> storageRef = store.getStorageRef();
storageRef.set(newStorage);
store.setLoaded(true);
}
use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.
the class CheckReplicaVersionOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
int partitionId = getPartitionId();
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(getPartitionId());
ConcurrentMap<String, ReplicatedRecordStore> stores = container.getStores();
for (Map.Entry<String, Long> entry : versions.entrySet()) {
String name = entry.getKey();
Long version = entry.getValue();
ReplicatedRecordStore store = stores.get(name);
if (store == null) {
if (logger.isFineEnabled()) {
logger.fine("Missing store on the replica ! map: " + name + " owner version:" + version + " partitionId=" + partitionId);
}
requestDataFromOwner(name);
} else if (store.isStale(version)) {
if (logger.isFineEnabled()) {
logger.fine("Stale replica! map: " + name + " owner version: " + version + " replica version: " + store.getVersion() + " partitionId=" + partitionId);
}
requestDataFromOwner(name);
}
}
}
use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.
the class BeforePromotionOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Running before promotion for " + getPartitionMigrationEvent());
}
PartitionMigrationEvent event = getPartitionMigrationEvent();
for (MigrationAwareService service : getMigrationAwareServices()) {
try {
service.beforeMigration(event);
} catch (Throwable e) {
logger.warning("While promoting " + getPartitionMigrationEvent(), e);
}
}
}
Aggregations