Forking Aesthetics

Eric Kolotyluk eric at kolotyluk.net
Tue Nov 16 23:05:50 UTC 2021


This may seem picky, but right now I have something like

var completionHandler = new StructuredExecutor.ShutdownOnFailure();
IntStream.range(0, 15).forEach(item -> {
    System.out.printf("item = %d, Thread ID = %s\n", item,
Thread.currentThread());
    executorService.fork(() -> {
        System.out.printf("\ttask = %d, Thread ID = %s\n", item,
Thread.currentThread());
        return null;
    }, completionHandler);

but I don't like having to tack-on completionHandler as the second argument
to fork()... I don't like the aesthetics because I would rather things just
end with the inline Callable, aka Lambda.

I would rather that the task (i.e. Callable) always be the last argument
for aesthetic and readability reasons.

I can imagine many other designs, but will not suggest any unless asked
because I don't understand the gestalt of the team's design principles yet.

Cheers, Eric


More information about the loom-dev mailing list