io.airlift.bootstrap.Bootstrap.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中io.airlift.bootstrap.Bootstrap.<init>()方法的一些代码示例,展示了Bootstrap.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bootstrap.<init>()方法的具体详情如下:
包路径:io.airlift.bootstrap.Bootstrap
类名称:Bootstrap
方法名:<init>

Bootstrap.<init>介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

public static void start(List<Module> extraModules)
    throws Exception
{
  Bootstrap app = new Bootstrap(
      ImmutableList.<Module>builder()
          .add(new DriftNettyServerModule())
          .add(new ThriftTpchServerModule())
          .addAll(requireNonNull(extraModules, "extraModules is null"))
          .build());
  app.strictConfig().initialize();
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    try {
      Bootstrap app = new Bootstrap(
          binder -> {
            configBinder(binder).bindConfig(JmxConnectorConfig.class);
            binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(mbeanServer));
            binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            binder.bind(JmxConnector.class).in(Scopes.SINGLETON);
            binder.bind(JmxHistoricalData.class).in(Scopes.SINGLETON);
            binder.bind(JmxMetadata.class).in(Scopes.SINGLETON);
            binder.bind(JmxSplitManager.class).in(Scopes.SINGLETON);
            binder.bind(JmxPeriodicSampler.class).in(Scopes.SINGLETON);
            binder.bind(JmxRecordSetProvider.class).in(Scopes.SINGLETON);
          });

      Injector injector = app.strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(JmxConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public PasswordAuthenticator create(Map<String, String> config)
  {
    try {
      Bootstrap app = new Bootstrap(
          binder -> {
            configBinder(binder).bindConfig(LdapConfig.class);
            binder.bind(LdapAuthenticator.class).in(Scopes.SINGLETON);
          });

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(LdapAuthenticator.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    requireNonNull(config, "config is null");

    try {
      Bootstrap app = new Bootstrap(
          binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
          new LocalFileModule(catalogName));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(LocalFileConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new ElasticsearchConnectorModule(),
          binder -> {
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            binder.bind(ElasticsearchTableDescriptionProvider.class).in(Scopes.SINGLETON);
          });

      Injector injector = app.strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(ElasticsearchConnector.class);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context)
  {
    requireNonNull(requiredConfig, "requiredConfig is null");

    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
      Bootstrap app = new Bootstrap(new JdbcModule(catalogName), module);

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(requiredConfig)
          .initialize();

      return injector.getInstance(JdbcConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public ResourceGroupConfigurationManager<VariableMap> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context)
  {
    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new DbResourceGroupsModule(),
          binder -> binder.bind(String.class).annotatedWith(ForEnvironment.class).toInstance(context.getEnvironment()),
          binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();
      return injector.getInstance(DbResourceGroupConfigurationManager.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    requireNonNull(config, "config is null");

    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new MongoClientModule(),
          binder -> binder.bind(TypeManager.class).toInstance(context.getTypeManager()));

      Injector injector = app.strictConfig().doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(MongoConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
  requireNonNull(catalogName, "catalogName is null");
  requireNonNull(config, "requiredConfig is null");
  requireNonNull(context, "context is null");
  try {
    // A plugin is not required to use Guice; it is just very convenient
    // Unless you don't really know how to Guice, then it is less convenient
    Bootstrap app = new Bootstrap(new JsonModule(), new AccumuloModule(catalogName, context.getTypeManager()));
    Injector injector = app
        .strictConfig()
        .doNotInitializeLogging()
        .setRequiredConfigurationProperties(config)
        .initialize();
    return injector.getInstance(AccumuloConnector.class);
  }
  catch (Exception e) {
    throwIfUnchecked(e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public ResourceGroupConfigurationManager<VariableMap> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context)
  {
    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new FileResourceGroupsModule(),
          binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();
      return injector.getInstance(FileResourceGroupConfigurationManager.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context)
  {
    requireNonNull(requiredConfig, "requiredConfig is null");
    try {
      // A plugin is not required to use Guice; it is just very convenient
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new ExampleModule(catalogName, context.getTypeManager()));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(requiredConfig)
          .initialize();

      return injector.getInstance(ExampleConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public SessionPropertyConfigurationManager create(Map<String, String> config, SessionPropertyConfigurationManagerContext context)
  {
    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new FileSessionPropertyManagerModule());

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();
      return injector.getInstance(FileSessionPropertyManager.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context)
  {
    requireNonNull(requiredConfig, "requiredConfig is null");
    try {
      // A plugin is not required to use Guice; it is just very convenient
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new MemoryModule(catalogName, context.getTypeManager(), context.getNodeManager()));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(requiredConfig)
          .initialize();

      return injector.getInstance(MemoryConnector.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    requireNonNull(config, "config is null");

    try {
      Bootstrap app = new Bootstrap(new JsonModule(),
          new KuduModule(catalogName, context.getTypeManager()));

      Injector injector =
          app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config)
              .initialize();

      return injector.getInstance(KuduConnector.class);
    }
    catch (RuntimeException e) {
      throw e;
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

public static void start(Module... extraModules)
{
  Bootstrap app = new Bootstrap(ImmutableList.<Module>builder()
      .add(new NodeModule())
      .add(new HttpServerModule())
      .add(new JsonModule())
      .add(new JaxrsModule(true))
      .add(new MBeanModule())
      .add(new JmxModule())
      .add(new LogJmxModule())
      .add(new TraceTokenModule())
      .add(new EventModule())
      .add(new ProxyModule())
      .add(extraModules)
      .build());
  Logger log = Logger.get(PrestoProxy.class);
  try {
    app.strictConfig().initialize();
    log.info("======== SERVER STARTED ========");
  }
  catch (Throwable t) {
    log.error(t);
    System.exit(1);
  }
}

代码示例来源:origin: prestodb/presto

Bootstrap app = new Bootstrap(
    new MBeanModule(),
    new JsonModule(),

代码示例来源:origin: prestodb/presto

@Override
  public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
  {
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    try {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new ElasticsearchConnectorModule(),
          binder -> {
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            binder.bind(ElasticsearchTableDescriptionProvider.class).toInstance(tableDescriptionSupplier);
          });

      Injector injector = app.strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .initialize();

      return injector.getInstance(ElasticsearchConnector.class);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Override
  public ResourceGroupConfigurationManager<VariableMap> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context)
  {
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
      Bootstrap app = new Bootstrap(
          new JsonModule(),
          new H2ResourceGroupsModule(),
          new NodeModule(),
          binder -> binder.bind(ResourceGroupConfigurationManagerContext.class).toInstance(context),
          binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));

      Injector injector = app
          .strictConfig()
          .doNotInitializeLogging()
          .setRequiredConfigurationProperties(config)
          .quiet()
          .initialize();
      return injector.getInstance(DbResourceGroupConfigurationManager.class);
    }
    catch (Exception e) {
      throwIfUnchecked(e);
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: prestodb/presto

public ExampleHttpServer()
    throws Exception
{
  Bootstrap app = new Bootstrap(
      new TestingNodeModule(),
      new TestingHttpServerModule(),
      new ExampleHttpServerModule());
  Injector injector = app
      .strictConfig()
      .doNotInitializeLogging()
      .initialize();
  lifeCycleManager = injector.getInstance(LifeCycleManager.class);
  baseUri = injector.getInstance(TestingHttpServer.class).getBaseUrl();
}

代码示例来源:origin: prestodb/presto

server.refreshNodes();
Bootstrap app = new Bootstrap(
    new TestingNodeModule("test"),
    new TestingHttpServerModule(),

相关文章