Skip to content

Investigate ListenableFuture usages and replace it with CompletableFuture if possible #10061

@jihoonson

Description

@jihoonson

Description

CompletableFuture provided since Java 8 can cover many use cases of ListenableFuture. The purpose of this issue is to investigate how we are using ListenableFuture and replace it with CompletableFuture if possible. This issue may include modifying PrioritizedExecutorService or adding a new one to replace it to support query priority with CompletableFuture.

Motivation

Druid uses ListenableFuture in many places. One of the popular use cases is to handle multiple futures which should be done all together in time out. However, as reported in #10027, ListenableFuture doesn't cancel underlying futures on cancel() which leads to potential resource leak. #10027 addresses this problem by adding a util method which cancels all futures which is duplicate but in a less structured way with what CompletableFuture does.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions