java - How do I define only scheduler attribues in the deploymnet descriptor, not the whole bean? -
i have following bean:
@stateless public class newsessionbean { public void myjob() { system.out.println("run"); } } and have myjob running every 10 seconds, have deployment descriptor:
<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>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 works.
but declare timer in deployment descriptor, not whole bean can declare using annotations , parametrize schedule.
if remove ejb-class or session-type application won't load because dd missing information.
is there anyway can override information scheduler only?
edit: move set parameters on @schedule annotation deployment descriptor can change values without needing recompile/redeploy
Comments
Post a Comment