Class JobWorkerImpl
- java.lang.Object
-
- io.camunda.zeebe.client.impl.worker.JobWorkerImpl
-
- All Implemented Interfaces:
JobWorker,Closeable,AutoCloseable
public final class JobWorkerImpl extends Object implements JobWorker, Closeable
The job worker wants to have enough jobs to work on. Most of this class' implementation deals with the scheduling of polling for new jobs.In order to get an initial set of jobs to work on, the job worker will schedule a first poll on construction. If a poll does not provide any new jobs, another poll is scheduled with a delay using the
pollInterval.If a poll successfully provides jobs, the worker submits each job to the job handler. Every time a job is completed, the worker checks if it still has enough jobs to work on. If not, it will poll for new jobs. To determine what is considered enough jobs it compares its number of
remainingJobswith theactivationThreshold.If a poll fails with an error response, a retry is scheduled with a delay using the
retryDelaySupplierto ask for a newpollInterval. By default this retry delay supplier is theExponentialBackoff. This default is also used as a fallback for the user provided backoff. On the next success, thepollIntervalis reset to its original value.
-
-
Constructor Summary
Constructors Constructor Description JobWorkerImpl(int maxJobsActive, ScheduledExecutorService executor, Duration pollInterval, JobRunnableFactory jobHandlerFactory, JobPoller jobPoller, BackoffSupplier backoffSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this registration and stops receiving new work items.booleanisClosed()booleanisOpen()
-
-
-
Constructor Detail
-
JobWorkerImpl
public JobWorkerImpl(int maxJobsActive, ScheduledExecutorService executor, Duration pollInterval, JobRunnableFactory jobHandlerFactory, JobPoller jobPoller, BackoffSupplier backoffSupplier)
-
-
Method Detail
-
isOpen
public boolean isOpen()
-
isClosed
public boolean isClosed()
-
close
public void close()
Description copied from interface:JobWorkerCloses this registration and stops receiving new work items. Blocks until all previously received items have been handed to the worker.
-
-