Search in sources :

Example 11 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.

the class LockEvictionProcessor method submit.

private void submit(UnlockOperation operation, Data key) {
    int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
    OperationService operationService = nodeEngine.getOperationService();
    operation.setPartitionId(partitionId);
    operation.setOperationResponseHandler(unlockResponseHandler);
    operation.setValidateTarget(false);
    operation.setAsyncBackup(true);
    operationService.invokeOnTarget(SERVICE_NAME, operation, nodeEngine.getThisAddress());
}
Also used : OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 12 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.

the class PartitionReplicaSyncRequestOffloadable method readReplicaVersions.

private void readReplicaVersions() {
    InternalPartitionServiceImpl partitionService = getService();
    OperationService operationService = getNodeEngine().getOperationService();
    PartitionReplicaVersionManager versionManager = partitionService.getPartitionReplicaVersionManager();
    UrgentPartitionRunnable<Void> gatherReplicaVersionsRunnable = new UrgentPartitionRunnable<>(partitionId(), () -> {
        for (ServiceNamespace ns : namespaces) {
            // make a copy because
            // getPartitionReplicaVersions
            // returns references to the internal
            // replica versions data structures
            // that may change under our feet
            long[] versions = Arrays.copyOf(versionManager.getPartitionReplicaVersions(partitionId(), ns), IPartition.MAX_BACKUP_COUNT);
            replicaVersions.put(BiTuple.of(partitionId(), ns), versions);
        }
    });
    operationService.execute(gatherReplicaVersionsRunnable);
    gatherReplicaVersionsRunnable.future.joinInternal();
}
Also used : InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) NonFragmentedServiceNamespace(com.hazelcast.internal.partition.NonFragmentedServiceNamespace) ServiceNamespace(com.hazelcast.internal.services.ServiceNamespace) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) PartitionReplicaVersionManager(com.hazelcast.internal.partition.PartitionReplicaVersionManager)

Example 13 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.

the class PartitionReplicaSyncRequest method sendResponse.

/**
 * Send a synchronization response to the caller replica containing the replication operations to be executed
 */
private void sendResponse(Collection<Operation> operations, Collection<ChunkSupplier> chunkSuppliers, ServiceNamespace ns) {
    NodeEngine nodeEngine = getNodeEngine();
    PartitionReplicaSyncResponse syncResponse = createResponse(operations, chunkSuppliers, ns);
    Address target = getCallerAddress();
    ILogger logger = getLogger();
    if (logger.isFinestEnabled()) {
        logger.finest("Sending sync response to -> " + target + " for partitionId=" + partitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns);
    }
    // PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.
    syncResponse.setTarget(target);
    OperationService operationService = nodeEngine.getOperationService();
    operationService.send(syncResponse, target);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Address(com.hazelcast.cluster.Address) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 14 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.

the class MapNearCacheManager method createRepairingInvalidationTask.

private RepairingTask createRepairingInvalidationTask() {
    ExecutionService executionService = nodeEngine.getExecutionService();
    ClusterService clusterService = nodeEngine.getClusterService();
    OperationService operationService = nodeEngine.getOperationService();
    HazelcastProperties properties = nodeEngine.getProperties();
    ILogger metadataFetcherLogger = nodeEngine.getLogger(MemberMapInvalidationMetaDataFetcher.class);
    InvalidationMetaDataFetcher invalidationMetaDataFetcher = new MemberMapInvalidationMetaDataFetcher(clusterService, operationService, metadataFetcherLogger);
    ILogger repairingTaskLogger = nodeEngine.getLogger(RepairingTask.class);
    UUID localUuid = nodeEngine.getLocalMember().getUuid();
    return new RepairingTask(properties, invalidationMetaDataFetcher, executionService.getGlobalTaskScheduler(), serializationService, partitionService, localUuid, repairingTaskLogger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) ClusterService(com.hazelcast.internal.cluster.ClusterService) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) ExecutionService(com.hazelcast.spi.impl.executionservice.ExecutionService) MemberMapInvalidationMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapInvalidationMetaDataFetcher) UUID(java.util.UUID) MemberMapInvalidationMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapInvalidationMetaDataFetcher) InvalidationMetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.InvalidationMetaDataFetcher)

Example 15 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.

the class ReplicatedMapProxy method clear.

@Override
public void clear() {
    OperationService operationService = nodeEngine.getOperationService();
    try {
        Map<Integer, Object> results = operationService.invokeOnAllPartitions(SERVICE_NAME, new ClearOperationFactory(name));
        int deletedEntrySize = 0;
        for (Object deletedEntryPerPartition : results.values()) {
            deletedEntrySize += (Integer) deletedEntryPerPartition;
        }
        eventPublishingService.fireMapClearedEvent(deletedEntrySize, name);
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : AbstractDistributedObject(com.hazelcast.spi.impl.AbstractDistributedObject) InitializingObject(com.hazelcast.spi.impl.InitializingObject) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) ClearOperationFactory(com.hazelcast.replicatedmap.impl.operation.ClearOperationFactory)

Aggregations

OperationService (com.hazelcast.spi.impl.operationservice.OperationService)140 Operation (com.hazelcast.spi.impl.operationservice.Operation)55 Test (org.junit.Test)54 HazelcastInstance (com.hazelcast.core.HazelcastInstance)46 QuickTest (com.hazelcast.test.annotation.QuickTest)41 Accessors.getOperationService (com.hazelcast.test.Accessors.getOperationService)40 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)40 Address (com.hazelcast.cluster.Address)31 NodeEngine (com.hazelcast.spi.impl.NodeEngine)31 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)24 Future (java.util.concurrent.Future)24 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)23 Config (com.hazelcast.config.Config)22 Member (com.hazelcast.cluster.Member)21 Data (com.hazelcast.internal.serialization.Data)12 SlowTest (com.hazelcast.test.annotation.SlowTest)12 ClusterService (com.hazelcast.internal.cluster.ClusterService)9 ILogger (com.hazelcast.logging.ILogger)7 ArrayList (java.util.ArrayList)7 IPartitionService (com.hazelcast.internal.partition.IPartitionService)6