class ScheduledJobExecutor implements ApplicationContextAware {

    void execute(Callable<Void> callable, String jobIdentifier) {
        ScheduledJobLog jobLog;

        try {
            callable.call();

            // execution went well
            var executionTime = LocalDateTime.now(clock);
            jobLog = new ScheduledJobLog(executionTime, jobIdentifier, ScheduledJobLog.Status.SUCCESS);

            log.debug(String.format("Successfully executed scheduled job with job identifier '%s'!",
                    jobIdentifier));
        } catch (Exception ex) {
            // execution failed
            var executionTime = LocalDateTime.now(clock);
            jobLog = new ScheduledJobLog(executionTime, jobIdentifier, ScheduledJobLog.Status.FAILURE);

            log.debug(String.format("Failed to executed scheduled job with job identifier %s!",
                    jobIdentifier), ex);
        }

        jobLogRepo.save(jobLog);
    }

    @Autowired public  ScheduledJobExecutor(ScheduledJobLogRepository jobLogRepo, Clock clock);

}