当前位置: 首页>>代码示例>>Java>>正文


Java Environment.managedExecutorService方法代码示例

本文整理汇总了Java中com.yammer.dropwizard.config.Environment.managedExecutorService方法的典型用法代码示例。如果您正苦于以下问题:Java Environment.managedExecutorService方法的具体用法?Java Environment.managedExecutorService怎么用?Java Environment.managedExecutorService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.yammer.dropwizard.config.Environment的用法示例。


在下文中一共展示了Environment.managedExecutorService方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.yammer.dropwizard.config.Environment; //导入方法依赖的package包/类
@Override
public void run(FoxtrotServerConfiguration configuration, Environment environment) throws Exception {
    configuration.getHttpConfiguration().setRootPath("/foxtrot/*");
    configureObjectMapper(environment);

    ObjectMapper objectMapper = environment.getObjectMapperFactory().build();
    ExecutorService executorService = environment.managedExecutorService("query-executor-%s", 20, 40, 30, TimeUnit.SECONDS);

    HbaseTableConnection HBaseTableConnection = new HbaseTableConnection(configuration.getHbase());
    ElasticsearchConnection elasticsearchConnection = new ElasticsearchConnection(configuration.getElasticsearch());
    HazelcastConnection hazelcastConnection = new HazelcastConnection(configuration.getCluster());
    ElasticsearchUtils.setTableNamePrefix(configuration.getElasticsearch());

    TableMetadataManager tableMetadataManager = new DistributedTableMetadataManager(hazelcastConnection, elasticsearchConnection);
    DataStore dataStore = new HBaseDataStore(HBaseTableConnection,
            objectMapper, new DocumentTranslator(configuration.getHbase()));
    QueryStore queryStore = new ElasticsearchQueryStore(tableMetadataManager, elasticsearchConnection, dataStore, objectMapper);
    FoxtrotTableManager tableManager = new FoxtrotTableManager(tableMetadataManager, queryStore, dataStore);
    CacheManager cacheManager = new CacheManager(new DistributedCacheFactory(hazelcastConnection, objectMapper));
    AnalyticsLoader analyticsLoader = new AnalyticsLoader(tableMetadataManager, dataStore, queryStore, elasticsearchConnection, cacheManager, objectMapper);
    QueryExecutor executor = new QueryExecutor(analyticsLoader, executorService);
    DataDeletionManagerConfig dataDeletionManagerConfig = configuration.getTableDataManagerConfig();
    DataDeletionManager dataDeletionManager = new DataDeletionManager(dataDeletionManagerConfig, queryStore);

    List<HealthCheck> healthChecks = new ArrayList<>();
    healthChecks.add(new ElasticSearchHealthCheck("ES Health Check", elasticsearchConnection));
    ClusterManager clusterManager = new ClusterManager(hazelcastConnection, healthChecks, configuration.getHttpConfiguration());

    environment.manage(HBaseTableConnection);
    environment.manage(elasticsearchConnection);
    environment.manage(hazelcastConnection);
    environment.manage(tableMetadataManager);
    environment.manage(analyticsLoader);
    environment.manage(dataDeletionManager);
    environment.manage(clusterManager);

    environment.addResource(new DocumentResource(queryStore));
    environment.addResource(new AsyncResource(cacheManager));
    environment.addResource(new AnalyticsResource(executor));
    environment.addResource(new TableManagerResource(tableManager));
    environment.addResource(new TableFieldMappingResource(queryStore));
    environment.addResource(new ConsoleResource(
            new ElasticsearchConsolePersistence(elasticsearchConnection, objectMapper)));
    FqlEngine fqlEngine = new FqlEngine(tableMetadataManager, queryStore, executor, objectMapper);
    environment.addResource(new FqlResource(fqlEngine));
    environment.addResource(new ClusterInfoResource(clusterManager));
    environment.addResource(new UtilResource(configuration));
    environment.addResource(new ClusterHealthResource(queryStore));
    healthChecks.forEach(environment::addHealthCheck);

    environment.addProvider(new FoxtrotExceptionMapper());
    environment.addProvider(new FlatResponseTextProvider());
    environment.addProvider(new FlatResponseCsvProvider());
    environment.addProvider(new FlatResponseErrorTextProvider());

    environment.addFilter(CrossOriginFilter.class, "/*");
}
 
开发者ID:Flipkart,项目名称:foxtrot,代码行数:58,代码来源:FoxtrotServer.java


注:本文中的com.yammer.dropwizard.config.Environment.managedExecutorService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。