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 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)); } };
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 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 @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; }
private static ExecutorService defaultCompactionExecutor(LifeCycleRegistry lifeCycle) { String nameFormat = "DataStore Compaction-%d"; ExecutorService executor = new ThreadPoolExecutor( NUM_COMPACTION_THREADS, NUM_COMPACTION_THREADS, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(MAX_COMPACTION_QUEUE_LENGTH), new ThreadFactoryBuilder().setNameFormat(nameFormat).build(), new ThreadPoolExecutor.AbortPolicy()); lifeCycle.manage(new ExecutorServiceManager(executor, io.dropwizard.util.Duration.seconds(5), nameFormat)); return executor; }
@Inject public FanoutLagMonitor(LifeCycleRegistry lifeCycle, MetricRegistry metricRegistry) { _metricRegistry = checkNotNull(metricRegistry, "metricRegistry"); _gauges = new MetricsGroup(metricRegistry); _lagTable = HashBasedTable.create(); lifeCycle.manage(new ManagedGuavaService(this)); }
@Provides @Singleton @DedupEnabled ValueStore<Boolean> provideDedupEnabled(@DatabusZooKeeper CuratorFramework curator, LifeCycleRegistry lifeCycle) { return lifeCycle.manage( new ZkValueStore<>(curator, "/settings/dedup-enabled", new ZkBooleanSerializer(), true)); }
@Provides @Singleton @Maintenance MapStore<Double> provideRateLimiterSettings(@DataStoreZooKeeper CuratorFramework curator, LifeCycleRegistry lifeCycle) { return lifeCycle.manage(new ZkMapStore<>(curator, "background_table_maintenance-rate-limits", new ZkDoubleSerializer())); }
@Provides @Singleton @MinSplitSizeMap MapStore<DataStoreMinSplitSize> provideMinSplitSizeMap(@DataStoreZooKeeper CuratorFramework curator, LifeCycleRegistry lifeCycle) { return lifeCycle.manage(new ZkMapStore<>(curator, "min-split-size", new ZKDataStoreMinSplitSizeSerializer())); }
@Provides @Singleton @ReplicationEnabled ValueStore<Boolean> provideReplicationEnabled(@DatabusZooKeeper CuratorFramework curator, LifeCycleRegistry lifeCycle) { return lifeCycle.manage( new ZkValueStore<>(curator, "/settings/replication-enabled", new ZkBooleanSerializer(), true)); }
@Provides @Singleton @TableChangesEnabled ValueStore<Boolean> provideTableChangesEnabled(@DataStoreZooKeeper CuratorFramework curator, LifeCycleRegistry lifeCycle) { return lifeCycle.manage(new ZkValueStore<>(curator, "settings/table-changes-enabled", new ZkBooleanSerializer(), true)); }
@Inject public MinSplitSizeCleanupMonitor(@DataStoreZooKeeper CuratorFramework curator, @SelfHostAndPort HostAndPort selfHostAndPort, LeaderServiceTask leaderServiceTask, LifeCycleRegistry lifecycle, @MinSplitSizeMap MapStore<DataStoreMinSplitSize> minSplitSizeMap, Clock clock) { super(curator, LEADER_DIR, selfHostAndPort.toString(), SERVICE_NAME, 1, TimeUnit.MINUTES, () -> new MigratorCleanupService(minSplitSizeMap, clock)); leaderServiceTask.register(SERVICE_NAME, this); lifecycle.manage(new ManagedGuavaService(this)); }