• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LifeCycleManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.airlift.bootstrap.LifeCycleManager的典型用法代码示例。如果您正苦于以下问题:Java LifeCycleManager类的具体用法?Java LifeCycleManager怎么用?Java LifeCycleManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LifeCycleManager类属于io.airlift.bootstrap包,在下文中一共展示了LifeCycleManager类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ExampleHttpServer

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:ExampleHttpServer.java


示例2: RaptorConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public RaptorConnector(
        LifeCycleManager lifeCycleManager,
        RaptorMetadataFactory metadataFactory,
        RaptorSplitManager splitManager,
        RaptorPageSourceProvider pageSourceProvider,
        RaptorPageSinkProvider pageSinkProvider,
        RaptorSessionProperties sessionProperties,
        RaptorTableProperties tableProperties,
        Set<SystemTable> systemTables)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadataFactory = requireNonNull(metadataFactory, "metadataFactory is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.pageSourceProvider = requireNonNull(pageSourceProvider, "pageSourceProvider is null");
    this.pageSinkProvider = requireNonNull(pageSinkProvider, "pageSinkProvider is null");
    this.sessionProperties = requireNonNull(sessionProperties, "sessionProperties is null").getSessionProperties();
    this.tableProperties = requireNonNull(tableProperties, "tableProperties is null").getTableProperties();
    this.systemTables = requireNonNull(systemTables, "systemTables is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:RaptorConnector.java


示例3: createBackupStore

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Provides
@Singleton
private static Optional<BackupStore> createBackupStore(
        @Nullable BackupStore store,
        LifeCycleManager lifeCycleManager,
        RaptorConnectorId connectorId,
        BackupConfig config)
        throws Exception
{
    if (store == null) {
        return Optional.empty();
    }

    BackupStore proxy = new TimeoutBackupStore(store, connectorId.toString(), config.getTimeout());
    lifeCycleManager.addInstance(proxy);
    return Optional.of(proxy);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:BackupModule.java


示例4: HiveConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
public HiveConnector(
        LifeCycleManager lifeCycleManager,
        ConnectorMetadata metadata,
        ConnectorSplitManager splitManager,
        ConnectorPageSourceProvider pageSourceProvider,
        ConnectorPageSinkProvider pageSinkProvider,
        Set<SystemTable> systemTables,
        List<PropertyMetadata<?>> sessionProperties,
        List<PropertyMetadata<?>> tableProperties,
        ConnectorAccessControl accessControl)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.pageSourceProvider = requireNonNull(pageSourceProvider, "pageSourceProvider is null");
    this.pageSinkProvider = requireNonNull(pageSinkProvider, "pageSinkProvider is null");
    this.systemTables = ImmutableSet.copyOf(requireNonNull(systemTables, "systemTables is null"));
    this.sessionProperties = ImmutableList.copyOf(requireNonNull(sessionProperties, "sessionProperties is null"));
    this.tableProperties = ImmutableList.copyOf(requireNonNull(tableProperties, "tableProperties is null"));
    this.accessControl = requireNonNull(accessControl, "accessControl is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:HiveConnector.java


示例5: testAddressSelector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
private static void testAddressSelector(
        AddressSelectorBinder addressSelectorBinder,
        Map<String, String> configurationProperties,
        List<HostAndPort> expected)
        throws Exception
{
    Bootstrap app = new Bootstrap(
            new ThriftCodecModule(),
            binder -> addressSelectorBinder.bind(binder, THRIFT_SERVICE_ANNOTATION, "testService"));

    LifeCycleManager lifeCycleManager = null;
    try {
        Injector injector = app
                .setRequiredConfigurationProperties(configurationProperties)
                .strictConfig()
                .doNotInitializeLogging()
                .initialize();
        lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        AddressSelector<?> addressSelector = injector.getInstance(Key.get(AddressSelector.class, THRIFT_SERVICE_ANNOTATION));
        assertInstanceOf(addressSelector, SimpleAddressSelector.class);
        SimpleAddressSelector simpleAddressSelector = (SimpleAddressSelector) addressSelector;
        assertEquals(simpleAddressSelector.getAddresses(), expected);
    }
    finally {
        if (lifeCycleManager != null) {
            try {
                lifeCycleManager.stop();
            }
            catch (Exception ignored) {
            }
        }
    }
}
 
开发者ID:airlift,项目名称:drift,代码行数:35,代码来源:TestSimpleAddressSelectorBinder.java


示例6: HDFSConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
    public HDFSConnector(
            LifeCycleManager lifeCycleManager,
            HDFSMetadataFactory hdfsMetadataFactory,
            HDFSSplitManager hdfsSplitManager,
            HDFSPageSourceProvider hdfsPageSourceProvider)
    {
        this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
        this.hdfsMetadataFactory = requireNonNull(hdfsMetadataFactory, "hdfsMetadataFactory is null");
        this.hdfsSplitManager = requireNonNull(hdfsSplitManager, "hdfsSplitManager is null");
        this.hdfsPageSourceProvider = requireNonNull(hdfsPageSourceProvider, "hdfsPageSourceProvider is null");
//        this.nodePartitioningProvider = requireNonNull(nodePartitioningProvider, "nodePartitioningProvider is null");
    }
 
开发者ID:dbiir,项目名称:paraflow,代码行数:14,代码来源:HDFSConnector.java


示例7: EthereumConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public EthereumConnector(
        LifeCycleManager lifeCycleManager,
        EthereumMetadata metadata,
        EthereumSplitManager splitManager,
        EthereumRecordSetProvider recordSetProvider
) {
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:13,代码来源:EthereumConnector.java


示例8: AmpoolConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public AmpoolConnector(
        LifeCycleManager lifeCycleManager,
        AmpoolMetadata metadata,
        AmpoolSplitManager splitManager,
        AmpoolRecordSetProvider recordSetProvider)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
    log.info("INFORMATION: AmpoolConnector created.");
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:AmpoolConnector.java


示例9: KuduConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public KuduConnector(
        LifeCycleManager lifeCycleManager,
        KuduMetadata metadata,
        KuduSplitManager splitManager,
        KuduRecordSetProvider recordSetProvider)
{
    this.recordSetProvider = recordSetProvider;
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
}
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:13,代码来源:KuduConnector.java


示例10: KafkaConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public KafkaConnector(
        LifeCycleManager lifeCycleManager,
        KafkaMetadata metadata,
        KafkaSplitManager splitManager,
        KafkaRecordSetProvider recordSetProvider)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:KafkaConnector.java


示例11: ExampleConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public ExampleConnector(
        LifeCycleManager lifeCycleManager,
        ExampleMetadata metadata,
        ExampleSplitManager splitManager,
        ExampleRecordSetProvider recordSetProvider)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:ExampleConnector.java


示例12: TestingDiscoveryServer

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
public TestingDiscoveryServer(String environment)
        throws Exception
{
    tempDir = Files.createTempDir();

    Map<String, String> serverProperties = ImmutableMap.<String, String>builder()
            .put("static.db.location", tempDir.getAbsolutePath())
            .put("discovery.store-cache-ttl", "0ms")
            .build();

    Bootstrap app = new Bootstrap(
            new MBeanModule(),
            new TestingNodeModule(environment),
            new TestingHttpServerModule(),
            new JsonModule(),
            new JaxrsModule(true),
            new DiscoveryServerModule(),
            new DiscoveryModule(),
            new TestingJmxModule());

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

    lifeCycleManager = injector.getInstance(LifeCycleManager.class);

    server = injector.getInstance(TestingHttpServer.class);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:31,代码来源:TestingDiscoveryServer.java


示例13: JdbcConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public JdbcConnector(
        LifeCycleManager lifeCycleManager,
        JdbcMetadata jdbcMetadata,
        JdbcSplitManager jdbcSplitManager,
        JdbcRecordSetProvider jdbcRecordSetProvider,
        JdbcRecordSinkProvider jdbcRecordSinkProvider)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.jdbcMetadata = requireNonNull(jdbcMetadata, "jdbcMetadata is null");
    this.jdbcSplitManager = requireNonNull(jdbcSplitManager, "jdbcSplitManager is null");
    this.jdbcRecordSetProvider = requireNonNull(jdbcRecordSetProvider, "jdbcRecordSetProvider is null");
    this.jdbcRecordSinkProvider = requireNonNull(jdbcRecordSinkProvider, "jdbcRecordSinkProvider is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:15,代码来源:JdbcConnector.java


示例14: GracefulShutdownHandler

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public GracefulShutdownHandler(
        TaskManager sqlTaskManager,
        ServerConfig serverConfig,
        ShutdownAction shutdownAction,
        LifeCycleManager lifeCycleManager)
{
    this.sqlTaskManager = requireNonNull(sqlTaskManager, "sqlTaskManager is null");
    this.shutdownAction = requireNonNull(shutdownAction, "shutdownAction is null");
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.isCoordinator = requireNonNull(serverConfig, "serverConfig is null").isCoordinator();
    this.gracePeriod = serverConfig.getGracePeriod();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:14,代码来源:GracefulShutdownHandler.java


示例15: CassandraConnector

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Inject
public CassandraConnector(
        LifeCycleManager lifeCycleManager,
        CassandraMetadata metadata,
        CassandraSplitManager splitManager,
        CassandraRecordSetProvider recordSetProvider,
        CassandraConnectorRecordSinkProvider recordSinkProvider)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadata = requireNonNull(metadata, "metadata is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
    this.recordSinkProvider = requireNonNull(recordSinkProvider, "recordSinkProvider is null");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:15,代码来源:CassandraConnector.java


示例16: testGuiceClient

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Test
public void testGuiceClient()
        throws Exception
{
    TestingMethodInvocationStatsFactory statsFactory = new TestingMethodInvocationStatsFactory();
    ResultsSupplier resultsSupplier = new ResultsSupplier();
    MockMethodInvokerFactory<Annotation> invokerFactory = new MockMethodInvokerFactory<>(resultsSupplier);

    TestingExceptionClassifier globalClassifierOne = new TestingExceptionClassifier();
    TestingExceptionClassifier globalClassifierTwo = new TestingExceptionClassifier();
    TestingExceptionClassifier clientClassifier = new TestingExceptionClassifier();
    TestingExceptionClassifier customClientClassifier = new TestingExceptionClassifier();
    Bootstrap app = new Bootstrap(
            new ThriftCodecModule(),
            binder -> newSetBinder(binder, ExceptionClassifier.class).addBinding()
                    .toInstance(globalClassifierOne),
            binder -> newSetBinder(binder, ExceptionClassifier.class).addBinding()
                    .toInstance(globalClassifierTwo),
            binder -> binder.bind(new TypeLiteral<MethodInvokerFactory<Annotation>>() {})
                    .toInstance(invokerFactory),
            binder -> newOptionalBinder(binder, MethodInvocationStatsFactory.class)
                    .setBinding()
                    .toInstance(statsFactory),
            binder -> driftClientBinder(binder)
                    .bindDriftClient(Client.class)
                    .withAddressSelector(new MockAddressSelector())
                    .withExceptionClassifier(clientClassifier),
            binder -> driftClientBinder(binder)
                    .bindDriftClient(Client.class, CustomClient.class)
                    .withAddressSelector(new MockAddressSelector())
                    .withExceptionClassifier(customClientClassifier));

    LifeCycleManager lifeCycleManager = null;
    try {
        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .initialize();
        lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        DriftClient<Client> driftClient = injector.getInstance(DEFAULT_CLIENT_KEY);
        assertSame(injector.getInstance(DEFAULT_CLIENT_KEY), driftClient);
        Client client = driftClient.get(ADDRESS_SELECTION_CONTEXT, HEADERS);
        testClient(resultsSupplier,
                ImmutableList.of(invokerFactory.getMethodInvoker()),
                ImmutableList.of(globalClassifierOne, globalClassifierTwo, clientClassifier),
                statsFactory,
                client,
                Optional.empty());

        DriftClient<Client> customDriftClient = injector.getInstance(CUSTOM_CLIENT_KEY);
        assertSame(injector.getInstance(CUSTOM_CLIENT_KEY), customDriftClient);
        assertNotSame(driftClient, customDriftClient);
        Client customClient = customDriftClient.get(ADDRESS_SELECTION_CONTEXT, HEADERS);
        testClient(resultsSupplier,
                ImmutableList.of(invokerFactory.getMethodInvoker()),
                ImmutableList.of(globalClassifierOne, globalClassifierTwo, customClientClassifier),
                statsFactory,
                customClient,
                Optional.of(CustomClient.class.getSimpleName()));
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
    finally {
        if (lifeCycleManager != null) {
            try {
                lifeCycleManager.stop();
            }
            catch (Exception ignored) {
            }
        }
    }
}
 
开发者ID:airlift,项目名称:drift,代码行数:75,代码来源:TestDriftClient.java


示例17: testGuiceClientFilter

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Test
public void testGuiceClientFilter()
        throws Exception
{
    TestingMethodInvocationStatsFactory statsFactory = new TestingMethodInvocationStatsFactory();
    ResultsSupplier resultsSupplier = new ResultsSupplier();
    PassThroughFilter passThroughFilter = new PassThroughFilter();
    ShortCircuitFilter shortCircuitFilter = new ShortCircuitFilter(resultsSupplier);
    MockMethodInvokerFactory<Annotation> invokerFactory = new MockMethodInvokerFactory<>(resultsSupplier);

    TestingExceptionClassifier globalClassifierOne = new TestingExceptionClassifier();
    TestingExceptionClassifier globalClassifierTwo = new TestingExceptionClassifier();
    TestingExceptionClassifier clientClassifier = new TestingExceptionClassifier();
    TestingExceptionClassifier customClientClassifier = new TestingExceptionClassifier();
    Bootstrap app = new Bootstrap(
            new ThriftCodecModule(),
            binder -> newSetBinder(binder, ExceptionClassifier.class).addBinding()
                    .toInstance(globalClassifierOne),
            binder -> newSetBinder(binder, ExceptionClassifier.class).addBinding()
                    .toInstance(globalClassifierTwo),
            binder -> binder.bind(new TypeLiteral<MethodInvokerFactory<Annotation>>() {})
                    .toInstance(invokerFactory),
            binder -> newOptionalBinder(binder, MethodInvocationStatsFactory.class)
                    .setBinding()
                    .toInstance(statsFactory),
            binder -> driftClientBinder(binder)
                    .bindDriftClient(Client.class)
                    .withAddressSelector(new MockAddressSelector())
                    .withMethodInvocationFilter(staticFilterBinder(passThroughFilter, shortCircuitFilter))
                    .withExceptionClassifier(clientClassifier),
            binder -> driftClientBinder(binder)
                    .bindDriftClient(Client.class, CustomClient.class)
                    .withAddressSelector(new MockAddressSelector())
                    .withMethodInvocationFilter(staticFilterBinder(passThroughFilter, shortCircuitFilter))
                    .withExceptionClassifier(customClientClassifier));

    LifeCycleManager lifeCycleManager = null;
    try {
        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .initialize();
        lifeCycleManager = injector.getInstance(LifeCycleManager.class);

        DriftClient<Client> driftClient = injector.getInstance(DEFAULT_CLIENT_KEY);
        assertSame(injector.getInstance(DEFAULT_CLIENT_KEY), driftClient);
        Client client = driftClient.get(ADDRESS_SELECTION_CONTEXT, HEADERS);
        testClient(resultsSupplier,
                ImmutableList.of(passThroughFilter, shortCircuitFilter),
                ImmutableList.of(globalClassifierOne, globalClassifierTwo, clientClassifier),
                statsFactory,
                client,
                Optional.empty());

        DriftClient<Client> customDriftClient = injector.getInstance(CUSTOM_CLIENT_KEY);
        assertSame(injector.getInstance(CUSTOM_CLIENT_KEY), customDriftClient);
        assertNotSame(driftClient, customDriftClient);
        Client customClient = customDriftClient.get(ADDRESS_SELECTION_CONTEXT, HEADERS);
        testClient(resultsSupplier,
                ImmutableList.of(passThroughFilter, shortCircuitFilter),
                ImmutableList.of(globalClassifierOne, globalClassifierTwo, customClientClassifier),
                statsFactory,
                customClient,
                Optional.of(CustomClient.class.getSimpleName()));
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
    finally {
        if (lifeCycleManager != null) {
            try {
                lifeCycleManager.stop();
            }
            catch (Exception ignored) {
            }
        }
    }
}
 
开发者ID:airlift,项目名称:drift,代码行数:79,代码来源:TestDriftClient.java


示例18: run

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
public int run(String[] args)
        throws Exception
{
    if (args.length > 0) {
        System.setProperty("config", args[0]);
    }

    ImmutableList.Builder<Module> builder = ImmutableList.<Module>builder()
            .add(new PrestoVerifierModule())
            .addAll(getAdditionalModules());

    Bootstrap app = new Bootstrap(builder.build());
    Injector injector = app.strictConfig().initialize();

    try {
        VerifierConfig config = injector.getInstance(VerifierConfig.class);
        injector.injectMembers(this);
        Set<String> supportedEventClients = injector.getInstance(Key.get(new TypeLiteral<Set<String>>() {}, Names.named(SUPPORTED_EVENT_CLIENTS)));
        for (String clientType : config.getEventClients()) {
            checkArgument(supportedEventClients.contains(clientType), "Unsupported event client: %s", clientType);
        }
        Set<EventClient> eventClients = injector.getInstance(Key.get(new TypeLiteral<Set<EventClient>>() {}));

        VerifierDao dao = new DBI(config.getQueryDatabase()).onDemand(VerifierDao.class);

        ImmutableList.Builder<QueryPair> queriesBuilder = ImmutableList.builder();
        for (String suite : config.getSuites()) {
            queriesBuilder.addAll(dao.getQueriesBySuite(suite, config.getMaxQueries()));
        }

        List<QueryPair> queries = queriesBuilder.build();
        queries = applyOverrides(config, queries);
        queries = filterQueries(queries);

        // Load jdbc drivers if needed
        if (config.getAdditionalJdbcDriverPath() != null) {
            List<URL> urlList = getUrls(config.getAdditionalJdbcDriverPath());
            URL[] urls = new URL[urlList.size()];
            urlList.toArray(urls);
            if (config.getTestJdbcDriverName() != null) {
                loadJdbcDriver(urls, config.getTestJdbcDriverName());
            }
            if (config.getControlJdbcDriverName() != null) {
                loadJdbcDriver(urls, config.getControlJdbcDriverName());
            }
        }

        // TODO: construct this with Guice
        Verifier verifier = new Verifier(System.out, config, eventClients);
        return verifier.run(queries);
    }
    finally {
        injector.getInstance(LifeCycleManager.class).stop();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:56,代码来源:PrestoVerifier.java


示例19: create

import io.airlift.bootstrap.LifeCycleManager; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
    requireNonNull(config, "config is null");

    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(
                new NodeModule(),
                new MBeanModule(),
                new JsonModule(),
                new HiveClientModule(connectorId, metastore, typeManager, pageIndexerFactory),
                installModuleIf(
                        SecurityConfig.class,
                        security -> ALLOW_ALL_ACCESS_CONTROL.equalsIgnoreCase(security.getSecuritySystem()),
                        new NoSecurityModule()),
                installModuleIf(
                        SecurityConfig.class,
                        security -> "read-only".equalsIgnoreCase(security.getSecuritySystem()),
                        new ReadOnlySecurityModule()),
                installModuleIf(
                        SecurityConfig.class,
                        security -> "sql-standard".equalsIgnoreCase(security.getSecuritySystem()),
                        new SqlStandardSecurityModule()),
                binder -> {
                    MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
                    binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
                }
        );

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

        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        ConnectorMetadata metadata = injector.getInstance(ConnectorMetadata.class);
        ConnectorSplitManager splitManager = injector.getInstance(ConnectorSplitManager.class);
        ConnectorPageSourceProvider connectorPageSource = injector.getInstance(ConnectorPageSourceProvider.class);
        ConnectorPageSinkProvider pageSinkProvider = injector.getInstance(ConnectorPageSinkProvider.class);
        HiveSessionProperties hiveSessionProperties = injector.getInstance(HiveSessionProperties.class);
        HiveTableProperties hiveTableProperties = injector.getInstance(HiveTableProperties.class);
        ConnectorAccessControl accessControl = injector.getInstance(ConnectorAccessControl.class);

        return new HiveConnector(
                lifeCycleManager,
                new ClassLoaderSafeConnectorMetadata(metadata, classLoader),
                new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader),
                new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader),
                new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader),
                ImmutableSet.of(),
                hiveSessionProperties.getSessionProperties(),
                hiveTableProperties.getTableProperties(),
                accessControl);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:61,代码来源:HiveConnectorFactory.java



注:本文中的io.airlift.bootstrap.LifeCycleManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StarGraphTest类代码示例发布时间:2022-05-22
下一篇:
Java SMTestLocator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap