Configure a specific SFSB state timeout in standalone.xml (JBOSS)

For my JEE 3.1 application, I have an SFSB for which I have set a specific timeout. I need to have easy access to this value so that it can be easily configured.

First I had an annotation in my SFSB class:

@StatefulTimeout(value = 2, unit = TimeUnit.HOURS)

      

This works as expected. But I need this value to be (easily) customizable. So I removed the annotation and put the following xml in my ejb-jar.xml. Again, this works as expected.

<session>
    <ejb-name>MyStatefulSessionBeanName</ejb-name>
    <ejb-class>foo.bar.MyStatefulSessionBean</ejb-class>
    <session-type>Stateful</session-type>
    <stateful-timeout>
        <timeout>2</timeout>
        <unit>Hours</unit>
    </stateful-timeout>
</session>

      

But ejb-jar.xml is packaged in .jar which is in my .ear app deployment. So my question is, can this setting be put in jboss standalone.xml file?

+3


source to share


1 answer


There is no easy way to do this without restarting the application.

If that's ok, you can define a system property in your standalone.xml. I recommend using the CLI or admin console for this purpose.

Then you can use the property values ​​in your ejb-jar.xml:



<stateful-timeout>
    <timeout>${my.session.timeout.value}</timeout>
    <unit>${my.session.timeout.units}</unit>
</stateful-timeout>

      

The property values ​​can then be updated via the web console or CLI and your application will restart.

+2


source







All Articles