Skip to content

Allow Client to Provide ExecutorService#37

Closed
kkoz wants to merge 2 commits into
ome:masterfrom
kkoz:region-task
Closed

Allow Client to Provide ExecutorService#37
kkoz wants to merge 2 commits into
ome:masterfrom
kkoz:region-task

Conversation

@kkoz

@kkoz kkoz commented Feb 26, 2026

Copy link
Copy Markdown

Picks up #10
Related to glencoesoftware/omero-ms-image-region#50

Previously, when using the HSBRenderingStrategy, the class would create its own ExecutorService here:

ExecutorService processor = Executors.newCachedThreadPool();

newCachedThreadPool returns a ThreadPoolExecutor which will create an unbounded number of threads. The combination of having one ThreadPoolExecutor per Renderer plus that pool always being unlimited in size means that clients can unintentionally create huge number of threads.

This PR changes that by providing the client with the option to create and manage the ExecutorService.
With this PR, Renderer takes an ExecutorService as an argument and passes it through to the HSBRenderingStrategy for use in rendering. This means the calling code gets to determine the quantity and properties of the thread pools, and can therefore put hard limits on how many threads might get created.

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ThreadPoolExecutor.html has good information about how to create and manage ThreadPoolExecutors to achieve the desired behavior.

@kkoz kkoz changed the title Require Client to Provide ExecutorService Allow Client to Provide ExecutorService Feb 26, 2026
@kkoz kkoz requested review from chris-allan and sbesson February 27, 2026 16:32
@sbesson

sbesson commented Apr 21, 2026

Copy link
Copy Markdown
Member

@sbesson sbesson closed this Apr 21, 2026
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.

3 participants