use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method containsValue.
@Override
public boolean containsValue(@Nonnull Object value) {
ensureNoSplitBrain(READ);
checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
for (ReplicatedRecordStore store : stores) {
if (store.containsValue(value)) {
return true;
}
}
return false;
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class SizeOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
int size = 0;
for (ReplicatedRecordStore store : stores) {
size += store.size();
}
response = size;
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class PutAllOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
int partitionId = getPartitionId();
IPartitionService partitionService = getNodeEngine().getPartitionService();
ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
for (int i = 0; i < entries.size(); i++) {
Data key = entries.getKey(i);
Data value = entries.getValue(i);
if (partitionId != partitionService.getPartitionId(key)) {
continue;
}
Object putResult = store.put(key, value);
Data oldValue = getNodeEngine().toData(putResult);
eventPublishingService.fireEntryListenerEvent(key, oldValue, value, name, getCallerAddress());
VersionResponsePair response = new VersionResponsePair(putResult, store.getVersion());
publishReplicationMessage(key, value, response);
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class PutOperation method run.
@Override
public void run() throws Exception {
service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
Address thisAddress = getNodeEngine().getThisAddress();
boolean isLocal = getCallerAddress().equals(thisAddress);
Object putResult = store.put(key, value, ttl, TimeUnit.MILLISECONDS, isLocal);
oldValue = getNodeEngine().toData(putResult);
response = new VersionResponsePair(putResult, store.getVersion());
if (!isLocal) {
sendUpdateCallerOperation(false);
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class RequestMapDataOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
Address callerAddress = getCallerAddress();
int partitionId = getPartitionId();
NodeEngine nodeEngine = getNodeEngine();
if (logger.isFineEnabled()) {
logger.fine("Caller " + callerAddress + " requested copy of replicated map '" + name + "' (partitionId " + partitionId + ") from " + nodeEngine.getThisAddress());
}
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(partitionId);
ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
store.setLoaded(true);
if (nodeEngine.getThisAddress().equals(callerAddress)) {
return;
}
long version = store.getVersion();
Set<RecordMigrationInfo> recordSet = getRecordSet(store);
Operation op = new SyncReplicatedMapDataOperation(name, recordSet, version).setPartitionId(partitionId).setValidateTarget(false);
OperationService operationService = nodeEngine.getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Aggregations