Example #1
0
 private long getRetryCountLimit() {
   HazelcastProperties hazelcastProperties = client.getProperties();
   int waitTime = hazelcastProperties.getSeconds(INVOCATION_TIMEOUT_SECONDS);
   long retryTimeoutInSeconds =
       waitTime > 0 ? waitTime : Integer.parseInt(INVOCATION_TIMEOUT_SECONDS.getDefaultValue());
   return retryTimeoutInSeconds / ClientInvocation.RETRY_WAIT_TIME_IN_SECONDS;
 }
  protected MapProxySupport(
      String name, MapService service, NodeEngine nodeEngine, MapConfig mapConfig) {
    super(nodeEngine, service);
    this.name = name;

    HazelcastProperties properties = nodeEngine.getProperties();

    this.mapServiceContext = service.getMapServiceContext();
    this.mapConfig = mapConfig;
    this.partitionStrategy =
        PartitioningStrategyFactory.getPartitioningStrategy(
            nodeEngine, mapConfig.getName(), mapConfig.getPartitioningStrategyConfig());
    this.localMapStats = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(name);
    this.partitionService = getNodeEngine().getPartitionService();
    this.lockSupport =
        new LockProxySupport(
            new DefaultObjectNamespace(SERVICE_NAME, name),
            LockServiceImpl.getMaxLeaseTimeInMillis(properties));
    this.operationProvider = mapServiceContext.getMapOperationProvider(name);
    this.operationService = nodeEngine.getOperationService();
    this.serializationService = nodeEngine.getSerializationService();
    this.thisAddress = nodeEngine.getClusterService().getThisAddress();
    this.statisticsEnabled = mapConfig.isStatisticsEnabled();

    this.putAllBatchSize = properties.getInteger(MAP_PUT_ALL_BATCH_SIZE);
    this.putAllInitialSizeFactor = properties.getFloat(MAP_PUT_ALL_INITIAL_SIZE_FACTOR);
  }
 public InvocationPlugin(NodeEngineImpl nodeEngine) {
   super(nodeEngine.getLogger(PendingInvocationsPlugin.class));
   InternalOperationService operationService = nodeEngine.getOperationService();
   this.invocationRegistry = ((OperationServiceImpl) operationService).getInvocationRegistry();
   HazelcastProperties props = nodeEngine.getProperties();
   this.samplePeriodMillis = props.getMillis(SAMPLE_PERIOD_SECONDS);
   this.thresholdMillis = props.getMillis(SLOW_THRESHOLD_SECONDS);
 }
  private long invocationTimeoutMillis(HazelcastProperties properties) {
    long heartbeatTimeoutMillis = properties.getMillis(OPERATION_CALL_TIMEOUT_MILLIS);
    if (logger.isFinestEnabled()) {
      logger.finest("Operation invocation timeout is " + heartbeatTimeoutMillis + " ms");
    }

    return heartbeatTimeoutMillis;
  }
  private long backupTimeoutMillis(HazelcastProperties properties) {
    long backupTimeoutMillis = properties.getMillis(OPERATION_BACKUP_TIMEOUT_MILLIS);

    if (logger.isFinestEnabled()) {
      logger.finest("Operation backup timeout is " + backupTimeoutMillis + " ms");
    }

    return backupTimeoutMillis;
  }
Example #6
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);
  }
  private long heartbeatBroadcastPeriodMillis(HazelcastProperties properties) {
    // The heartbeat period is configured to be 1/4 of the call timeout. So with default settings,
    // every 15 seconds,
    // every member in the cluster, will notify every other member in the cluster about all calls
    // that are pending.
    // This is done quite efficiently; imagine at any given moment one node has 1000 concurrent
    // calls pending on another
    // node; then every 15 seconds an 8 KByte packet is send to the other member.
    // Another advantage is that multiple heartbeat timeouts are allowed to get lost; without
    // leading to premature
    // abortion of the invocation.
    int callTimeoutMs = properties.getInteger(OPERATION_CALL_TIMEOUT_MILLIS);
    long periodMs = Math.max(SECONDS.toMillis(1), callTimeoutMs / HEARTBEAT_CALL_TIMEOUT_RATIO);

    if (logger.isFinestEnabled()) {
      logger.finest("Operation heartbeat period is " + periodMs + " ms");
    }

    return periodMs;
  }