Skip to content

Future.await() should throw of InterruptedException #2660

@danieldietrich

Description

@danieldietrich

It is a deliberate design decision that Try handles InterruptedException as Fata, read: rethrowing it. See also this thread. This is essential, Try must not swallow InterruptedException:

// should not throw
var f1 = Future.of(() -> { throw new InterruptedException(); })
var f2 = Future.of(() -> Try.of(() -> { throw new InterruptedException(); }))

// should throw InterruptedException instead of blocking forever
f1.await();
f2.await();

However, currently Future.await() is misbehaving, it does not recognize that the above examples have been interrupted.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions