public final class EtcdLockClient extends Object implements LockClient
LockClient.FluentLockRequest, LockClient.FluentUnlockRequest| Modifier and Type | Field and Description |
|---|---|
protected EtcdClient |
etcdClient |
protected GrpcClient |
grpcClient |
| Constructor and Description |
|---|
EtcdLockClient(GrpcClient grpcClient,
EtcdClient etcdClient) |
| Modifier and Type | Method and Description |
|---|---|
LockClient.FluentLockRequest |
lock(com.google.protobuf.ByteString name)
Acquire a lock with the given name.
|
LockClient.FluentUnlockRequest |
unlock(com.google.protobuf.ByteString key)
Release the lock with the given key.
|
protected final EtcdClient etcdClient
protected final GrpcClient grpcClient
public EtcdLockClient(GrpcClient grpcClient, EtcdClient etcdClient)
public LockClient.FluentLockRequest lock(com.google.protobuf.ByteString name)
LockClientwithLease()
methods is used, the lock will be tied to this client's session lease.
The response contains a key whose existence is tied to the caller's ownership of the lock. This key can be used in conjunction with transactions to safely ensure updates to etcd only occur while holding lock ownership. The lock is held until Unlock is called on the key or the lease associated with the owner expires.
lock in interface LockClientname - unique name identifying the lockpublic LockClient.FluentUnlockRequest unlock(com.google.protobuf.ByteString key)
LockClientunlock in interface LockClientkey - unique key returned in the LockResponse
from the LockClient.lock(ByteString) method.Copyright © 2023. All rights reserved.