首页 > 其他 > 详细

018_异步_Schedule

时间:2017-03-01 16:24:04      阅读:194      评论:0      收藏:0      [点我收藏+]

类似于Windows Schedule Job;

有两种方式的用法:

直接上代码:

①:

public class AccountSchedula implements Schedulable {
    public void execute(SchedulableContext sc) {
        System.debug(‘ceshi schedula‘);
      
    }
}

测试:@isTest
public class TestAccountSchedule {
static testMethod void myUnitTest() {
        String executeTime = ‘0 0 16 * * ?‘;
        AccountSchedula goodsSchedule = new AccountSchedula();
        System.schedule(‘batch goods‘,executeTime,goodsSchedule);
    }
}

直接run test 便可以看到Log 上的debug信息

  ②:

global class dldcApprovalofTimecardScheduled implements Schedulable {
    global static void execute(SchedulableContext sc) {
        dldc_Timecard_Approval_Reminder.Approval();
    }
}



global class dldc_Timecard_Approval_Reminder{


    global static void Approval() {
    }
}

  在Apex class 中找到dldcApprovalofTimecardScheduled  并且点击schedula ,在页面上上就可以设置执行的时间,不过都是半点或者是整点,看个人喜好选择这两种方式

 

018_异步_Schedule

原文:http://www.cnblogs.com/bandariFang/p/6484704.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!