private ClientInvocation(
      HazelcastClientInstanceImpl client,
      EventHandler handler,
      ClientMessage clientMessage,
      int partitionId,
      Address address,
      Connection connection) {
    this.lifecycleService = client.getLifecycleService();
    this.invocationService = client.getInvocationService();
    this.executionService = client.getClientExecutionService();
    this.listenerService = (ClientListenerServiceImpl) client.getListenerService();
    this.handler = handler;
    this.clientMessage = clientMessage;
    this.partitionId = partitionId;
    this.address = address;
    this.connection = connection;
    final ClientProperties clientProperties = client.getClientProperties();

    int waitTime = clientProperties.getInvocationTimeoutSeconds().getInteger();
    long retryTimeoutInSeconds =
        waitTime > 0
            ? waitTime
            : Integer.parseInt(ClientProperties.PROP_INVOCATION_TIMEOUT_SECONDS_DEFAULT);

    clientInvocationFuture = new ClientInvocationFuture(this, client, clientMessage, handler);
    this.retryCountLimit = retryTimeoutInSeconds / RETRY_WAIT_TIME_IN_SECONDS;

    int interval = clientProperties.getHeartbeatInterval().getInteger();
    this.heartBeatInterval =
        interval > 0 ? interval : Integer.parseInt(PROP_HEARTBEAT_INTERVAL_DEFAULT);
  }
 public ClientInvocationServiceSupport(HazelcastClientInstanceImpl client) {
   this.client = client;
   this.connectionManager = client.getConnectionManager();
   this.executionService = client.getClientExecutionService();
   connectionManager.addConnectionListener(this);
   connectionManager.addConnectionHeartbeatListener(this);
   this.partitionService = client.getClientPartitionService();
   responseThread =
       new ResponseThread(
           client.getThreadGroup(),
           client.getName() + ".response-",
           client.getClientConfig().getClassLoader());
   responseThread.start();
 }
 public ClientListenerServiceImpl(
     HazelcastClientInstanceImpl client, int eventThreadCount, int eventQueueCapacity) {
   this.client = client;
   this.executionService = (ClientExecutionServiceImpl) client.getClientExecutionService();
   this.invocationService = client.getInvocationService();
   this.serializationService = client.getSerializationService();
   client.getClientClusterService().addMembershipListener(this);
   this.eventExecutor =
       new StripedExecutor(
           logger,
           client.getName() + ".event",
           client.getThreadGroup(),
           eventThreadCount,
           eventQueueCapacity);
 }
Esempio n. 4
0
  protected ClientInvocation(
      HazelcastClientInstanceImpl client,
      ClientMessage clientMessage,
      int partitionId,
      Address address,
      Connection connection) {
    this.lifecycleService = client.getLifecycleService();
    this.invocationService = client.getInvocationService();
    this.executionService = client.getClientExecutionService();
    this.clientMessage = clientMessage;
    this.partitionId = partitionId;
    this.address = address;
    this.connection = connection;

    HazelcastProperties hazelcastProperties = client.getProperties();
    long waitTime = hazelcastProperties.getMillis(INVOCATION_TIMEOUT_SECONDS);
    long waitTimeResolved =
        waitTime > 0 ? waitTime : Integer.parseInt(INVOCATION_TIMEOUT_SECONDS.getDefaultValue());
    retryTimeoutPointInMillis = System.currentTimeMillis() + waitTimeResolved;

    logger = ((ClientInvocationServiceSupport) invocationService).invocationLogger;
    clientInvocationFuture = new ClientInvocationFuture(this, client, clientMessage, logger);
  }