Skip to content

Commit

Permalink
Use a virtual thread executor by default
Browse files Browse the repository at this point in the history
This switches to a virtual thread executor for background I/O
operations.
  • Loading branch information
io7m committed May 15, 2024
1 parent 031aec8 commit 6718e6d
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,11 @@ public static JWFileImageSetType createDefaultIcons()
public static JWFileChoosersType create()
{
final var executor =
Executors.newSingleThreadExecutor(runnable -> {
final var thread = new Thread(runnable);
thread.setDaemon(true);
thread.setName(
String.format(
"com.io7m.jwheatsheaf.ui.io[%d]",
Long.valueOf(thread.getId())
)
);
return thread;
});
Executors.newThreadPerTaskExecutor(
Thread.ofVirtual()
.name("com.io7m.jwheatsheaf.ui.io", 0L)
.factory()
);

return createWith(executor, Locale.getDefault());
}
Expand Down

0 comments on commit 6718e6d

Please sign in to comment.