public ClusterServiceImpl(Node node) {

    this.node = node;
    nodeEngine = node.nodeEngine;

    logger = node.getLogger(ClusterService.class.getName());
    clusterClock = new ClusterClockImpl(logger);

    thisAddress = node.getThisAddress();
    thisMember = node.getLocalMember();

    clusterStateManager = new ClusterStateManager(node, lock);
    clusterJoinManager = new ClusterJoinManager(node, this, lock);
    clusterHeartbeatManager = new ClusterHeartbeatManager(node, this);

    registerThisMember();

    node.connectionManager.addConnectionListener(this);
    // MEMBERSHIP_EVENT_EXECUTOR is a single threaded executor to ensure that events are executed in
    // correct order.
    nodeEngine
        .getExecutionService()
        .register(MEMBERSHIP_EVENT_EXECUTOR_NAME, 1, Integer.MAX_VALUE, ExecutorType.CACHED);
    registerMetrics();
  }
 public void check(final Node hazelcastNode, final String version, final boolean isEnterprise) {
   ILogger logger = hazelcastNode.getLogger(PhoneHome.class);
   if (!hazelcastNode.getGroupProperties().getBoolean(GroupProperty.VERSION_CHECK_ENABLED)) {
     logger.warning(
         GroupProperty.VERSION_CHECK_ENABLED.getName()
             + " property is deprecated. Please use "
             + GroupProperty.PHONE_HOME_ENABLED.getName()
             + " instead to disable phone home.");
     return;
   }
   if (!hazelcastNode.getGroupProperties().getBoolean(GroupProperty.PHONE_HOME_ENABLED)) {
     return;
   }
   try {
     hazelcastNode
         .nodeEngine
         .getExecutionService()
         .scheduleAtFixedRate(
             new Runnable() {
               public void run() {
                 phoneHome(hazelcastNode, version, isEnterprise);
               }
             },
             0,
             1,
             TimeUnit.DAYS);
   } catch (RejectedExecutionException e) {
     logger.warning("Could not schedule phone home! Most probably Hazelcast is failed to start.");
   }
 }
Exemple #3
0
 public ClientEngineImpl(Node node) {
   this.node = node;
   this.serializationService = node.getSerializationService();
   nodeEngine = node.nodeEngine;
   executor = nodeEngine.getExecutionService().getExecutor(ExecutionService.CLIENT_EXECUTOR);
   logger = node.getLogger(ClientEngine.class);
 }
  @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);
  }
 protected AbstractMessageTask(ClientMessage clientMessage, Node node, Connection connection) {
   this.clientMessage = clientMessage;
   this.logger = node.getLogger(getClass());
   this.node = node;
   this.nodeEngine = node.nodeEngine;
   this.serializationService = node.getSerializationService();
   this.connection = connection;
   this.parameters = decodeClientMessage(clientMessage);
   this.clientEngine = node.clientEngine;
   this.endpointManager = clientEngine.getEndpointManager();
   this.endpoint = getEndpoint();
 }
  public PerformanceMonitor(HazelcastInstanceImpl hazelcastInstance, int delaySeconds) {
    super(
        hazelcastInstance.node.getHazelcastThreadGroup().getInternalThreadGroup(),
        hazelcastInstance.node.getHazelcastThreadGroup().getThreadNamePrefix("PerformanceMonitor"));
    setDaemon(true);

    this.delaySeconds = delaySeconds;
    this.node = hazelcastInstance.node;
    this.logger = node.getLogger(PerformanceMonitor.class.getName());
    this.operationService = (InternalOperationService) node.nodeEngine.getOperationService();
    this.connectionManager = node.connectionManager;
  }
  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();
  }
  public MulticastService(Node node, MulticastSocket multicastSocket) throws Exception {
    this.node = node;
    logger = node.getLogger(MulticastService.class.getName());
    Config config = node.getConfig();
    this.multicastSocket = multicastSocket;

    sendOutput = node.getSerializationService().createObjectDataOutput(1024);
    datagramPacketReceive =
        new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE);
    final MulticastConfig multicastConfig =
        config.getNetworkConfig().getJoin().getMulticastConfig();
    datagramPacketSend =
        new DatagramPacket(
            new byte[0],
            0,
            InetAddress.getByName(multicastConfig.getMulticastGroup()),
            multicastConfig.getMulticastPort());
    running = true;
  }
  public BasicOperationScheduler(
      Node node, ExecutionService executionService, BasicOperationProcessor processor) {
    this.executionService = executionService;
    this.logger = node.getLogger(BasicOperationScheduler.class);
    this.node = node;
    this.processor = processor;

    this.genericOperationThreads = new OperationThread[getGenericOperationThreadCount()];
    initOperationThreads(genericOperationThreads, new GenericOperationThreadFactory());

    this.partitionOperationThreads = new OperationThread[getPartitionOperationThreadCount()];
    initOperationThreads(partitionOperationThreads, new PartitionOperationThreadFactory());

    this.responseThread = new ResponseThread();
    responseThread.start();

    logger.info(
        "Starting with "
            + genericOperationThreads.length
            + "generic operation threads and "
            + partitionOperationThreads.length
            + " partition operation threads.");
  }
  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());
  }
 @Override
 public ILogger getLogger(Class clazz) {
   return node.getLogger(clazz);
 }
Exemple #12
0
 public ILogger getLogger(String className) {
   return node.getLogger(className);
 }
 @Override
 public ILogger getLogger(String name) {
   return node.getLogger(name);
 }
 public TcpIpJoinerOverAWS(Node node) {
   super(node);
   logger = node.getLogger(getClass());
   AwsConfig awsConfig = node.getConfig().getNetworkConfig().getJoin().getAwsConfig();
   aws = new AWSClient(awsConfig);
 }