use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class BasicRecordStoreLoader method sendOperation.
/**
* Invokes an operation to put the provided key-value pairs to the partition
* record store.
*
* @param loadingSequence the list of serialised key-value-(expirationTime)
* sequences
* @return the future representing the pending completion of the put operation
*/
private Future<?> sendOperation(List<Data> loadingSequence) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
Operation operation = createOperation(loadingSequence);
operation.setNodeEngine(nodeEngine);
operation.setPartitionId(partitionId);
OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
operation.setServiceName(MapService.SERVICE_NAME);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxySupport method invoke.
private <T> T invoke(Operation operation, Data dataKey) {
NodeEngine nodeEngine = getNodeEngine();
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(dataKey);
Object result;
if (config.isStatisticsEnabled()) {
long startTimeNanos = Timer.nanos();
Future future;
future = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
result = future.get();
incrementOperationStats(startTimeNanos, name, operation);
} else {
Future future = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
result = future.get();
}
return nodeEngine.toObject(result);
} catch (Throwable throwable) {
throw ExceptionUtil.rethrow(throwable);
}
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MultiMapPartitionContainer method clearLockStore.
private void clearLockStore(String name) {
NodeEngine nodeEngine = service.getNodeEngine();
LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
DistributedObjectNamespace namespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxySupport method keySetInternal.
protected Set<Data> keySetInternal() {
NodeEngine nodeEngine = getNodeEngine();
try {
Map<Integer, Object> results = nodeEngine.getOperationService().invokeOnAllPartitions(MultiMapService.SERVICE_NAME, new MultiMapOperationFactory(name, OperationFactoryType.KEY_SET));
Set<Data> keySet = new HashSet<>();
for (Object result : results.values()) {
if (result == null) {
continue;
}
MultiMapResponse response = nodeEngine.toObject(result);
if (response.getCollection() != null) {
keySet.addAll(response.getCollection());
}
}
return keySet;
} catch (Throwable throwable) {
throw ExceptionUtil.rethrow(throwable);
}
}
use of com.hazelcast.spi.impl.NodeEngine 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