Class DispatcherPresenceLeaseHandler
java.lang.Object
com.illumon.iris.db.tables.remotequery.keepalive.DispatcherPresenceLeaseHandler
A DispatcherPresenceLeaseHandler manages an etcd lease that holds key-values that indicate presence to workers.
This should be used in concert with a WorkerTtlCheckJob and a AbstractWorkerStatusServlet.
-
Constructor Summary
ConstructorsConstructorDescriptionDispatcherPresenceLeaseHandler(com.fishlib.io.logger.Logger log, io.deephaven.shadow.jetcd.io.etcd.jetcd.Client client, String dispatcherNameForDiscovery, String dispatcherUrl, io.deephaven.enterprise.etcdclient.presence.PresenceKvLeaseHandler.LeaseRecreationListener leaseRecreationListener) Manages an etcd lease for presence KVs that workers use to control their lifetime. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this object.voiddeleteWorkerStatus(String processInfoId, boolean logWarningIfNoKey) Delete the presence KV for the givenprocessInfoId.booleanisClosed()Returns true if this object has been closed.booleansetWorkerStatus(String processInfoId, String status) Put a presence KV for the givenprocessInfoId.
-
Constructor Details
-
DispatcherPresenceLeaseHandler
public DispatcherPresenceLeaseHandler(com.fishlib.io.logger.Logger log, io.deephaven.shadow.jetcd.io.etcd.jetcd.Client client, String dispatcherNameForDiscovery, String dispatcherUrl, io.deephaven.enterprise.etcdclient.presence.PresenceKvLeaseHandler.LeaseRecreationListener leaseRecreationListener) throws ExecutionException, InterruptedException, TimeoutException Manages an etcd lease for presence KVs that workers use to control their lifetime.- Parameters:
log- the logclient- the etcd client to usedispatcherNameForDiscovery- the name of this dispatcherdispatcherUrl- the URL that clients connect to for this dispatcherleaseRecreationListener- the lease recreation callback- Throws:
ExecutionException- thrown by jetcd clientInterruptedException- thrown by jetcd clientTimeoutException- thrown by jetcd client
-
-
Method Details
-
setWorkerStatus
Put a presence KV for the givenprocessInfoId.- Parameters:
processInfoId- TheprocessInfoIdwhose presence KV will be created or overwrittenstatus- The status to write for the KV- Returns:
- true if the put succeeded, false otherwise
-
deleteWorkerStatus
Delete the presence KV for the givenprocessInfoId.- Parameters:
processInfoId- TheprocessInfoIdwhose presence KV will be deletedlogWarningIfNoKey- if true, emit a log warning if the key is not found; if false, ignore the key not found case.
-
close
public void close()Close this object. It is safe to call close more than once, but after close has been called, no other method of this object should be called. -
isClosed
public boolean isClosed()Returns true if this object has been closed.- Returns:
- true if this object has been closed
-