I have the following bean:
@Stateless
public class NewSessionBean {
public void myJob() {
System.out.println("RUN");
}
}
and I would like to have myJob running every 10 seconds, so I have this Deployment descriptor:
<ejb-jar xmlns = "http://ift.tt/nSRXKP"
version = "3.1"
xmlns:xsi = "http://ift.tt/ra1lAU"
xsi:schemaLocation = "http://ift.tt/nSRXKP
http://ift.tt/1zK8E6E">
<enterprise-beans>
<session>
<ejb-name>NewSessionBean</ejb-name>
<ejb-class>org.test.NewSessionBean</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>myJob</method-name>
</timeout-method>
</timer>
</session>
</enterprise-beans>
</ejb-jar>
And it works.
But I would like to declare only the timer in my deployment descriptor, not the whole bean so I can declare everything using annotations and parametrize the schedule.
If I remove the ejb-class or session-type my application won't load because the DD is missing this information.
Is there anyway that I can override the information for the scheduler only?
Edit: I would like to move set the parameters on the @schedule annotation to the deployment descriptor so I can change its values without needing to recompile/redeploy anything
Aucun commentaire:
Enregistrer un commentaire