Commit 784e68cb authored by Nguyen Ha's avatar Nguyen Ha

add Lock Job

parent f34fc537
...@@ -4,6 +4,7 @@ import com.viettel.campaign.model.ccms_full.*; ...@@ -4,6 +4,7 @@ import com.viettel.campaign.model.ccms_full.*;
import com.viettel.campaign.service.*; import com.viettel.campaign.service.*;
import com.viettel.campaign.utils.DateTimeUtil; import com.viettel.campaign.utils.DateTimeUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.core.SchedulerLock;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -41,6 +42,7 @@ public class CampaignJob { ...@@ -41,6 +42,7 @@ public class CampaignJob {
// @Scheduled(fixedRate = 5000) // @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED) // @Transactional( propagation = Propagation.REQUIRED)
@SchedulerLock(name = "testTimer", lockAtMostFor = 20*1000, lockAtLeastFor = 20*1000)
public void process() { public void process() {
log.info(Thread.currentThread().getName() + " The Task executed at " + dateFormat.format(new Date())); log.info(Thread.currentThread().getName() + " The Task executed at " + dateFormat.format(new Date()));
List<ProcessConfig> list = processConfigService.findAll(); List<ProcessConfig> list = processConfigService.findAll();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment