Class DispatcherPresenceLeaseHandler

java.lang.Object
com.illumon.iris.db.tables.remotequery.keepalive.DispatcherPresenceLeaseHandler

public class DispatcherPresenceLeaseHandler extends Object
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

    Constructors
    Constructor
    Description
    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)
    Manages an etcd lease for presence KVs that workers use to control their lifetime.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close this object.
    void
    deleteWorkerStatus(String processInfoId, boolean logWarningIfNoKey)
    Delete the presence KV for the given processInfoId.
    boolean
    Returns true if this object has been closed.
    boolean
    setWorkerStatus(String processInfoId, String status)
    Put a presence KV for the given processInfoId.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 log
      client - the etcd client to use
      dispatcherNameForDiscovery - the name of this dispatcher
      dispatcherUrl - the URL that clients connect to for this dispatcher
      leaseRecreationListener - the lease recreation callback
      Throws:
      ExecutionException - thrown by jetcd client
      InterruptedException - thrown by jetcd client
      TimeoutException - thrown by jetcd client
  • Method Details

    • setWorkerStatus

      public boolean setWorkerStatus(String processInfoId, String status)
      Put a presence KV for the given processInfoId.
      Parameters:
      processInfoId - The processInfoId whose presence KV will be created or overwritten
      status - The status to write for the KV
      Returns:
      true if the put succeeded, false otherwise
    • deleteWorkerStatus

      public void deleteWorkerStatus(String processInfoId, boolean logWarningIfNoKey)
      Delete the presence KV for the given processInfoId.
      Parameters:
      processInfoId - The processInfoId whose presence KV will be deleted
      logWarningIfNoKey - 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