public without sharing class NFM503InfoFileSchedule implements Schedulable {
|
public void execute(SchedulableContext sc) {
|
Database.executeBatch(new NFM503InfoFileBatch(), 1);
|
}
|
|
public static void assignOneMinute() {
|
Datetime addOneM = System.now().addMinutes(10);
|
String CRON_EXP = '0 ' + addOneM.minute() + ' ' + addOneM.hour() + ' ' + addOneM.day()
|
+ ' ' + addOneM.month() + ' ? ' + addOneM.year();
|
List<CronTrigger> oldcron = [select Id from CronTrigger where CronExpression = :CRON_EXP
|
and CronJobDetail.Name like 'NFM503InfoFileSchedulex%'];
|
if (oldcron.size() == 0) {
|
System.schedule('NFM503InfoFileSchedulex' + CRON_EXP, CRON_EXP, new NFM503InfoFileSchedule());
|
}
|
for (CronTrigger ct :
|
[SELECT Id FROM CronTrigger WHERE State = 'DELETED'
|
and CronJobDetail.Name like 'NFM503InfoFileSchedulex%']) {
|
System.abortJob(ct.id);
|
}
|
}
|
public static void test() {
|
integer i = 0;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
i++;
|
}
|
}
|