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

Closes #349 DelegatingScheduler: Bill Pugh Singleton Implementation #350

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

magicprinc
Copy link

@magicprinc magicprinc commented Nov 26, 2022

Closes #349

@magicprinc magicprinc changed the title #349 DelegatingScheduler: Bill Pugh Singleton Implementation Closes #349 DelegatingScheduler: Bill Pugh Singleton Implementation Nov 26, 2022
@magicprinc
Copy link
Author

Second commit contains:

  1. bug fix in DelegatingScheduler#schedule: (delay == 0) → (delay <= 0)

  2. fix, if user's executor is actually commonPool() without parallelism. Similar to CompletableFuture.screenExecutor

  3. Use less memory: don't capture variable if executor is commonPool (Lambda can access it without capturing through static field.

pre-calculate everything
use less memory
compact lambdas
ScheduledCompletableFuture doesn't have to keep `time`: it can simply call delegate
ThreadFactory.newThread: setName can be done in ctor
if → ? :
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.

DelegatingScheduler singletons in modern style
1 participant