예제 #1
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);
 }
 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();
 }
예제 #3
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();
  }
예제 #4
0
  private JoinMessage receive() {
    try {
      try {
        multicastSocket.receive(datagramPacketReceive);
      } catch (IOException ignore) {
        return null;
      }
      try {
        final byte[] data = datagramPacketReceive.getData();
        final int offset = datagramPacketReceive.getOffset();
        final BufferObjectDataInput input =
            node.getSerializationService().createObjectDataInput(data);
        input.position(offset);

        final byte packetVersion = input.readByte();
        if (packetVersion != Packet.VERSION) {
          logger.warning(
              "Received a JoinRequest with a different packet version! This -> "
                  + Packet.VERSION
                  + ", Incoming -> "
                  + packetVersion
                  + ", Sender -> "
                  + datagramPacketReceive.getAddress());
          return null;
        }
        try {
          return input.readObject();
        } finally {
          input.close();
        }
      } catch (Exception e) {
        if (e instanceof EOFException || e instanceof HazelcastSerializationException) {
          logger.warning(
              "Received data format is invalid."
                  + " (An old version of Hazelcast may be running here.)",
              e);
        } else {
          throw e;
        }
      }
    } catch (Exception e) {
      logger.warning(e);
    }
    return null;
  }
예제 #5
0
  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 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());
  }
예제 #7
0
 @Override
 public InternalSerializationService getSerializationService() {
   return node.getSerializationService();
 }
예제 #8
0
 @Override
 public PortableContext getPortableContext() {
   return node.getSerializationService().getPortableContext();
 }