Exemplo n.º 1
0
 public TcpIpJoiner(Node node) {
   super(node);
   int tryCount = node.getProperties().getInteger(GroupProperty.TCP_JOIN_PORT_TRY_COUNT);
   if (tryCount <= 0) {
     throw new IllegalArgumentException(
         String.format(
             "%s should be greater than zero! Current value: %d",
             GroupProperty.TCP_JOIN_PORT_TRY_COUNT, tryCount));
   }
   maxPortTryCount = tryCount;
 }
Exemplo n.º 2
0
  public ClientEngineImpl(Node node) {
    this.logger = node.getLogger(ClientEngine.class);
    this.node = node;
    this.serializationService = node.getSerializationService();
    this.nodeEngine = node.nodeEngine;
    this.endpointManager = new ClientEndpointManagerImpl(this, nodeEngine);
    this.executor = newExecutor();
    this.messageTaskFactory = new CompositeMessageTaskFactory(this.nodeEngine);
    this.clientExceptionFactory = initClientExceptionFactory();

    ClientHeartbeatMonitor heartBeatMonitor =
        new ClientHeartbeatMonitor(
            endpointManager, this, nodeEngine.getExecutionService(), node.getProperties());
    heartBeatMonitor.start();
  }
Exemplo n.º 3
0
  private Executor newExecutor() {
    final ExecutionService executionService = nodeEngine.getExecutionService();
    int coreSize = Runtime.getRuntime().availableProcessors();

    int threadCount = node.getProperties().getInteger(GroupProperty.CLIENT_ENGINE_THREAD_COUNT);
    if (threadCount <= 0) {
      threadCount = coreSize * THREADS_PER_CORE;
    }

    return executionService.register(
        ExecutionService.CLIENT_EXECUTOR,
        threadCount,
        coreSize * EXECUTOR_QUEUE_CAPACITY_PER_CORE,
        ExecutorType.CONCRETE);
  }
Exemplo n.º 4
0
 @Override
 public int getSocketLingerSeconds() {
   return node.getProperties().getSeconds(GroupProperty.SOCKET_LINGER_SECONDS);
 }
Exemplo n.º 5
0
 @Override
 public int getBalancerIntervalSeconds() {
   return node.getProperties().getSeconds(GroupProperty.IO_BALANCER_INTERVAL_SECONDS);
 }
Exemplo n.º 6
0
 @Override
 public int getConnectionMonitorMaxFaults() {
   return node.getProperties().getInteger(GroupProperty.CONNECTION_MONITOR_MAX_FAULTS);
 }
Exemplo n.º 7
0
 @Override
 public long getConnectionMonitorInterval() {
   return node.getProperties().getMillis(GroupProperty.CONNECTION_MONITOR_INTERVAL);
 }
Exemplo n.º 8
0
 @Override
 public int getOutputSelectorThreadCount() {
   return node.getProperties().getInteger(GroupProperty.IO_OUTPUT_THREAD_COUNT);
 }
Exemplo n.º 9
0
 @Override
 public boolean getSocketNoDelay() {
   return node.getProperties().getBoolean(GroupProperty.SOCKET_NO_DELAY);
 }
Exemplo n.º 10
0
 @Override
 public boolean getSocketKeepAlive() {
   return node.getProperties().getBoolean(GroupProperty.SOCKET_KEEP_ALIVE);
 }
Exemplo n.º 11
0
 @Override
 public boolean isMemcacheEnabled() {
   return node.getProperties().getBoolean(GroupProperty.MEMCACHE_ENABLED);
 }
Exemplo n.º 12
0
 @Override
 public int getSocketClientSendBufferSize() {
   int clientReceiveBuffer =
       node.getProperties().getInteger(GroupProperty.SOCKET_CLIENT_SEND_BUFFER_SIZE);
   return clientReceiveBuffer != -1 ? clientReceiveBuffer : getSocketReceiveBufferSize();
 }
Exemplo n.º 13
0
 @Override
 public boolean isSocketBufferDirect() {
   return node.getProperties().getBoolean(GroupProperty.SOCKET_BUFFER_DIRECT);
 }
Exemplo n.º 14
0
 @Override
 public int getSocketSendBufferSize() {
   return node.getProperties().getInteger(GroupProperty.SOCKET_SEND_BUFFER_SIZE);
 }
Exemplo n.º 15
0
 @Override
 public int getSocketReceiveBufferSize() {
   return node.getProperties().getInteger(GroupProperty.SOCKET_RECEIVE_BUFFER_SIZE);
 }
Exemplo n.º 16
0
 @Override
 public boolean isSocketBindAny() {
   return node.getProperties().getBoolean(GroupProperty.SOCKET_CLIENT_BIND_ANY);
 }
Exemplo n.º 17
0
 @Override
 public boolean isRestEnabled() {
   return node.getProperties().getBoolean(GroupProperty.REST_ENABLED);
 }
Exemplo n.º 18
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());
  }
Exemplo n.º 19
0
 @Override
 public int getSocketConnectTimeoutSeconds() {
   return node.getProperties().getSeconds(GroupProperty.SOCKET_CONNECT_TIMEOUT_SECONDS);
 }