@Test public void closesDeleteExecutorOnClosingTransactionManager() { snapshotTransactionManager.close(); assertThat(deleteExecutor.isTerminated()).isTrue(); }
@Override public void close() { log.info("Calling close on snapshot transaction manager"); if (!isClosed.compareAndSet(false, true)) { log.info("Snapshot transaction manager has already been closed, performing no action"); return; } try (SafeShutdownRunner shutdownRunner = new SafeShutdownRunner(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); shutdownRunner.shutdownSafely(keyValueService::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(deleteExecutor)); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); for (Runnable callback : Lists.reverse(closingCallbacks)) { shutdownRunner.shutdownSafely(callback); } shutdownRunner.shutdownSafely(metricsManager::deregisterMetrics); log.info("Close callbacks complete in snapshot transaction manager"); } log.info("Closed snapshot transaction manager without any errors"); }
SnapshotTransactionManager extends AbstractLockAwareTransactionManager { @Override public void close() { log.info("Calling close on snapshot transaction manager"); if (!isClosed.compareAndSet(false, true)) { log.info("Snapshot transaction manager has already been closed, performing no action"); return; } try (SafeShutdownRunner shutdownRunner = new SafeShutdownRunner(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); shutdownRunner.shutdownSafely(keyValueService::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(deleteExecutor)); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); for (Runnable callback : Lists.reverse(closingCallbacks)) { shutdownRunner.shutdownSafely(callback); } shutdownRunner.shutdownSafely(metricsManager::deregisterMetrics); log.info("Close callbacks complete in snapshot transaction manager"); } log.info("Closed snapshot transaction manager without any errors"); } }
SnapshotTransactionManager extends AbstractLockAwareTransactionManager { @Override public void close() { log.info("Calling close on snapshot transaction manager"); if (!isClosed.compareAndSet(false, true)) { log.info("Snapshot transaction manager has already been closed, performing no action"); return; } try (SafeShutdownRunner shutdownRunner = new SafeShutdownRunner(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); shutdownRunner.shutdownSafely(keyValueService::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(deleteExecutor)); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); for (Runnable callback : Lists.reverse(closingCallbacks)) { shutdownRunner.shutdownSafely(callback); } shutdownRunner.shutdownSafely(metricsManager::deregisterMetrics); log.info("Close callbacks complete in snapshot transaction manager"); } log.info("Closed snapshot transaction manager without any errors"); } protected  SnapshotTransactionManager(
            MetricsManager metricsManager,
            KeyValueService keyValueService,
            TimelockService timelockService,
            LockWatchManager lockWatchManager,
            LockWatchEventCache lockWatchEventCache,
            TimestampManagementService timestampManagementService,
            LockService lockService,
            @NotNull TransactionService transactionService,
            Supplier<AtlasDbConstraintCheckingMode> constraintModeSupplier,
            ConflictDetectionManager conflictDetectionManager,
            SweepStrategyManager sweepStrategyManager,
            Cleaner cleaner,
            boolean allowHiddenTableAccess,
            int concurrentGetRangesThreadPoolSize,
            int defaultGetRangesConcurrency,
            TimestampCache timestampCache,
            MultiTableSweepQueueWriter sweepQueueWriter,
            ExecutorService deleteExecutor,
            boolean validateLocksOnReads,
            Supplier<TransactionConfig> transactionConfig,
            ConflictTracer conflictTracer,
            MetricsFilterEvaluationContext metricsFilterEvaluationContext); }
