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 Details

  • Method Details

    • setWorkerStatus

      public boolean setWorkerStatus(String processInfoId, String status)
      Put a presence KV for the given processInfoId, with no information for worker info. To be used when terminating a worker, primarily.
      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
    • setWorkerStatus

      public boolean setWorkerStatus(String processInfoId, String status, String workerInfoJsonList)
      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
      workerInfoJsonList - List of WorkerStreamProvider.WorkerInfo objects applicable for this worker, serialized to a json list.
      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