Search in sources :

Example 6 with OperationService

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

the class ManagementCenterService method callOnAddress.

public Object callOnAddress(Address address, Operation operation) {
    // TODO: why are we always executing on the MapService?
    OperationService operationService = instance.node.nodeEngine.getOperationService();
    Future future = operationService.invokeOnTarget(MapService.SERVICE_NAME, operation, address);
    try {
        return future.get();
    } catch (Throwable t) {
        return ExceptionUtil.toString(t);
    }
}
Also used : Future(java.util.concurrent.Future) OperationService(com.hazelcast.spi.OperationService)

Example 7 with OperationService

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

the class ManagementCenterService method send.

public void send(Address address, Operation operation) {
    OperationService operationService = instance.node.nodeEngine.getOperationService();
    operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).invoke();
}
Also used : OperationService(com.hazelcast.spi.OperationService)

Example 8 with OperationService

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

the class MasterConfirmationOperation method run.

@Override
public void run() {
    final Address endpoint = getCallerAddress();
    if (endpoint == null) {
        return;
    }
    final ClusterServiceImpl clusterService = getService();
    final ILogger logger = getLogger();
    final MemberImpl member = clusterService.getMember(endpoint);
    if (member == null) {
        logger.warning("MasterConfirmation has been received from " + endpoint + ", but it is not a member of this cluster!");
        OperationService operationService = getNodeEngine().getOperationService();
        operationService.send(new MemberRemoveOperation(clusterService.getThisAddress()), endpoint);
    } else {
        if (clusterService.isMaster()) {
            clusterService.getClusterHeartbeatManager().acceptMasterConfirmation(member, timestamp);
        } else {
            logger.warning(endpoint + " has sent MasterConfirmation, but this node is not master!");
        }
    }
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.OperationService)

Example 9 with OperationService

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

the class ReplicaSyncRequest method sendRetryResponse.

/** Send a response to the replica to retry the replica sync */
private void sendRetryResponse() {
    NodeEngine nodeEngine = getNodeEngine();
    int partitionId = getPartitionId();
    int replicaIndex = getReplicaIndex();
    ReplicaSyncRetryResponse response = new ReplicaSyncRetryResponse();
    response.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
    Address target = getCallerAddress();
    OperationService operationService = nodeEngine.getOperationService();
    operationService.send(response, target);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) Address(com.hazelcast.nio.Address) OperationService(com.hazelcast.spi.OperationService)

Example 10 with OperationService

use of com.hazelcast.spi.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 logger = nodeEngine.getLogger(RepairingTask.class);
    MetaDataFetcher metaDataFetcher = new MemberMapMetaDataFetcher(clusterService, operationService, logger);
    String localUuid = nodeEngine.getLocalMember().getUuid();
    return new RepairingTask(metaDataFetcher, executionService.getGlobalTaskScheduler(), partitionService, properties, localUuid, logger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) MemberMapMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapMetaDataFetcher) ClusterService(com.hazelcast.internal.cluster.ClusterService) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.OperationService) ExecutionService(com.hazelcast.spi.ExecutionService) MetaDataFetcher(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataFetcher) MemberMapMetaDataFetcher(com.hazelcast.map.impl.nearcache.invalidation.MemberMapMetaDataFetcher)

Aggregations

OperationService (com.hazelcast.spi.OperationService)135 Test (org.junit.Test)49 QuickTest (com.hazelcast.test.annotation.QuickTest)48 ParallelTest (com.hazelcast.test.annotation.ParallelTest)46 HazelcastInstance (com.hazelcast.core.HazelcastInstance)45 Operation (com.hazelcast.spi.Operation)39 NodeEngine (com.hazelcast.spi.NodeEngine)30 Address (com.hazelcast.nio.Address)26 Future (java.util.concurrent.Future)26 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)24 Config (com.hazelcast.config.Config)21 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)21 Member (com.hazelcast.core.Member)19 Data (com.hazelcast.nio.serialization.Data)14 ArrayList (java.util.ArrayList)11 Node (com.hazelcast.instance.Node)7 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)7 ExecutionException (java.util.concurrent.ExecutionException)7 TimeoutException (java.util.concurrent.TimeoutException)7 OperationTimeoutException (com.hazelcast.core.OperationTimeoutException)6