package cc.smtweb.framework.core.mvc.scheduler.job;

import cc.smtweb.framework.core.mvc.scheduler.AbstractJob;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobExecutor;
import cc.smtweb.framework.core.mvc.scheduler.AbstractJobQueue;

public class SimpleJobQueue extends AbstractJobQueue {
    public SimpleJobQueue(AbstractJobExecutor jobManager) {
        super(jobManager);
    }

    @Override
    public void execute(AbstractJob job) {
        if (tryLock()) {
            try {
                super.execute(job);
            } finally {
                unlock();
            }
        }
    }
}
