Skip to content

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