Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-7993 Striped pool can't be disabled #3661

Closed
wants to merge 5 commits into from

Conversation

gromtech
Copy link
Contributor

Restored the capability to disable striped pool

*/
public class StripedExecutorProxy extends StripedExecutor {
/** Target executor service */
private volatile ExecutorService executor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is not this final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not final because the original constructor wasn't overridden here: StripedExecutorProxy(int cnt, String igniteInstanceName, String poolName, final IgniteLogger log, boolean stealTasks)

I can override it and mark the field as final.

* @throws IgniteException If executor is null.
*/
private void checkExecutor() {
if (executor == null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find code that turns executor to null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned above, there is can be a case when StripedExecutorProxy is created using original constructor (without executor parameter).

cfg.getIgniteInstanceName(),
"sys",
log);
if (cfg.getStripedPoolSize() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this solution. I would like to change all usages of striped executor to a logic that will choose between system and striped pools depending on striped pool enabled or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. What if we add a little bit more changes?

  1. Rename StripedExecutor to StripedExecutorImpl and add an interface named StripedExecutor. Currently, StripedExecutor class implements only ExecutorService interface.

  2. Add new flag (system property) IGNITE_STRIPED_POOL_DISABLED (false by default).

  3. Update StripedPoolProxy "extends ThreadPoolExecutor implements StripedPool".

  4. Restore validateThreadPoolSize(cfg.getStripedPoolSize())

  5. If parameter IGNITE_STRIPED_POOL_DISABLED is "true" then where will be used StripedPoolProxy instead of StripedPool.

This way we will have a sort of second system pool (classic ThreadPoolExecutor) with StripedExecutor interface.

@yzhdanov, how does it sound to you?

* Renamed StripedExecutor to StripedExecutorImpl
* Added StripedExecutor interface
* Update StripedExecutorProxy (extends IgniteThreadPoolExecutor impl StripedExecutor)
@gromtech gromtech closed this May 16, 2018
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