Custom ThreadPoolExecutor - #11895
Draft
kevlahnota wants to merge 30 commits into
Draft
kevlahnota wants to merge 30 commits into
kevlahnota wants to merge 30 commits into
Conversation
… custom future task
tool4ever
requested changes
Sep 13, 2026
Contributor
There was a problem hiding this comment.
Well, not sure if you already wanted feedback but since I may not have more time later:
- did you measure the lambda stuff? I once did some research in that direction and in general JVM should be able to cache and reuse them. Though there may be some limits to such detection logic which we're reaching here?
- your global(!) ThreadPool creates an artificial bottleneck for other AI + other games running at the same time risk their AI becoming "braindead" for no reason while the pool is saturated with non-idle Threads
- I see no attempt of clearing
interruptedstatus afterwards. Since you're also allowing worker threads to get reused during some period this can lead to even more nondeterministic behaviour - grace wait time +
stop()dropped without explanation - the final safeguard to prevent more crashes... - class field
Thread CANCELLED_MARKER = new Thread()for every attacker? now the operating system has to spawn even more than before :/ - please don't reintroduce old bugs, see 2676235
Contributor
Author
|
@tool4ever I was getting thread death when I use Thread.stop to forcefully killing the thread. Though it may benefit desktop using java 17, It doesn't mean it will benefit on android, Also this is still WIP since Im testing on older android with limited RAM for the heap you can't increase in anyway. The marker is just marker so you interrupt the correct thread. Im avoiding the hashmap reference as it can grow up and will introduce more heap allocation on mobile platform. |
…violate something
…to the pool clean, regardless of how the task ended.
kevlahnota
marked this pull request as ready for review
September 15, 2026 22:14
kevlahnota
marked this pull request as draft
September 19, 2026 01:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ThreadPoolExecutor configuration - short-lived tasks for AI Timeout. Reusable and It doesn't need to shutdown manually. Threads will die on idle. Really Bad for sequential operations where every single task must finish without being dropped. So don't use it for those. Optimize a bit for declare attackers by using a reusable runnable object and comparator so heap is reduced.