@Before
  public void setup() {
    when(node.getPartitionService()).thenReturn(partitionService);
    when(node.getClusterService()).thenReturn(clusterService);
    when(node.getNodeExtension()).thenReturn(mock(NodeExtension.class));
    when(node.getLogger(ClusterStateManager.class)).thenReturn(mock(ILogger.class));

    clusterStateManager = new ClusterStateManager(node, lock);
  }
Ejemplo n.º 2
0
  public OperationServiceImpl(NodeEngineImpl nodeEngine) {
    this.nodeEngine = nodeEngine;
    this.node = nodeEngine.getNode();
    this.thisAddress = node.getThisAddress();
    this.logger = node.getLogger(OperationService.class);
    this.serializationService = (InternalSerializationService) nodeEngine.getSerializationService();

    this.backpressureRegulator =
        new BackpressureRegulator(
            node.getProperties(), node.getLogger(BackpressureRegulator.class));

    int coreSize = Runtime.getRuntime().availableProcessors();
    boolean reallyMultiCore = coreSize >= CORE_SIZE_CHECK;
    int concurrencyLevel = reallyMultiCore ? coreSize * CORE_SIZE_FACTOR : CONCURRENCY_LEVEL;

    this.invocationRegistry =
        new InvocationRegistry(
            node.getLogger(OperationServiceImpl.class),
            backpressureRegulator.newCallIdSequence(),
            concurrencyLevel);

    this.invocationMonitor =
        new InvocationMonitor(
            nodeEngine,
            thisAddress,
            node.getHazelcastThreadGroup(),
            node.getProperties(),
            invocationRegistry,
            node.getLogger(InvocationMonitor.class),
            serializationService,
            nodeEngine.getServiceManager());

    this.operationBackupHandler = new OperationBackupHandler(this);

    this.responseHandler =
        new ResponseHandler(
            node.getLogger(ResponseHandler.class),
            node.getSerializationService(),
            invocationRegistry,
            nodeEngine);
    this.asyncResponseHandler =
        new AsyncResponseHandler(
            node.getHazelcastThreadGroup(),
            node.getLogger(AsyncResponseHandler.class),
            responseHandler,
            node.getProperties());

    this.operationExecutor =
        new OperationExecutorImpl(
            node.getProperties(),
            node.loggingService,
            thisAddress,
            new OperationRunnerFactoryImpl(this),
            node.getHazelcastThreadGroup(),
            node.getNodeExtension());

    this.slowOperationDetector =
        new SlowOperationDetector(
            node.loggingService,
            operationExecutor.getGenericOperationRunners(),
            operationExecutor.getPartitionOperationRunners(),
            node.getProperties(),
            node.getHazelcastThreadGroup());
  }
Ejemplo n.º 3
0
 private <T> T createService(Class<T> service) {
   Node node = nodeEngine.getNode();
   NodeExtension nodeExtension = node.getNodeExtension();
   return nodeExtension.createService(service);
 }
Ejemplo n.º 4
0
 @Override
 public WriteHandler createWriteHandler(TcpIpConnection connection) {
   return node.getNodeExtension().createWriteHandler(connection, this);
 }
Ejemplo n.º 5
0
 @Override
 public MemberSocketInterceptor getMemberSocketInterceptor() {
   return node.getNodeExtension().getMemberSocketInterceptor();
 }
Ejemplo n.º 6
0
 @Override
 public SocketChannelWrapperFactory getSocketChannelWrapperFactory() {
   return node.getNodeExtension().getSocketChannelWrapperFactory();
 }