Class WorkerTtlCheckJob
java.lang.Object
com.fishlib.io.sched.Job
com.fishlib.io.sched.TimedJob
com.illumon.iris.db.tables.remotequery.keepalive.WorkerTtlCheckJob
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
public class WorkerTtlCheckJob
extends com.fishlib.io.sched.TimedJob
A timed job that examines a worker for liveness. If the worker has an expired TTL, then terminate it using the
supplied callback.
-
Constructor Summary
ConstructorsConstructorDescriptionWorkerTtlCheckJob
(com.fishlib.io.logger.Logger log, Supplier<SafeCloseable> lockAcquire, Supplier<KeepAliveWorker> workerSupplier, Consumer<SafeCloseable> terminationCallback) -
Method Summary
Modifier and TypeMethodDescriptionstatic WorkerTtlCheckJob
installJob
(com.fishlib.io.sched.Scheduler scheduler, long ttlExpiration, com.fishlib.io.logger.Logger log, Supplier<SafeCloseable> lockAcquire, Supplier<KeepAliveWorker> workerSupplier, Consumer<SafeCloseable> terminationCallback) void
timedOut()
Methods inherited from class com.fishlib.io.sched.TimedJob
append, cancelled, invoke
-
Constructor Details
-
WorkerTtlCheckJob
public WorkerTtlCheckJob(com.fishlib.io.logger.Logger log, Supplier<SafeCloseable> lockAcquire, Supplier<KeepAliveWorker> workerSupplier, Consumer<SafeCloseable> terminationCallback) - Parameters:
log
- the loglockAcquire
- take any necessary lock, and return a SafeCloseable that can be used to release the lock. Note: The closeable may be closed more than once!workerSupplier
- the supplier of the worker this job is managingterminationCallback
- a method to terminate the worker when it has exceeded its TTL
-
-
Method Details
-
timedOut
public void timedOut()- Specified by:
timedOut
in classcom.fishlib.io.sched.Job
-
installJob
public static WorkerTtlCheckJob installJob(com.fishlib.io.sched.Scheduler scheduler, long ttlExpiration, com.fishlib.io.logger.Logger log, Supplier<SafeCloseable> lockAcquire, Supplier<KeepAliveWorker> workerSupplier, Consumer<SafeCloseable> terminationCallback)
-