Package se.l4.jobs.backend.silo
Class SiloJobsBackend
java.lang.Object
se.l4.jobs.backend.silo.SiloJobsBackend
- All Implemented Interfaces:
JobsBackend
public class SiloJobsBackend extends Object implements JobsBackend
This backend will store jobs in a
Silo entity. This allows for
persisting jobs within a single process.
To use this backend define an entity either using
defineJobEntity(SiloBuilder, String) or defineJobEntity(StructuredEntityBuilder).
This entity should then be provided to the constructor after being fetched
using Silo.structured(String).
This works by queuing up a task for the closest job. When the tasks runs
all of the jobs that have past their timestamp
will be run. After this is done the task will be queued up again.
-
Constructor Summary
Constructors Constructor Description SiloJobsBackend(se.l4.silo.structured.StructuredEntity entity) -
Method Summary
Modifier and Type Method Description voidaccept(QueuedJob<?,?> job)voidcancel(long id)static se.l4.silo.engine.builder.SiloBuilderdefineJobEntity(se.l4.silo.engine.builder.SiloBuilder builder, String name)static <T> se.l4.silo.engine.builder.StructuredEntityBuilder<T>defineJobEntity(se.l4.silo.engine.builder.StructuredEntityBuilder<T> builder)Optional<QueuedJob<?,?>>getViaId(String id)longnextId()voidstart(JobControl control)voidstop()
-
Constructor Details
-
SiloJobsBackend
public SiloJobsBackend(se.l4.silo.structured.StructuredEntity entity)
-
-
Method Details
-
nextId
public long nextId()- Specified by:
nextIdin interfaceJobsBackend
-
start
- Specified by:
startin interfaceJobsBackend
-
stop
public void stop()- Specified by:
stopin interfaceJobsBackend
-
accept
- Specified by:
acceptin interfaceJobsBackend
-
cancel
public void cancel(long id)- Specified by:
cancelin interfaceJobsBackend
-
getViaId
- Specified by:
getViaIdin interfaceJobsBackend
-
defineJobEntity
public static se.l4.silo.engine.builder.SiloBuilder defineJobEntity(se.l4.silo.engine.builder.SiloBuilder builder, String name) -
defineJobEntity
public static <T> se.l4.silo.engine.builder.StructuredEntityBuilder<T> defineJobEntity(se.l4.silo.engine.builder.StructuredEntityBuilder<T> builder)
-