Class BackupJob
- All Implemented Interfaces:
org.quartz.Job
BackupRunner.
Deliberately holds no behavior of its own: everything worth testing lives in BackupRunner, which needs neither a scheduler nor a Quartz context to exercise.
Instantiated by Quartz, not by Spring: Boot's QuartzAutoConfiguration installs a
SpringBeanJobFactory with the application context set, which creates each job through
getAutowireCapableBeanFactory().createBean(jobClass). This class therefore has exactly
one constructor, which is what makes that constructor injection unambiguous —
adding a second would break the wiring at runtime rather than at compile time.
DisallowConcurrentExecution matters at short intervals: a backup of a large store can
outlast its own interval. Overlapping runs would not corrupt anything — TDB2 serializes them
inside read transactions — but they would thrash disk and upload bandwidth to no benefit.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(org.quartz.JobExecutionContext context) Runs one backup.
-
Constructor Details
-
BackupJob
Creates the job.- Parameters:
runner- the runner that takes and uploads the backup
-
-
Method Details
-
execute
public void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionException Runs one backup.Failures are wrapped rather than swallowed, so Quartz reports them. The wrap passes
refireImmediately = falsedeliberately: a durable failure — bad credentials, a full disk, a missing bucket — would otherwise hot-loop. The next scheduled fire still happens, so a transient failure recovers on its own.- Specified by:
executein interfaceorg.quartz.Job- Parameters:
context- the Quartz execution context, unused- Throws:
org.quartz.JobExecutionException- if the backup or its upload fails
-