Juan Romero
Juan Romero

Reputation: 59

@Schedule annotation deployment descriptor tag?

I have a TimerService created with @Schedule annotation, but I want to be able to overwrite the minute parameter via a tag in the deployment descriptor.

I searched the web for it, but every page refering to TimerServices explains the @Schedule as an annotation.

Is it possible? is it wrong?

Thanks in advance

Upvotes: 1

Views: 945

Answers (1)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340733

Here is an ejb-jar.xml snippet eqivalent to the @Scheduled annotation:

<?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>

See also: https://blogs.oracle.com/arungupta/entry/totd_146_understanding_the_ejb

Upvotes: 2

Related Questions