本站首页    管理页面    写新日志    退出


«November 2025»
1
2345678
9101112131415
16171819202122
23242526272829
30


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7651815
建立时间:2006年5月29日




[Spring]使用MethodInvokingJobDetailFactoryBean
软件技术,  电脑与网络

lhwork 发表于 2006/6/30 16:14:03

Using the MethodInvokingJobDetailFactoryBean使用MethodInvokingJobDetailFactoryBeanOften you just need to invoke a method on a specific object. Using the MethodInvokingJobDetailFactoryBean you can do exactly this: 经常地,你仅仅需要调用一个对象的一个方法。使用MethodInvokingJobDetailFactoryBean,你可以正确地这样做: <bean id="methodInvokingJobDetail"   class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">    <property name="targetObject"><ref bean="exampleBusinessObject"/></property>    <property name="targetMethod"><value>doIt</value></property></bean> The above example will result in the doIt being called on the exampleBusinessObject (see below): public class BusinessObject {    // properties and collaborators    public void doIt() {    // do the actual work  }}    <bean id="exampleBusinessObject" class="examples.ExampleBusinessObject"/>   Using the MethodInvokingJobDetailFactoryBean you don't need to create one-line jobs that just invoke a method, and you only need to create the actual business object and wire up the detail object. 使用MethodInvokingJobDetailFactoryBean 你不需要创建一个在线的jobs,仅仅调用它的方法,你可以仅仅只需要创建一个实际的逻辑对象并且把它绑定到细节对象。 By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering with each other. If you specify two triggers for the same JobDetail, it might be possible that before the first job has finished, the second one will start. If JobDetail objects implement the Stateful interface, this won't happen. The second job will not start before the first one has finished. To make jobs resulting from the MethodInvokingJobDetailFactoryBean non-concurrent, set the concurrent flag to false. 缺省地,Quartz jobs是无状态的,在jobs的可能性作为结果影响彼此。如果你限定两个触发器为同一个JohDetail,它在第一个job已经完成时是可能的,第二个将会开始。如果JobDetail实现了状态接口,它将不会发生。<bean id="methodInvokingJobDetail"  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">    <property name="targetObject"><ref bean="exampleBusinessObject"/></property>    <property name="targetMethod"><value>doIt</value></property>    <property name="concurrent"><value>false</value></property></bean>   Note: By default, jobs will run in a concurrent fashion.


阅读全文(2132) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.141 second(s), page refreshed 144797621 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号