Class WorkerLeaseHandler

java.lang.Object
com.fishlib.io.sched.Job
com.fishlib.io.sched.TimedJob
com.illumon.iris.db.tables.remotequery.keepalive.WorkerLeaseHandler
All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable

public class WorkerLeaseHandler extends com.fishlib.io.sched.TimedJob
A WorkerLeaseHandler manages an etcd lease that holds key-values that indicate liveness to workers.

This should be used in concert with a WorkerTtlCheckJob and a AbstractWorkerStatusServlet.

  • Constructor Details

    • WorkerLeaseHandler

      public WorkerLeaseHandler(com.fishlib.io.logger.Logger log, String dispatcherNameForDiscovery, String dispatcherUrl, int leaseTtlSeconds, int leaseRenewSeconds, int leaseRenewRetryDelaySeconds, WorkerLeaseHandler.LeaseRecreationCallback leaseRecreationCallback) throws IOException, ExecutionException, InterruptedException, TimeoutException
      Manages etcd lease for workers that use this process to control their lifetime.
      Parameters:
      log - the log
      dispatcherNameForDiscovery - the name of this dispatcher
      dispatcherUrl - the URL that clients connect to for this dispatcher
      leaseTtlSeconds - the time-to-live of our etcd lease
      leaseRenewSeconds - the number of seconds between etcd lease renewals
      leaseRenewRetryDelaySeconds - do not retry a renewal until this many seconds after a failure
      leaseRecreationCallback - the lease recreation callback
      Throws:
      IOException - thrown by jetcd client
      ExecutionException - thrown by jetcd client
      InterruptedException - thrown by jetcd client
      TimeoutException - thrown by jetcd client
  • Method Details

    • timedOut

      public void timedOut()
      Specified by:
      timedOut in class com.fishlib.io.sched.Job
    • setWorkerStatus

      public boolean setWorkerStatus(String processInfoId, String status)
    • setWorkerStatus

      public boolean setWorkerStatus(String processInfoId, String status, boolean fromRecreate)
    • deleteWorkerStatus

      public void deleteWorkerStatus(String processInfoId)
    • revokeLease

      public void revokeLease()