1
我有@Schedule註釋創建一個TimerService,但我希望能夠通過在部署描述符標籤覆蓋分鐘參數。@Schedule註釋部署描述符標籤?
我在網上搜索了,但每一頁都指的TimerServices解釋@Schedule作爲註解。
可能嗎?這是錯的嗎?
在此先感謝
我有@Schedule註釋創建一個TimerService,但我希望能夠通過在部署描述符標籤覆蓋分鐘參數。@Schedule註釋部署描述符標籤?
我在網上搜索了,但每一頁都指的TimerServices解釋@Schedule作爲註解。
可能嗎?這是錯的嗎?
在此先感謝
這裏是一個ejb-jar.xml
片段eqivalent到@Scheduled
註釋:
<?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>DummyTimer4</ejb-name>
<ejb-class>org.glassfish.samples.DummyTimer4</ejb-class>
<session-type>Stateless</session-type>
<timer>
<schedule>
<second>*/10</second>
<minute>*</minute>
<hour>*</hour>
<month>*</month>
<year>*</year>
</schedule>
<timeout-method>
<method-name>timeout</method-name>
<method-params>
<method-param>javax.ejb.Timer</method-param>
</method-params>
</timeout-method>
</timer>
</session>
</enterprise-beans>
</ejb-jar>
參見:https://blogs.oracle.com/arungupta/entry/totd_146_understanding_the_ejb