Skip to content

Closes #349 DelegatingScheduler: Bill Pugh Singleton Implementation #350

New issue

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

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

Already on GitHub? # to your account

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 → ? :
# for free to join this conversation on GitHub. Already have an account? # 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