Skip to content

Conversation

@krzysiekigry
Copy link
Contributor

goodbye, "pool-2-thread-1"

@scottf
Copy link
Contributor

scottf commented Nov 21, 2024

@krzysiekigry So the idea is fine, but it needs to be done in an optional way, since someone might currently rely on that naming scheme in their existing application / logs.

In the Options Builder, you can call public Builder executor(ExecutorService executor), so maybe add these:

public Builder callbackExecutor(ExecutorService executor) 
public Builder connectExecutor(ExecutorService executor) 

With the defaults matching exactly the existing i.e. newSingleThreadExecutor()

And so starting at line 159 of NatsConnection, that block of code would look like this:

this.executor = options.getExecutor();
this.callbackRunner = options.getCallbackExecutor();
this.connectExecutor = options.getConnectExecutor();

Also, please sign your commits. Here is a good link to help with that: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

@krzysiekigry
Copy link
Contributor Author

krzysiekigry commented Nov 25, 2024

Thanks for the suggestion, but I believe this approach works better. When NatsConnection shuts down, it terminates the executors. This can cause issues when attempting to create a new NatsConnection, as the executors would already be shut down. Please let me know if I’m mistaken.

@scottf
Copy link
Contributor

scottf commented Nov 25, 2024

Factory is a good idea.

@scottf scottf merged commit a76dd02 into nats-io:main Nov 26, 2024
1 check passed
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.

2 participants