【发布时间】:2014-02-18 16:37:39
【问题描述】:
我可以使用 XML 调用 EJB 调度程序(或者我可以使用 @Schedule 注释)。例如这样的:[ejb-jar.xml]
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<enterprise-beans>
<session>
<ejb-name>[name]</ejb-name>
<ejb-class>[path]</ejb-class>
<session-type>Stateless</session-type>
<timer>
<schedule>
<minute>*/30</minute>
<hour>*</hour>
<month>*</month>
<year>*</year>
</schedule>
<timeout-method>
<method-name>[method name]</method-name>
</timeout-method>
</timer>
</session>
</enterprise-beans>
</ejb-jar>
如果我需要每天午夜运行这个调度器,我应该写这样的东西吗?
<schedule>
<minute>*</minute>
<hour>0</hour>
<month>*</month>
<year>*</year>
</schedule>
如果我需要凌晨 1:00,这是否正确?
<schedule>
<minute>*</minute>
<hour>1</hour>
<month>*</month>
<year>*</year>
</schedule>
谢谢:)
【问题讨论】:
标签: jakarta-ee ejb ejb-3.0 quartz-scheduler ejb-3.1