コード例 #1
0
  @Inject
  public GatewayService(
      Settings settings,
      AllocationService allocationService,
      ClusterService clusterService,
      ThreadPool threadPool,
      GatewayMetaState metaState,
      TransportNodesListGatewayMetaState listGatewayMetaState,
      Discovery discovery,
      IndicesService indicesService) {
    super(settings);
    this.gateway =
        new Gateway(
            settings, clusterService, metaState, listGatewayMetaState, discovery, indicesService);
    this.allocationService = allocationService;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    // allow to control a delay of when indices will get created
    this.expectedNodes = EXPECTED_NODES_SETTING.get(this.settings);
    this.expectedDataNodes = EXPECTED_DATA_NODES_SETTING.get(this.settings);
    this.expectedMasterNodes = EXPECTED_MASTER_NODES_SETTING.get(this.settings);

    if (RECOVER_AFTER_TIME_SETTING.exists(this.settings)) {
      recoverAfterTime = RECOVER_AFTER_TIME_SETTING.get(this.settings);
    } else if (expectedNodes >= 0 || expectedDataNodes >= 0 || expectedMasterNodes >= 0) {
      recoverAfterTime = DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET;
    } else {
      recoverAfterTime = null;
    }
    this.recoverAfterNodes = RECOVER_AFTER_NODES_SETTING.get(this.settings);
    this.recoverAfterDataNodes = RECOVER_AFTER_DATA_NODES_SETTING.get(this.settings);
    // default the recover after master nodes to the minimum master nodes in the discovery
    if (RECOVER_AFTER_MASTER_NODES_SETTING.exists(this.settings)) {
      recoverAfterMasterNodes = RECOVER_AFTER_MASTER_NODES_SETTING.get(this.settings);
    } else {
      // TODO: change me once the minimum_master_nodes is changed too
      recoverAfterMasterNodes = settings.getAsInt("discovery.zen.minimum_master_nodes", -1);
    }

    // Add the not recovered as initial state block, we don't allow anything until
    this.clusterService.addInitialStateBlock(STATE_NOT_RECOVERED_BLOCK);
  }
コード例 #2
0
 public Supplier<Transport> getTransportSupplier() {
   final String name;
   if (TRANSPORT_TYPE_SETTING.exists(settings)) {
     name = TRANSPORT_TYPE_SETTING.get(settings);
   } else {
     name = TRANSPORT_DEFAULT_TYPE_SETTING.get(settings);
   }
   final Supplier<Transport> factory = transportFactories.get(name);
   if (factory == null) {
     throw new IllegalStateException("Unsupported transport.type [" + name + "]");
   }
   return factory;
 }
コード例 #3
0
 public Supplier<HttpServerTransport> getHttpServerTransportSupplier() {
   final String name;
   if (HTTP_TYPE_SETTING.exists(settings)) {
     name = HTTP_TYPE_SETTING.get(settings);
   } else {
     name = HTTP_DEFAULT_TYPE_SETTING.get(settings);
   }
   final Supplier<HttpServerTransport> factory = transportHttpFactories.get(name);
   if (factory == null) {
     throw new IllegalStateException("Unsupported http.type [" + name + "]");
   }
   return factory;
 }