Request for Non-blocking API Equivalent to Go's etcd client TryLock in jetcd
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 312
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 2
Description
**Is your feature request related to a problem? Please describe.**
I am currently encountering a limitation with the jetcd (Java client for etcd) regarding lock acquisition functionality. I am in need of a feature similar to the TryLock method in Go's etcd client (client/v3/concurrency/mutex.go). The lack of a non-blocking API to attempt acquiring a lock in jetcd presents a significant challenge for my use case.
**Describe the solution you'd like**
I am looking for the implementation of a non-blocking lock acquisition API in Java's LockClient, similar to the TryLock method in Go's etcd client. The reference Go implementation is here: [Go etcd TryLock](https://github.com/etcd-io/etcd/blob/e33c6dd9df9067003661a1661c5b98de1d292152/client/v3/concurrency/mutex.go#L45-L67). Such a method is crucial for scenarios where blocking behavior is not suitable or practical.
**Describe alternatives you've considered**
I have contemplated using a timeout mechanism in Java for lock acquisition, where a lock attempt is considered unsuccessful if it is not secured within a set time. However, this is not a true non-blocking approach and necessitates caution on the part of developers when calling it. A client-side solution, transparent like in the Go implementation, would be more desirable.
**Additional context**
Adding this feature would bring jetcd more in line with the Go client's capabilities, enhancing its utility for Java developers interfacing with etcd. It is particularly important for high-concurrency environments or situations where minimizing response time is essential.
Implementation and Contribution Inquiry
I would like to know if there are any plans to implement such a feature in jetcd. Additionally, I am interested in whether the project would be open to accepting a Pull Request for this feature, should there be no current plans for its implementation.
Contributor guide
Assessment
This issue has not been assessed yet.