コード例 #1
0
ファイル: ClientEngineImpl.java プロジェクト: notz/hazelcast
 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);
 }
コード例 #2
0
 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;
  }
コード例 #6
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());
  }
コード例 #7
0
 @Override
 public InternalSerializationService getSerializationService() {
   return node.getSerializationService();
 }
コード例 #8
0
 @Override
 public PortableContext getPortableContext() {
   return node.getSerializationService().getPortableContext();
 }