SnapshotTransactionManager extends AbstractLockAwareTransactionManager { @Override public void close() { log.info("Calling close on snapshot transaction manager"); if (!isClosed.compareAndSet(false, true)) { log.info("Snapshot transaction manager has already been closed, performing no action"); return; } try (SafeShutdownRunner shutdownRunner = new SafeShutdownRunner(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); shutdownRunner.shutdownSafely(keyValueService::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(deleteExecutor)); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); for (Runnable callback : Lists.reverse(closingCallbacks)) { shutdownRunner.shutdownSafely(callback); } shutdownRunner.shutdownSafely(metricsManager::deregisterMetrics); log.info("Close callbacks complete in snapshot transaction manager"); } log.info("Closed snapshot transaction manager without any errors"); } protected  SnapshotTransactionManager(
            MetricsManager metricsManager,
            KeyValueService keyValueService,
            TimelockService timelockService,
            LockWatchManager lockWatchManager,
            LockWatchEventCache lockWatchEventCache,
            TimestampManagementService timestampManagementService,
            LockService lockService,
            @NotNull TransactionService transactionService,
            Supplier<AtlasDbConstraintCheckingMode> constraintModeSupplier,
            ConflictDetectionManager conflictDetectionManager,
            SweepStrategyManager sweepStrategyManager,
            Cleaner cleaner,
            boolean allowHiddenTableAccess,
            int concurrentGetRangesThreadPoolSize,
            int defaultGetRangesConcurrency,
            TimestampCache timestampCache,
            MultiTableSweepQueueWriter sweepQueueWriter,
            ExecutorService deleteExecutor,
            boolean validateLocksOnReads,
            Supplier<TransactionConfig> transactionConfig,
            ConflictTracer conflictTracer,
            MetricsFilterEvaluationContext metricsFilterEvaluationContext); @Override T runTaskWithConditionThrowOnConflict(
            C condition, ConditionAwareTransactionTask<T, C, E> task); @Override List<OpenTransaction> startTransactions(List<? extends PreCommitCondition> conditions); @Override T runTaskWithConditionReadOnly(
            C condition, ConditionAwareTransactionTask<T, C, E> task); @Override void registerClosingCallback(Runnable closingCallback); @Override void close(); @Override void clearTimestampCache(); @Override LockService getLockService(); @Override TimelockService getTimelockService(); @Override LockWatchManager getLockWatchManager(); @Override long getImmutableTimestamp(); @Override long getUnreadableTimestamp(); @Override Cleaner getCleaner(); @Override KeyValueService getKeyValueService(); @Override TimestampService getTimestampService(); @Override TimestampManagementService getTimestampManagementService(); @Override TransactionService getTransactionService(); @Override KeyValueServiceStatus getKeyValueServiceStatus(); }
SnapshotTransactionManager extends AbstractLockAwareTransactionManager { @Override public void close() { log.info("Calling close on snapshot transaction manager"); if (!isClosed.compareAndSet(false, true)) { log.info("Snapshot transaction manager has already been closed, performing no action"); return; } try (SafeShutdownRunner shutdownRunner = new SafeShutdownRunner(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); shutdownRunner.shutdownSafely(keyValueService::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(deleteExecutor)); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); for (Runnable callback : Lists.reverse(closingCallbacks)) { shutdownRunner.shutdownSafely(callback); } shutdownRunner.shutdownSafely(metricsManager::deregisterMetrics); log.info("Close callbacks complete in snapshot transaction manager"); } log.info("Closed snapshot transaction manager without any errors"); } protected  SnapshotTransactionManager(
            MetricsManager metricsManager,
            KeyValueService keyValueService,
            TimelockService timelockService,
            LockWatchManager lockWatchManager,
            LockWatchEventCache lockWatchEventCache,
            TimestampManagementService timestampManagementService,
            LockService lockService,
            @NotNull TransactionService transactionService,
            Supplier<AtlasDbConstraintCheckingMode> constraintModeSupplier,
            ConflictDetectionManager conflictDetectionManager,
            SweepStrategyManager sweepStrategyManager,
            Cleaner cleaner,
            boolean allowHiddenTableAccess,
            int concurrentGetRangesThreadPoolSize,
            int defaultGetRangesConcurrency,
            TimestampCache timestampCache,
            MultiTableSweepQueueWriter sweepQueueWriter,
            ExecutorService deleteExecutor,
            boolean validateLocksOnReads,
            Supplier<TransactionConfig> transactionConfig,
            ConflictTracer conflictTracer,
            MetricsFilterEvaluationContext metricsFilterEvaluationContext); @Override T runTaskWithConditionThrowOnConflict(
            C condition, ConditionAwareTransactionTask<T, C, E> task); @Override List<OpenTransaction> startTransactions(List<? extends PreCommitCondition> conditions); @Override T runTaskWithConditionReadOnly(
            C condition, ConditionAwareTransactionTask<T, C, E> task); @Override void registerClosingCallback(Runnable closingCallback); @Override void close(); @Override void clearTimestampCache(); @Override LockService getLockService(); @Override TimelockService getTimelockService(); @Override LockWatchManager getLockWatchManager(); @Override long getImmutableTimestamp(); @Override long getUnreadableTimestamp(); @Override Cleaner getCleaner(); @Override KeyValueService getKeyValueService(); @Override TimestampService getTimestampService(); @Override TimestampManagementService getTimestampManagementService(); @Override TransactionService getTransactionService(); @Override KeyValueServiceStatus getKeyValueServiceStatus();  }