-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(lock): support basic distributed lock api #178
Conversation
client-api/src/main/java/io/streamnative/oxia/client/api/OptionBackoff.java
Outdated
Show resolved
Hide resolved
client-api/src/main/java/io/streamnative/oxia/client/api/OptionBackoff.java
Outdated
Show resolved
Hide resolved
public CompletableFuture<Void> tryLock( | ||
long time, TimeUnit unit, ExecutorService callbackService) { | ||
return lock(callbackService) | ||
.orTimeout(time, unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When lock with retry, and put the retry task into taskService queue and wait for the next time schedule, but the tryLock timeout condition hit. It will fail this trylock operation, but the next retry won't cancel and it may succeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good point. let me fix it then. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the tryLock
with time now. and will support safe cancel future in the next PR.
This reverts commit 3961ef4.
Motivation
Support basic APIs for distributed lock implementation. because it's still in experiment level, we can only use it by factory mode.