Skip to content

Commit

Permalink
Revert "Use WorkerThread if parallelism is one." (#7152)
Browse files Browse the repository at this point in the history
Revert "Use WorkerThread if parallelism is one. (#7150)"

This reverts commit 2ef699b.
  • Loading branch information
snazy committed Jun 28, 2023
1 parent 2ef699b commit 1362d11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,10 @@ public DeleteSummary expire() {
Instant started = clock().instant();
expireParameters().liveContentSet().startExpireContents(started);

ForkJoinPool forkJoinPool = null;
ForkJoinPool forkJoinPool = new ForkJoinPool(parallelism());
try {
DeleteSummary deleteSummary;
if (parallelism() == 1) {
deleteSummary = this.expireContents();
} else {
forkJoinPool = new ForkJoinPool(parallelism());
deleteSummary = forkJoinPool.invoke(ForkJoinTask.adapt(this::expireContents));
}
DeleteSummary deleteSummary =
forkJoinPool.invoke(ForkJoinTask.adapt(this::expireInForkJoinPool));
LOGGER.info(
"live-set#{}: Expiry finished, took {}, deletion summary: {}.",
expireParameters().liveContentSet().id(),
Expand All @@ -84,13 +79,11 @@ public DeleteSummary expire() {
return deleteSummary;
} finally {
expireParameters().liveContentSet().finishedExpireContents(clock().instant(), null);
if (forkJoinPool != null) {
forkJoinPool.shutdown();
}
forkJoinPool.shutdown();
}
}

private DeleteSummary expireContents() {
private DeleteSummary expireInForkJoinPool() {
try (Stream<String> contentIds = expireParameters().liveContentSet().fetchContentIds()) {
return contentIds
.parallel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ public UUID identifyLiveContents() {
throw new IllegalStateException("identifyLiveContents() has already been called.");
}

if (parallelism() == 1) {
return this.walkAllReferences();
}

ForkJoinPool forkJoinPool = new ForkJoinPool(parallelism());
try {
return forkJoinPool.invoke(ForkJoinTask.adapt(this::walkAllReferences));
Expand Down

0 comments on commit 1362d11

Please sign in to comment.