Skip to content

Commit

Permalink
Fix for RejectedExecutionException during delete operations
Browse files Browse the repository at this point in the history
If the tasks scheduled by ForkJoinPool are all busy and new task is
added, the pool would throw RejectedExecutionException if the "saturate"
Predicate is not specified.

To avoid that, supply Predicate that is always true - with that, no
exception will be thrown on busy pool and we would not reject new delete
operations.

Fixes #1592
  • Loading branch information
iloveeclipse committed Oct 22, 2024
1 parent 31d84d1 commit 9ca19a0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ private static ForkJoinPool createExecutor(int threadCount) {
/* asyncMode */ false, // Last-In-First-Out is important to delete child before parent folders
/* corePoolSize */ 0, //
/* maximumPoolSize */ threadCount, //
/* minimumRunnable */ 0, null, // delete algorithm does not need any
/* minimumRunnable */ 0, //
pool -> true, // if maximumPoolSize would be exceeded, don't throw RejectedExecutionException
/* keepAliveTime */ 1, TimeUnit.MINUTES); // pool terminates 1 thread per
}

Expand Down

0 comments on commit 9ca19a0

Please sign in to comment.