Singleton Bean's @Schedule method run multiple times
jodt May 8, 2013 7:15 PMI have the following bean that is annotated with @Startup @Singleton and has a method annotated that runs every 5 minutes. The issue I have is when the scheduled method is run by jboss it's running it 10 times. I believe this is because in the standalone.xml the timer-service section has the thread-pool of default which has a max-thread-count of 10. What I'd like is for it to run the scheduled method once. I thought that I could change the pool size but if I do that it means I've changed the pool size for all timer-services which I don't want to do. In the end it seems like regardless of the pool size JBoss shouldn't run my scheduled method multiple times especially since its marked as a singleton. Any help or suggestions would be appreciated.
@Startup
@Singleton
public class MyBean {
@Schedule(second = "*", minute = "*/5", hour = "*", info = "Report every 5 Minutes",persistent = false)
public void report() {
//Report info
}
}
My standalone.xml has the following configuration for ejb3 subsystem:
<subsystem xmlns="urn:jboss:domain:ejb3:1.3">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="hornet-ra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="ecs-listener-mdb-pool" max-pool-size="10" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="SECONDS"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple" aliases="NoPassivationCache"/>
<cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
</caches>
<passivation-stores>
<file-passivation-store name="file"/>
</passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
</timer-service>
<remote connector-ref="remoting-connector" thread-pool-name="default"/>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
<iiop enable-by-default="false" use-qualified-name="false"/>
</subsystem>