-
Notifications
You must be signed in to change notification settings - Fork 0
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
StateGuard #3
Comments
This was referenced Dec 19, 2017
Closed
Adeynack
pushed a commit
that referenced
this issue
Dec 21, 2017
Adeynack
pushed a commit
that referenced
this issue
Dec 27, 2017
+ better tests for SequencedExecutor
Merged
Adeynack
added a commit
that referenced
this issue
Jan 18, 2018
* Create `SequencedExecutor`. * #3 implement StateGuard's first method 'mutate' * #8 configure `error-prone` and apply its suggestions * #1 add tests * #1 nice catch, M. Error-Prone! * #1 more strict Java compiling rules + consider warnings as errors * #1 use @GuardedBy for better error-prone coverage. * #3 complete StateGuard + tests + better tests for SequencedExecutor * #3 clean up * #8 avoid raw types (thanks error-prone) * #3 add failure tests * #3 add CODEOWNERS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Idea
Ensures that state mutation is thread safe by holding the state value itself internally and making it available only when a task is dispatched to it.
This works better if the state is an immutable class using immutable collections, for total encapsulation.
To be done AFTER
Main features
Those are main ideas and not final interfaces.
mutate
User submits a lambda receiving the actual state and returning the new value of the state. The method itself returns a
CompletionStage<Void>
to allow to caller to react upon the completion of the submitted task.provide
User submits a lambda receiving the actual state and returning a value to pass down to the caller of the method.
mutateAndProvide
User submits a lambda receiving the actual state and returning both the value to return as a result of the operation and the new value of the state.
The text was updated successfully, but these errors were encountered: