@Inject public IndexLookup(Connector connector, ColumnCardinalityCache cardinalityCache) { this.connector = requireNonNull(connector, "connector is null"); this.cardinalityCache = requireNonNull(cardinalityCache, "cardinalityCache is null"); // Create a bounded executor with a pool size at 4x number of processors this.coreExecutor = newCachedThreadPool(daemonThreadsNamed("cardinality-lookup-%s")); this.executorService = new BoundedExecutor(coreExecutor, 4 * Runtime.getRuntime().availableProcessors()); }
@Inject public DiscoveryNodeManager( @ServiceType("presto") ServiceSelector serviceSelector, NodeInfo nodeInfo, FailureDetector failureDetector, NodeVersion expectedNodeVersion, @ForNodeManager HttpClient httpClient, InternalCommunicationConfig internalCommunicationConfig) { this.serviceSelector = requireNonNull(serviceSelector, "serviceSelector is null"); this.failureDetector = requireNonNull(failureDetector, "failureDetector is null"); this.expectedNodeVersion = requireNonNull(expectedNodeVersion, "expectedNodeVersion is null"); this.httpClient = requireNonNull(httpClient, "httpClient is null"); this.nodeStateUpdateExecutor = newSingleThreadScheduledExecutor(threadsNamed("node-state-poller-%s")); this.nodeStateEventExecutor = newCachedThreadPool(threadsNamed("node-state-events-%s")); this.httpsRequired = internalCommunicationConfig.isHttpsRequired(); this.currentNode = findCurrentNode( serviceSelector.selectAllServices(), requireNonNull(nodeInfo, "nodeInfo is null").getNodeId(), expectedNodeVersion, httpsRequired); refreshNodesInternal(); }
@Inject public SqlQueryManager( QueryPreparer queryPreparer, WarningCollectorFactory warningCollectorFactory) this.queryPreparer = requireNonNull(queryPreparer, "queryPreparer is null"); this.embedVersion = requireNonNull(embedVersion, "embedVersion is null"); this.executionFactories = requireNonNull(executionFactories, "executionFactories is null"); this.queryExecutor = newCachedThreadPool(threadsNamed("query-scheduler-%s")); this.queryExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) queryExecutor); this.warningCollectorFactory = requireNonNull(warningCollectorFactory, "warningCollectorFactory is null"); queryManagementExecutor = Executors.newScheduledThreadPool(queryManagerConfig.getQueryManagerExecutorPoolSize(), threadsNamed("query-management-%s")); queryManagementExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) queryManagementExecutor);
@Inject public FileSingleStreamSpillerFactory(BlockEncodingSerde blockEncodingSerde, SpillerStats spillerStats, FeaturesConfig featuresConfig) { this( listeningDecorator(newFixedThreadPool( requireNonNull(featuresConfig, "featuresConfig is null").getSpillerThreads(), daemonThreadsNamed("binary-spiller-%s"))), blockEncodingSerde, spillerStats, requireNonNull(featuresConfig, "featuresConfig is null").getSpillerSpillPaths(), requireNonNull(featuresConfig, "featuresConfig is null").getSpillMaxUsedSpaceThreshold()); }
@Inject public HivePageSinkProvider( Set<HiveFileWriterFactory> fileWriterFactories, OrcFileWriterFactory orcFileWriterFactory) this.fileWriterFactories = ImmutableSet.copyOf(requireNonNull(fileWriterFactories, "fileWriterFactories is null")); this.hdfsEnvironment = requireNonNull(hdfsEnvironment, "hdfsEnvironment is null"); this.pageSorter = requireNonNull(pageSorter, "pageSorter is null"); this.immutablePartitions = config.isImmutablePartitions(); this.locationService = requireNonNull(locationService, "locationService is null"); this.writeVerificationExecutor = listeningDecorator(newFixedThreadPool(config.getWriteValidationThreads(), daemonThreadsNamed("hive-write-validation-%s"))); this.partitionUpdateCodec = requireNonNull(partitionUpdateCodec, "partitionUpdateCodec is null"); this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
@Inject public SqlTaskManager( LocalExecutionPlanner planner, GcMonitor gcMonitor) requireNonNull(nodeInfo, "nodeInfo is null"); requireNonNull(config, "config is null"); infoCacheTime = config.getInfoMaxAge(); clientTimeout = config.getClientTimeout(); taskNotificationExecutor = newFixedThreadPool(config.getTaskNotificationThreads(), threadsNamed("task-notification-%s")); taskNotificationExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) taskNotificationExecutor); this.taskManagementExecutor = requireNonNull(taskManagementExecutor, "taskManagementExecutor cannot be null").getExecutor(); this.driverYieldExecutor = newScheduledThreadPool(config.getTaskYieldThreads(), threadsNamed("task-yield-%s"));
@Provides @Singleton @ForTransactionManager public static ExecutorService createTransactionFinishingExecutor() { return newCachedThreadPool(daemonThreadsNamed("transaction-finishing-%s")); }
@BeforeMethod public void setUp() { executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s")); scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s")); }
@Inject public AtopProcessFactory(AtopConnectorConfig config, AtopConnectorId connectorId) { this.executablePath = config.getExecutablePath(); this.timeZone = config.getTimeZoneId(); this.readTimeout = config.getReadTimeout(); this.executor = newFixedThreadPool(config.getConcurrentReadersPerNode(), daemonThreadsNamed("atop-" + connectorId + "executable-reader-%s")); }
@Inject public Announcer(DiscoveryAnnouncementClient announcementClient, Set<ServiceAnnouncement> serviceAnnouncements) { requireNonNull(announcementClient, "client is null"); requireNonNull(serviceAnnouncements, "serviceAnnouncements is null"); this.announcementClient = announcementClient; serviceAnnouncements.forEach(this::addServiceAnnouncement); executor = new ScheduledThreadPoolExecutor(5, daemonThreadsNamed("Announcer-%s")); executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) executor); }
@Provides @Singleton @ForMetadataRefresh public Executor createMetadataRefreshExecutor(ThriftConnectorConfig config) { return newFixedThreadPool(config.getMetadataRefreshThreads(), daemonThreadsNamed("metadata-refresh-%s")); } }
public RaptorSplitManager(RaptorConnectorId connectorId, NodeSupplier nodeSupplier, ShardManager shardManager, boolean backupAvailable) { this.connectorId = requireNonNull(connectorId, "connectorId is null").toString(); this.nodeSupplier = requireNonNull(nodeSupplier, "nodeSupplier is null"); this.shardManager = requireNonNull(shardManager, "shardManager is null"); this.backupAvailable = backupAvailable; this.executor = newCachedThreadPool(daemonThreadsNamed("raptor-split-" + connectorId + "-%s")); }
@VisibleForTesting public TaskExecutor( int runnerThreads, int minDrivers, int guaranteedNumberOfDriversPerTask, int maximumNumberOfDriversPerTask, EmbedVersion embedVersion, MultilevelSplitQueue splitQueue, Ticker ticker) { checkArgument(runnerThreads > 0, "runnerThreads must be at least 1"); checkArgument(guaranteedNumberOfDriversPerTask > 0, "guaranteedNumberOfDriversPerTask must be at least 1"); checkArgument(maximumNumberOfDriversPerTask > 0, "maximumNumberOfDriversPerTask must be at least 1"); checkArgument(guaranteedNumberOfDriversPerTask <= maximumNumberOfDriversPerTask, "guaranteedNumberOfDriversPerTask cannot be greater than maximumNumberOfDriversPerTask"); // we manage thread pool size directly, so create an unlimited pool this.executor = newCachedThreadPool(threadsNamed("task-processor-%s")); this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) executor); this.runnerThreads = runnerThreads; this.embedVersion = requireNonNull(embedVersion, "embedVersion is null"); this.ticker = requireNonNull(ticker, "ticker is null"); this.minimumNumberOfDrivers = minDrivers; this.guaranteedNumberOfDriversPerTask = guaranteedNumberOfDriversPerTask; this.maximumNumberOfDriversPerTask = maximumNumberOfDriversPerTask; this.waitingSplits = requireNonNull(splitQueue, "splitQueue is null"); this.tasks = new LinkedList<>(); }
@Provides @Singleton @ForAsyncHttp public static ScheduledExecutorService createAsyncHttpTimeoutExecutor(TaskManagerConfig config) { return newScheduledThreadPool(config.getHttpTimeoutThreads(), daemonThreadsNamed("async-http-timeout-%s")); }
@BeforeClass public void setUp() { executor = newCachedThreadPool(daemonThreadsNamed("test-executor-%s")); scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed("test-scheduledExecutor-%s")); }
public ClusterSizeMonitor( InternalNodeManager nodeManager, boolean includeCoordinator, int initializationMinCount, Duration initializationMaxWait, int executionMinCount, Duration executionMaxWait) { this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); this.includeCoordinator = includeCoordinator; checkArgument(initializationMinCount >= 0, "initializationMinCount is negative"); this.initializationMinCount = initializationMinCount; this.initializationMaxWait = requireNonNull(initializationMaxWait, "initializationMaxWait is null"); checkArgument(executionMinCount >= 0, "executionMinCount is negative"); this.executionMinCount = executionMinCount; this.executionMaxWait = requireNonNull(executionMaxWait, "executionMaxWait is null"); this.executor = newSingleThreadScheduledExecutor(threadsNamed("node-monitor-%s")); }
private LocalQueryRunner(Session defaultSession, FeaturesConfig featuresConfig, NodeSpillConfig nodeSpillConfig, boolean withInitialTransaction, boolean alwaysRevokeMemory, int nodeCountForStats) requireNonNull(defaultSession, "defaultSession is null"); checkArgument(!defaultSession.getTransactionId().isPresent() || !withInitialTransaction, "Already in transaction"); this.nodeSpillConfig = requireNonNull(nodeSpillConfig, "nodeSpillConfig is null"); this.alwaysRevokeMemory = alwaysRevokeMemory; this.notificationExecutor = newCachedThreadPool(daemonThreadsNamed("local-query-runner-executor-%s")); this.yieldExecutor = newScheduledThreadPool(2, daemonThreadsNamed("local-query-runner-scheduler-%s")); this.finalizerService = new FinalizerService(); finalizerService.start();
@Inject public DistributedStore( String name, LocalStore localStore, RemoteStore remoteStore, StoreConfig config, Supplier<DateTime> timeSupplier) { this.name = checkNotNull(name, "name is null"); this.localStore = checkNotNull(localStore, "localStore is null"); this.remoteStore = checkNotNull(remoteStore, "remoteStore is null"); this.timeSupplier = checkNotNull(timeSupplier, "timeSupplier is null"); checkNotNull(config, "config is null"); tombstoneMaxAge = config.getTombstoneMaxAge(); garbageCollectionInterval = config.getGarbageCollectionInterval(); garbageCollector = newSingleThreadScheduledExecutor(daemonThreadsNamed("distributed-store-gc-" + name)); }
@BeforeClass public void setUp() { scheduler = newScheduledThreadPool(4, daemonThreadsNamed("test-%s")); pageBufferClientCallbackExecutor = Executors.newSingleThreadExecutor(); }
@Provides @Singleton @ForTransactionManager public static ScheduledExecutorService createTransactionIdleCheckExecutor() { return newSingleThreadScheduledExecutor(daemonThreadsNamed("transaction-idle-check")); }