AbstractSchedulerSubscriberService(String name, String topic, int fetchSize, boolean transactionalFetch) { super(name, cConf, topic, transactionalFetch, fetchSize, cConf.getLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS), messagingService, datasetFramework, txClient, metricsCollectionService); }
public AbstractDistributedMasterServiceManager(CConfiguration cConf, String serviceName, TwillRunnerService twillRunnerService, DiscoveryServiceClient discoveryServiceClient) { this.cConf = cConf; this.serviceName = serviceName; this.twillRunnerService = twillRunnerService; this.discoveryTimeout = cConf.getLong(Constants.Monitor.DISCOVERY_TIMEOUT_SECONDS); this.discoveryServiceClient = discoveryServiceClient; }
public AbstractDistributedMasterServiceManager(CConfiguration cConf, String serviceName, TwillRunnerService twillRunnerService, DiscoveryServiceClient discoveryServiceClient) { this.cConf = cConf; this.serviceName = serviceName; this.twillRunnerService = twillRunnerService; this.discoveryTimeout = cConf.getLong(Constants.Monitor.DISCOVERY_TIMEOUT_SECONDS); this.discoveryServiceClient = discoveryServiceClient; }
AbstractSchedulerSubscriberService(String name, String topic, int fetchSize, boolean transactionalFetch) { super(name, cConf, topic, transactionalFetch, fetchSize, cConf.getLong(Constants.Scheduler.EVENT_POLL_DELAY_MILLIS), messagingService, datasetFramework, txClient, metricsCollectionService); }
/** * Create a new GrantAccessToken object to generate tokens for authorized users. */ @Inject public GrantAccessToken(TokenManager tokenManager, Codec<AccessToken> tokenCodec, CConfiguration cConf) { this.tokenManager = tokenManager; this.tokenCodec = tokenCodec; this.tokenExpiration = cConf.getLong(Constants.Security.TOKEN_EXPIRATION); this.extendedTokenExpiration = cConf.getLong(Constants.Security.EXTENDED_TOKEN_EXPIRATION); }
@VisibleForTesting CachingMessageTable(CConfiguration cConf, MessageTable messageTable, MessageTableCacheProvider cacheProvider, TimeProvider timeProvider) { // Half the tx pruning grace period to be the grace period for scanning the message cache. // This is to make sure we won't scan for cached entries that might be pruned. this.gracePeriod = cConf.getLong(PRUNE_GRACE_PERIOD) / 2; this.messageTable = messageTable; this.cacheProvider = cacheProvider; this.timeProvider = timeProvider; }
@VisibleForTesting CachingMessageTable(CConfiguration cConf, MessageTable messageTable, MessageTableCacheProvider cacheProvider, TimeProvider timeProvider) { // Half the tx pruning grace period to be the grace period for scanning the message cache. // This is to make sure we won't scan for cached entries that might be pruned. this.gracePeriod = cConf.getLong(PRUNE_GRACE_PERIOD) / 2; this.messageTable = messageTable; this.cacheProvider = cacheProvider; this.timeProvider = timeProvider; }
private long computeInterval(@Nullable Long givenInterval, CConfiguration cConf) { if (givenInterval != null) { return givenInterval; } long configuredInterval = cConf.getLong(Constants.AppFabric.PROGRAM_RUNID_CORRECTOR_INTERVAL_SECONDS); if (configuredInterval <= 0) { LOG.debug("Invalid run id corrector interval {}. Setting it to 180 seconds.", configuredInterval); configuredInterval = 180L; } return configuredInterval; }
private long computeInterval(@Nullable Long givenInterval, CConfiguration cConf) { if (givenInterval != null) { return givenInterval; } long configuredInterval = cConf.getLong(Constants.AppFabric.PROGRAM_RUNID_CORRECTOR_INTERVAL_SECONDS); if (configuredInterval <= 0) { LOG.debug("Invalid run id corrector interval {}. Setting it to 180 seconds.", configuredInterval); configuredInterval = 180L; } return configuredInterval; }
private LoadingCache<UGICacheKey, UGIWithPrincipal> createUGICache(CConfiguration cConf) { long expirationMillis = cConf.getLong(Constants.Security.UGI_CACHE_EXPIRATION_MS); return CacheBuilder.newBuilder() .expireAfterWrite(expirationMillis, TimeUnit.MILLISECONDS) .build(new CacheLoader<UGICacheKey, UGIWithPrincipal>() { @Override public UGIWithPrincipal load(UGICacheKey key) throws Exception { return createUGI(key.getRequest()); } }); }
@Inject OperationalStatsService(CConfiguration cConf, Injector injector) { this.operationalStatsLoader = new OperationalStatsLoader(cConf); this.statsRefreshInterval = cConf.getLong(Constants.OperationalStats.REFRESH_INTERVAL_SECS); this.injector = injector; }
/** * Creates the {@link EventHandler} for handling the application events. */ @Nullable private EventHandler createEventHandler(CConfiguration cConf, ProgramRunId programRunId) { if (clusterMode != ClusterMode.ON_PREMISE) { return null; } return new TwillAppLifecycleEventHandler(cConf.getLong(Constants.CFG_TWILL_NO_CONTAINER_TIMEOUT, Long.MAX_VALUE), this instanceof LongRunningDistributedProgramRunner, programRunId); }
/** * Creates the {@link EventHandler} for handling the application events. */ @Nullable private EventHandler createEventHandler(CConfiguration cConf, ProgramRunId programRunId) { if (clusterMode != ClusterMode.ON_PREMISE) { return null; } return new TwillAppLifecycleEventHandler(cConf.getLong(Constants.CFG_TWILL_NO_CONTAINER_TIMEOUT, Long.MAX_VALUE), this instanceof LongRunningDistributedProgramRunner, programRunId); }
@Inject OperationalStatsService(CConfiguration cConf, Injector injector) { this.operationalStatsLoader = new OperationalStatsLoader(cConf); this.statsRefreshInterval = cConf.getLong(Constants.OperationalStats.REFRESH_INTERVAL_SECS); this.injector = injector; }
RunRecordCorrectorService(CConfiguration cConf, Store store, ProgramStateWriter programStateWriter, ProgramRuntimeService runtimeService, NamespaceAdmin namespaceAdmin, DatasetFramework datasetFramework) { this(cConf, store, programStateWriter, runtimeService, namespaceAdmin, datasetFramework, 2L * cConf.getLong(Constants.AppFabric.PROGRAM_MAX_START_SECONDS), cConf.getInt(Constants.AppFabric.PROGRAM_RUNID_CORRECTOR_TX_BATCH_SIZE)); }
@Override public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler schedSignaler) { super.initialize(loadHelper, schedSignaler); try { // See CDAP-7116 setMisfireThreshold(cConf.getLong(Constants.Scheduler.CFG_SCHEDULER_MISFIRE_THRESHOLD_MS)); initializeScheduleTable(); readSchedulesFromPersistentStore(); } catch (Throwable th) { throw Throwables.propagate(th); } }
/** * For guice injecting configuration object to this singleton. */ @Inject public void setConfiguration(CConfiguration config) { basePath = config.get(Constants.CFG_DATA_LEVELDB_DIR); Preconditions.checkNotNull(basePath, "No base directory configured for LevelDB."); blockSize = config.getInt(Constants.CFG_DATA_LEVELDB_BLOCKSIZE, Constants.DEFAULT_DATA_LEVELDB_BLOCKSIZE); cacheSize = config.getLong(Constants.CFG_DATA_LEVELDB_CACHESIZE, Constants.DEFAULT_DATA_LEVELDB_CACHESIZE); writeOptions = new WriteOptions().sync( config.getBoolean(Constants.CFG_DATA_LEVELDB_FSYNC, Constants.DEFAULT_DATA_LEVELDB_FSYNC)); }
@Inject DefaultAuditPublisher(CConfiguration cConf, MessagingService messagingService) { this.messagingService = messagingService; this.auditTopic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Audit.TOPIC)); this.retryStrategy = RetryStrategies.timeLimit( cConf.getLong(Constants.Audit.PUBLISH_TIMEOUT_MS), TimeUnit.MILLISECONDS, RetryStrategies.exponentialDelay(10, 200, TimeUnit.MILLISECONDS)); }
/** * For guice injecting configuration object to this singleton. */ @Inject public void setConfiguration(CConfiguration config) { basePath = config.get(Constants.CFG_DATA_LEVELDB_DIR); Preconditions.checkNotNull(basePath, "No base directory configured for LevelDB."); blockSize = config.getInt(Constants.CFG_DATA_LEVELDB_BLOCKSIZE, Constants.DEFAULT_DATA_LEVELDB_BLOCKSIZE); cacheSize = config.getLong(Constants.CFG_DATA_LEVELDB_CACHESIZE, Constants.DEFAULT_DATA_LEVELDB_CACHESIZE); writeOptions = new WriteOptions().sync( config.getBoolean(Constants.CFG_DATA_LEVELDB_FSYNC, Constants.DEFAULT_DATA_LEVELDB_FSYNC)); }
public ProgramStateWriterWithHeartBeat(ProgramRunId programRunId, ProgramStateWriter programStateWriter, MessagingService messagingService, CConfiguration cConf) { this(programRunId, programStateWriter, cConf.getLong(Constants.ProgramHeartbeat.HEARTBEAT_INTERVAL_SECONDS), new MessagingProgramStatePublisher(messagingService, NamespaceId.SYSTEM.topic(cConf.get( Constants.AppFabric.PROGRAM_STATUS_EVENT_TOPIC)), RetryStrategies.fromConfiguration(cConf, "system.program.state."))); }