Skip to content

LimitedExecutor #2

Description

@Adeynack

Use cases

  • Limit the number of parallel tasks of a similar nature that are executed at the same time.
    • Example: Ensure that not more than 3 calls to an external service are made at the same time.

Why not ...

... use Executors.newFixedThreadPool

Because it creates new threads. This proposition is an Executor that limits without creating any new thread. The thread pool already exist and we want to use it. In the end, the tasks are dispatched to an existing Executor (which does not have to be a pool, but is the typical use).

Specifications

  • Based on an existing executor (composite)
  • Receive the number of parallel task to be executed at construction time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions