@Override public void run() { while (!this.shutdown) { synchronized (this) { try { // Cleanup old stuff. final long currentTime = System.currentTimeMillis(); if (currentTime - CLEANER_THREAD_WAIT_INTERVAL_MS > this.lastLogCleanTime) { cleanExecutionLogs(); this.lastLogCleanTime = currentTime; } wait(CLEANER_THREAD_WAIT_INTERVAL_MS); } catch (final InterruptedException e) { ExecutorManager.logger.info("Interrupted. Probably to shut down."); } } } }
@Inject public ExecutorManager(final Props azkProps, final ExecutorLoader loader, final AlerterHolder alerterHolder, final CommonMetrics commonMetrics, final ExecutorApiGateway apiGateway) throws ExecutorManagerException { this.alerterHolder = alerterHolder; this.azkProps = azkProps; this.commonMetrics = commonMetrics; this.executorLoader = loader; this.apiGateway = apiGateway; this.setupExecutors(); this.loadRunningFlows(); this.queuedFlows = new QueuedExecutions( azkProps.getLong(Constants.ConfigurationKeys.WEBSERVER_QUEUE_SIZE, 100000)); // The default threshold is set to 30 for now, in case some users are affected. We may // decrease this number in future, to better prevent DDos attacks. this.maxConcurrentRunsOneFlow = azkProps .getInt(Constants.ConfigurationKeys.MAX_CONCURRENT_RUNS_ONEFLOW, DEFAULT_MAX_ONCURRENT_RUNS_ONEFLOW); this.loadQueuedFlows(); this.cacheDir = new File(azkProps.getString("cache.directory", "cache")); this.executingManager = new ExecutingManagerUpdaterThread(); if (isMultiExecutorMode()) { setupMultiExecutorMode(); } final long executionLogsRetentionMs = azkProps.getLong("execution.logs.retention.ms", DEFAULT_EXECUTION_LOGS_RETENTION_MS); this.cleanerThread = new CleanerThread(executionLogsRetentionMs); }
@Override public void run() { while (!this.shutdown) { synchronized (this) { try { ExecutorManager.this.lastCleanerThreadCheckTime = System.currentTimeMillis(); // Cleanup old stuff. final long currentTime = System.currentTimeMillis(); if (currentTime - CLEANER_THREAD_WAIT_INTERVAL_MS > this.lastLogCleanTime) { cleanExecutionLogs(); this.lastLogCleanTime = currentTime; } wait(CLEANER_THREAD_WAIT_INTERVAL_MS); } catch (final InterruptedException e) { logger.info("Interrupted. Probably to shut down."); } } } }
public void run() { while (!shutdown) { synchronized (this) { try { lastCleanerThreadCheckTime = System.currentTimeMillis(); // Cleanup old stuff. long currentTime = System.currentTimeMillis(); if (currentTime - CLEANER_THREAD_WAIT_INTERVAL_MS > lastLogCleanTime) { cleanExecutionLogs(); lastLogCleanTime = currentTime; } wait(CLEANER_THREAD_WAIT_INTERVAL_MS); } catch (InterruptedException e) { logger.info("Interrupted. Probably to shut down."); } } } }
public CleanerThread(final long executionLogsRetentionMs) { this.executionLogsRetentionMs = executionLogsRetentionMs; this.setName("AzkabanWebServer-Cleaner-Thread"); }
public ExecutorManager(Props props, ExecutorLoader loader, Map<String, Alerter> alters) throws ExecutorManagerException { this.executorLoader = loader; this.loadRunningFlows(); executorHost = props.getString("executor.host", "localhost"); executorPort = props.getInt("executor.port"); alerters = alters; cacheDir = new File(props.getString("cache.directory", "cache")); executingManager = new ExecutingManagerUpdaterThread(); executingManager.start(); long executionLogsRetentionMs = props.getLong("execution.logs.retention.ms", DEFAULT_EXECUTION_LOGS_RETENTION_MS); cleanerThread = new CleanerThread(executionLogsRetentionMs); cleanerThread.start(); }
public void start() { this.executingManager.start(); this.cleanerThread.start(); if (isMultiExecutorMode()) { this.queueProcessor.start(); } }
@SuppressWarnings("unused") public void shutdown() { this.shutdown = true; this.interrupt(); }
public CleanerThread(long executionLogsRetentionMs) { this.executionLogsRetentionMs = executionLogsRetentionMs; this.setName("AzkabanWebServer-Cleaner-Thread"); }
@SuppressWarnings("unused") public void shutdown() { shutdown = true; this.interrupt(); }
public CleanerThread(final long executionLogsRetentionMs) { this.executionLogsRetentionMs = executionLogsRetentionMs; this.setName("AzkabanWebServer-Cleaner-Thread"); }
@Override public void start() throws ExecutorManagerException { initialize(); this.updaterThread.start(); this.cleanerThread.start(); this.queueProcessor.start(); }
@SuppressWarnings("unused") public void shutdown() { this.shutdown = true; this.interrupt(); }
private CleanerThread createCleanerThread() { final long executionLogsRetentionMs = this.azkProps.getLong("execution.logs.retention.ms", DEFAULT_EXECUTION_LOGS_RETENTION_MS); return new CleanerThread(executionLogsRetentionMs); }