Search in sources :

Example 1 with InternalOperationService

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

the class FinalizeJoinOperation method runPostJoinOp.

private void runPostJoinOp() {
    if (postJoinOp == null) {
        return;
    }
    ClusterServiceImpl clusterService = getService();
    NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    postJoinOp.setNodeEngine(nodeEngine);
    OperationAccessor.setCallerAddress(postJoinOp, getCallerAddress());
    OperationAccessor.setConnection(postJoinOp, getConnection());
    postJoinOp.setOperationResponseHandler(createEmptyResponseHandler());
    operationService.run(postJoinOp);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 2 with InternalOperationService

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

the class TimedMemberStateFactoryHelper method registerJMXBeans.

static void registerJMXBeans(HazelcastInstanceImpl instance, MemberStateImpl memberState) {
    final EventService es = instance.node.nodeEngine.getEventService();
    final InternalOperationService os = instance.node.nodeEngine.getOperationService();
    final ConnectionManager cm = instance.node.connectionManager;
    final InternalPartitionService ps = instance.node.partitionService;
    final ProxyService proxyService = instance.node.nodeEngine.getProxyService();
    final ExecutionService executionService = instance.node.nodeEngine.getExecutionService();
    final MXBeansDTO beans = new MXBeansDTO();
    final EventServiceDTO esBean = new EventServiceDTO(es);
    beans.setEventServiceBean(esBean);
    final OperationServiceDTO osBean = new OperationServiceDTO(os);
    beans.setOperationServiceBean(osBean);
    final ConnectionManagerDTO cmBean = new ConnectionManagerDTO(cm);
    beans.setConnectionManagerBean(cmBean);
    final PartitionServiceBeanDTO psBean = new PartitionServiceBeanDTO(ps, instance);
    beans.setPartitionServiceBean(psBean);
    final ProxyServiceDTO proxyServiceBean = new ProxyServiceDTO(proxyService);
    beans.setProxyServiceBean(proxyServiceBean);
    final ManagedExecutorService systemExecutor = executionService.getExecutor(ExecutionService.SYSTEM_EXECUTOR);
    final ManagedExecutorService asyncExecutor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
    final ManagedExecutorService scheduledExecutor = executionService.getExecutor(ExecutionService.SCHEDULED_EXECUTOR);
    final ManagedExecutorService clientExecutor = executionService.getExecutor(ExecutionService.CLIENT_EXECUTOR);
    final ManagedExecutorService queryExecutor = executionService.getExecutor(ExecutionService.QUERY_EXECUTOR);
    final ManagedExecutorService ioExecutor = executionService.getExecutor(ExecutionService.IO_EXECUTOR);
    final ManagedExecutorDTO systemExecutorDTO = new ManagedExecutorDTO(systemExecutor);
    final ManagedExecutorDTO asyncExecutorDTO = new ManagedExecutorDTO(asyncExecutor);
    final ManagedExecutorDTO scheduledExecutorDTO = new ManagedExecutorDTO(scheduledExecutor);
    final ManagedExecutorDTO clientExecutorDTO = new ManagedExecutorDTO(clientExecutor);
    final ManagedExecutorDTO queryExecutorDTO = new ManagedExecutorDTO(queryExecutor);
    final ManagedExecutorDTO ioExecutorDTO = new ManagedExecutorDTO(ioExecutor);
    beans.putManagedExecutor(ExecutionService.SYSTEM_EXECUTOR, systemExecutorDTO);
    beans.putManagedExecutor(ExecutionService.ASYNC_EXECUTOR, asyncExecutorDTO);
    beans.putManagedExecutor(ExecutionService.SCHEDULED_EXECUTOR, scheduledExecutorDTO);
    beans.putManagedExecutor(ExecutionService.CLIENT_EXECUTOR, clientExecutorDTO);
    beans.putManagedExecutor(ExecutionService.QUERY_EXECUTOR, queryExecutorDTO);
    beans.putManagedExecutor(ExecutionService.IO_EXECUTOR, ioExecutorDTO);
    memberState.setBeans(beans);
}
Also used : InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) EventService(com.hazelcast.spi.EventService) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ExecutionService(com.hazelcast.spi.ExecutionService) EventServiceDTO(com.hazelcast.internal.management.dto.EventServiceDTO) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) ManagedExecutorDTO(com.hazelcast.internal.management.dto.ManagedExecutorDTO) ConnectionManagerDTO(com.hazelcast.internal.management.dto.ConnectionManagerDTO) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) ConnectionManager(com.hazelcast.nio.ConnectionManager) ProxyService(com.hazelcast.spi.ProxyService) PartitionServiceBeanDTO(com.hazelcast.internal.management.dto.PartitionServiceBeanDTO) OperationServiceDTO(com.hazelcast.internal.management.dto.OperationServiceDTO) ProxyServiceDTO(com.hazelcast.internal.management.dto.ProxyServiceDTO)

