Skip to content

Conversation

@geirsagberg
Copy link
Contributor

Allows high-priority tasks to execute immediately even when all default threads are busy with lower-priority work. Includes capacity-aware fallback routing and comprehensive test coverage.

🤖 Generated with Claude Code

Brief, plain english overview of your changes here

As described in #702 we had a need for "fast lane" pools for high priority tasks, so I spent the weekend working with Claude and ended up with a solution that uses multiple executors with separate thread pools. Open for feedback and alternative solutions!

Also, I added guidelines for Claude and also Jetbrains Junie.

Fixes

#702

Reminders

  • Added/ran automated tests
  • Update README and/or examples
  • Ran mvn spotless:apply

cc @kagkarlsson

geirsagberg and others added 2 commits December 2, 2025 14:35
…gkarlsson#702)

Allows high-priority tasks to execute immediately even when all default
threads are busy with lower-priority work. Includes capacity-aware
fallback routing and comprehensive test coverage.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
… worker pools

When using worker pools, the polling strategies (FetchCandidates and
LockAndFetchCandidates) were calculating fetch limits (lowerLimit and
upperLimit) based only on the default executor's thread pool size,
while aggregating queue state across all executors. This caused
severe underutilization of worker pool threads, especially with the
LOCK_AND_FETCH strategy.

Changes:
- Calculate totalThreads by summing default pool + all worker pools
- Pass totalThreads to polling strategy constructors
- Rename threadpoolSize parameter to totalThreads for clarity
- Add getWorkerPoolThreads() to extract thread count from configs
- Add third addWorkerPool() overload for custom ExecutorService with explicit thread count
- Update documentation to explain limit calculations
- Add test verifying full utilization with LOCK_AND_FETCH strategy

Example: With 10 default threads + 5 high-priority threads (15 total),
the scheduler now fetches up to 15 tasks instead of 10, allowing all
pools to be utilized when high-priority tasks are available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant