异步APEX函数注意事项

Things to Remember
Future methods are a great tool, but with great power comes great responsibility. Here are some things to keep in mind when using them:

  • Methods with the future annotation must be static methods, and can
    only return a void type.
    必须是静态方法,只能返回void

  • The specified parameters must be primitive data types, arrays of
    primitive data types, or collections of primitive data types; future
    methods can’t take objects as arguments.
    指定的参数必须是原始类型,原始类型的数组,原始类型的集合,
    不能把objects作为参数

  • Future methods won’t necessarily execute in the same order they are
    called. In addition, it’s possible that two future methods could run
    concurrently, which could result in record locking if the two methods
    were updating the same record.
    future methods执行的顺序不一定是他们调用的顺序
    也有可能两个 future methods同时执行,如果两个method修改同一条数据
    ,记录可能被锁

  • Future methods can’t be used in Visualforce controllers in
    getMethodName(), setMethodName(), nor in the constructor.
    不能被用在Visualforce controllers in
    getMethodName(), setMethodName(), nor in the constructor.

  • You can’t call a future method from a future method. Nor can you
    invoke a trigger that calls a future method while running a future
    method. See the link in the Resources for preventing recursive future
    method calls.

  • The getContent() and getContentAsPDF() methods can’t be used in
    methods with the future annotation.

  • You’re limited to 50 future calls per Apex invocation, and there’s an
    additional limit on the number of calls in a 24-hour period. For more
    information on limits, see the link below.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值