Example 3 with InternalOperationService

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

the class WanReplicationTest method entryProcessorTest.

@Test
public void entryProcessorTest() throws Exception {
    initInstancesAndMap("wan-replication-test-entry-processor");
    for (int i = 0; i < 10; i++) {
        map.put(i, i);
    }
    assertTotalQueueSize(10);
    // clean event queues
    impl1.eventQueue.clear();
    impl2.eventQueue.clear();
    InternalSerializationService serializationService = getSerializationService(instance1);
    Set<Data> keySet = new HashSet<Data>();
    for (int i = 0; i < 10; i++) {
        keySet.add(serializationService.toData(i));
    }
    // multiple entry operations (update)
    OperationFactory operationFactory = getOperationProvider(map).createMultipleEntryOperationFactory(map.getName(), keySet, new UpdatingEntryProcessor());
    InternalOperationService operationService = getOperationService(instance1);
    operationService.invokeOnAllPartitions(MapService.SERVICE_NAME, operationFactory);
    // there should be 10 events since all entries should be processed
    assertTotalQueueSize(10);
    // multiple entry operations (remove)
    OperationFactory deletingOperationFactory = getOperationProvider(map).createMultipleEntryOperationFactory(map.getName(), keySet, new DeletingEntryProcessor());
    operationService.invokeOnAllPartitions(MapService.SERVICE_NAME, deletingOperationFactory);
    // 10 more event should be published
    assertTotalQueueSize(20);
}
Also used : Data(com.hazelcast.nio.serialization.Data) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) HashSet(java.util.HashSet) OperationFactory(com.hazelcast.spi.OperationFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 4 with InternalOperationService

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

the class ParkedOperation method isCallTimedOut.

public boolean isCallTimedOut() {
    final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    if (operationService.isCallTimedOut(op)) {
        cancel(new CallTimeoutResponse(op.getCallId(), op.isUrgent()));
        return true;
    }
    return false;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CallTimeoutResponse(com.hazelcast.spi.impl.operationservice.impl.responses.CallTimeoutResponse) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Example 5 with InternalOperationService

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

the class AdvancedClusterStateTest method partitionInvocation_shouldFail_whenPartitionsNotAssigned_inPassiveState.

@Test(expected = IllegalStateException.class)
public void partitionInvocation_shouldFail_whenPartitionsNotAssigned_inPassiveState() throws InterruptedException {
    Config config = new Config();
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);
    HazelcastInstance[] instances = factory.newInstances(config);
    HazelcastInstance hz1 = instances[0];
    HazelcastInstance hz2 = instances[1];
    HazelcastInstance hz3 = instances[2];
    hz2.getCluster().changeClusterState(ClusterState.PASSIVE);
    InternalOperationService operationService = getNode(hz3).getNodeEngine().getOperationService();
    Operation op = new AddAndGetOperation(randomName(), 1);
    Future<Long> future = operationService.invokeOnPartition(AtomicLongService.SERVICE_NAME, op, 1);
    try {
        future.get();
        fail("Partition invocation must fail, because partitions cannot be assigned!");
    } catch (ExecutionException e) {
        // IllegalStateException should be cause of ExecutionException.
        throw ExceptionUtil.rethrow(e);
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) AddAndGetOperation(com.hazelcast.concurrent.atomiclong.operations.AddAndGetOperation) Config(com.hazelcast.config.Config) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) Operation(com.hazelcast.spi.Operation) AddAndGetOperation(com.hazelcast.concurrent.atomiclong.operations.AddAndGetOperation) ExecutionException(java.util.concurrent.ExecutionException) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)20 ParallelTest (com.hazelcast.test.annotation.ParallelTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 Test (org.junit.Test)5 ClientEndpoint (com.hazelcast.client.ClientEndpoint)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 Address (com.hazelcast.nio.Address)4 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)4 Data (com.hazelcast.nio.serialization.Data)3 InvocationBuilder (com.hazelcast.spi.InvocationBuilder)3 Operation (com.hazelcast.spi.Operation)3 OperationFactory (com.hazelcast.spi.OperationFactory)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 OperationFactoryWrapper (com.hazelcast.client.impl.operations.OperationFactoryWrapper)2 AddAndGetOperation (com.hazelcast.concurrent.atomiclong.operations.AddAndGetOperation)2 Config (com.hazelcast.config.Config)2 CancellationOperation (com.hazelcast.executor.impl.operations.CancellationOperation)2 MemberImpl (com.hazelcast.instance.MemberImpl)2 Future (java.util.concurrent.Future)2 AuthenticationCustomCredentialsMessageTask (com.hazelcast.client.impl.protocol.task.AuthenticationCustomCredentialsMessageTask)1