This closes #2075
This commit is contained in:
commit
88b1371e98
|
@ -239,8 +239,10 @@ public class PageCursorProviderImpl implements PageCursorProvider {
|
|||
for (PageSubscription cursor : activeCursors.values()) {
|
||||
cursor.stop();
|
||||
}
|
||||
|
||||
executor.shutdownNow();
|
||||
final int pendingCleanupTasks = scheduledCleanup.get();
|
||||
if (pendingCleanupTasks > 0) {
|
||||
logger.tracef("Stopping with %d cleanup tasks to be completed yet", pendingCleanupTasks);
|
||||
}
|
||||
}
|
||||
|
||||
private void waitForFuture() {
|
||||
|
|
|
@ -348,11 +348,23 @@ public class PagingStoreImpl implements PagingStore {
|
|||
@Override
|
||||
public synchronized void stop() throws Exception {
|
||||
if (running) {
|
||||
cursorProvider.flushExecutors();
|
||||
cursorProvider.stop();
|
||||
|
||||
running = false;
|
||||
final List<Runnable> pendingTasks = new ArrayList<>();
|
||||
final int pendingTasksWhileShuttingDown = executor.shutdownNow(pendingTasks::add);
|
||||
if (pendingTasksWhileShuttingDown > 0) {
|
||||
logger.tracef("Try executing %d pending tasks on stop", pendingTasksWhileShuttingDown);
|
||||
for (Runnable pendingTask : pendingTasks) {
|
||||
try {
|
||||
pendingTask.run();
|
||||
} catch (Throwable t) {
|
||||
logger.warn("Error while executing a pending task on shutdown", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
executor.shutdownNow();
|
||||
running = false;
|
||||
|
||||
if (currentPage != null) {
|
||||
currentPage.close(false);
|
||||
|
|
Loading…
Reference in New Issue