public CassandraKeyspace(LifeCycleRegistry lifeCycle, String keyspaceName, CassandraCluster<Keyspace> astyanaxCluster, CassandraCluster<Session> cqlCluster) { _keyspaceName = keyspaceName; _astyanaxCluster = astyanaxCluster; _cqlCluster = cqlCluster; lifeCycle.manage(this); }
@Inject public DefaultCacheRegistry(LifeCycleRegistry lifeCycle, MetricRegistry metricRegistry) { lifeCycle.manage(this); _metricRegistry = metricRegistry; }
@Inject public VerifyRandomPartitioner(LifeCycleRegistry lifeCycle, CassandraKeyspace keyspace) { _keyspace = keyspace; lifeCycle.manage(this); }
@Inject public GracefulShutdownManager(AuditFlusher auditFlusher, DataWriteCloser dataWriteCloser, LifeCycleRegistry lifeCycleRegistry) { _dataWriteCloser = dataWriteCloser; _auditFlusher = auditFlusher; requireNonNull(lifeCycleRegistry).manage(this); }
@Inject public GracefulShutdownManager(AuditFlusher auditFlusher, DataWriteCloser dataWriteCloser, LifeCycleRegistry lifeCycleRegistry) { _dataWriteCloser = dataWriteCloser; _auditFlusher = auditFlusher; requireNonNull(lifeCycleRegistry).manage(this); }
@Inject public MasterFanout(LifeCycleRegistry lifeCycle, final FanoutManager fanoutManager) { lifeCycle.manage(fanoutManager.newMasterFanout()); } }
@Override public <T extends Service> OwnerGroup<T> create(String group, OstrichOwnerFactory<T> factory, @Nullable Duration expireWhenInactive) { return lifeCycle.manage( new OstrichOwnerGroup<>(group, factory, expireWhenInactive, curator, hostDiscovery, self, dropwizardTask, _metricRegistry)); } };
@Inject public CloudWatchScanCountListener(AmazonCloudWatch cloudWatch, List<Dimension> dimensions, LifeCycleRegistry lifecycle) { _cloudWatch = cloudWatch; _dimensions = dimensions; lifecycle.manage(new ManagedGuavaService(this)); }
@Inject public DistributedMigratorRangeMonitor(ScanWorkflow workflow, MigratorStatusDAO statusDAO, LocalRangeMigrator rangeMigrator, @MaxConcurrentScans int maxConcurrentMigrations, LifeCycleRegistry lifecycle) { _workflow = checkNotNull(workflow, "workflow"); _statusDAO = checkNotNull(statusDAO, "statusDAO"); _rangeMigrator = rangeMigrator; _maxConcurrentMigrations = maxConcurrentMigrations; lifecycle.manage(this); }
@Inject public DistributedScanRangeMonitor(ScanWorkflow scanWorkflow, ScanStatusDAO scanStatusDAO, RangeScanUploader rangeScanUploader, @MaxConcurrentScans int maxConcurrentScans, LifeCycleRegistry lifecycle) { _scanWorkflow = checkNotNull(scanWorkflow, "scanWorkflow"); _scanStatusDAO = checkNotNull(scanStatusDAO, "scanStatusDAO"); _rangeScanUploader = checkNotNull(rangeScanUploader, "rangeScanUploader"); checkArgument(maxConcurrentScans > 0, "maxConcurrentScans <= 0"); _maxConcurrentScans = maxConcurrentScans; lifecycle.manage(this); }
private static ScheduledExecutorService defaultScheduledExecutor(LifeCycleRegistry lifeCycle, String metricsGroup) { String nameFormat = "Events Claim Cleanup-" + metricsGroup.substring(metricsGroup.lastIndexOf('.') + 1) + "-%d"; ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat(nameFormat).setDaemon(true).build()); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ScheduledExecutorService defaultExecutor(LifeCycleRegistry lifeCycle, String metricsGroup) { String nameFormat = "Events Slab Allocator Cleanup-" + metricsGroup.substring(metricsGroup.lastIndexOf('.') + 1) + "-%d"; ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(nameFormat).setDaemon(true).build(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, threadFactory); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ScheduledExecutorService defaultScheduledExecutor(LifeCycleRegistry lifeCycle, String nameFormat) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat(nameFormat).setDaemon(true).build()); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ScheduledExecutorService defaultExecutor(LifeCycleRegistry lifeCycle) { String nameFormat = "RateLimitedLog-%d"; ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(nameFormat).setDaemon(true).build(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, threadFactory); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ScheduledExecutorService defaultExecutor(LifeCycleRegistry lifeCycle) { String nameFormat = "RateLimitedLog-%d"; ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(nameFormat).setDaemon(true).build(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, threadFactory); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ExecutorService defaultInvalidationExecutor(LifeCycleRegistry lifeCycle) { String nameFormat = "CacheMgr Invalidation-%d"; ExecutorService executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat(nameFormat).build()); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
private static ExecutorService defaultInvalidationExecutor(LifeCycleRegistry lifeCycle) { String nameFormat = "CacheMgr Invalidation-%d"; ExecutorService executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat(nameFormat).build()); lifeCycle.manage(new ExecutorServiceManager(executor, Duration.seconds(5), nameFormat)); return executor; }
@Provides @Singleton @CachingSubscriptionDAOExecutorService ListeningExecutorService provideCachingSubscriptionDAOExecutorService(LifeCycleRegistry lifeCycleRegistry) { ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool( 1, new ThreadFactoryBuilder().setNameFormat("subscription-cache-%d").build())); lifeCycleRegistry.manage(new ExecutorServiceManager(service, Duration.seconds(1), "subscription-cache")); return service; }
@Provides @Singleton @CachingSubscriptionDAOExecutorService ListeningExecutorService provideCachingSubscriptionDAOExecutorService(LifeCycleRegistry lifeCycleRegistry) { ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool( 1, new ThreadFactoryBuilder().setNameFormat("subscription-cache-%d").build())); lifeCycleRegistry.manage(new ExecutorServiceManager(service, Duration.seconds(1), "subscription-cache")); return service; }
@Provides @Singleton @QueueDrainExecutorService ExecutorService provideQueueDrainService (LifeCycleRegistry lifeCycleRegistry) { ExecutorService queueDrainService = Executors.newFixedThreadPool(MAX_THREADS_FOR_QUEUE_DRAINING, new ThreadFactoryBuilder().setNameFormat("drainQueue-%d").build()); lifeCycleRegistry.manage(new ExecutorServiceManager(queueDrainService, Duration.seconds(1), "drainQueue-cache")); return queueDrainService; }