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