Package io.etcd.jetcd
Interface Lock
-
- All Superinterfaces:
java.lang.AutoCloseable,CloseableClient
public interface Lock extends CloseableClient
Interface of Lock talking to etcd.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<LockResponse>lock(ByteSequence name, long leaseId)Acquire a lock with the given name.java.util.concurrent.CompletableFuture<UnlockResponse>unlock(ByteSequence lockKey)Release the lock identified by the given key.-
Methods inherited from interface io.etcd.jetcd.support.CloseableClient
close
-
-
-
-
Method Detail
-
lock
java.util.concurrent.CompletableFuture<LockResponse> lock(ByteSequence name, long leaseId)
Acquire a lock with the given name.- Parameters:
name- the identifier for the distributed shared lock to be acquired.leaseId- the ID of the lease that will be attached to ownership of the lock. If the lease expires or is revoked and currently holds the lock, the lock is automatically released. Calls to Lock with the same lease will be treated as a single acquistion; locking twice with the same lease is a no-op.- Returns:
- the lock response
-
unlock
java.util.concurrent.CompletableFuture<UnlockResponse> unlock(ByteSequence lockKey)
Release the lock identified by the given key.- Parameters:
lockKey- key is the lock ownership key granted by Lock.- Returns:
- the unlock response
-
-