package com.caliverse.admin.scheduler;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class CommonScheduler implements Scheduler {

    @Override
    public void execute() {
        try {
            log.info("Start executing scheduler: {}", getSchedulerType());
            executeInternal();
            log.info("Finished executing scheduler: {}", getSchedulerType());
        } catch (Exception e) {
            log.error("Error executing scheduler {}: {}", getSchedulerType(), e.getMessage(), e);
        }
    }

    /**
     * 스케줄러 구현체에서 실제 작업을 수행하는 메소드
     */
    protected abstract void executeInternal();
}
