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);
}
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);
}
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);
}
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;
}
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);
}
}
Aggregations