[EJB/JBoss] - How EJB timer works
by cristi_cioriia
Hi,
I have used a timer that repeatedly fires with a given frequency and detected a behavior that seems strange to me. So I would like to ask your opinion about this.
I have a timer that expires every 3 minutes. The timer fires as I expected for the first times:
anonymous wrote :
| 19:10:00,484 INFO [AlertServiceEJB] Executing timer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=wise-ear.ear,jar=wiccore-alert.jar,na
| me=AlertServiceEJB],remaining=180000,periode=180000,in_timeout]
| 19:10:00,484 INFO [AlertServiceEJB] Remaining time: 180 Next timeout: Wed Mar 12 19:13:00 GMT 2008
| 19:13:00,484 INFO [AlertServiceEJB] Executing timer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=wise-ear.ear,jar=wiccore-alert.jar,na
| me=AlertServiceEJB],remaining=180000,periode=180000,in_timeout]
| 19:13:00,484 INFO [AlertServiceEJB] Remaining time: 180 Next timeout: Wed Mar 12 19:16:00 GMT 2008
| 19:16:00,500 INFO [AlertServiceEJB] Executing timer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=wise-ear.ear,jar=wiccore-alert.jar,na
| me=AlertServiceEJB],remaining=179984,periode=180000,in_timeout]
| 19:16:00,500 INFO [AlertServiceEJB] Remaining time: 179 Next timeout: Wed Mar 12 19:19:00 GMT 2008
|
After this I stopped the server and started it again and this is what I got:
anonymous wrote :
| 19:16:42,000 INFO [AlertServiceEJB] Executing timer:
| [id=1,target=[target=jboss.j2ee:service=EJB3,ear=wise-ear.ear,jar=wiccore-alert.jar,na
| me=AlertServiceEJB],remaining=-221516,periode=180000,in_timeout]
| 19:16:42,015 INFO [AlertServiceEJB] Remaining time: -221 Next timeout: Wed Mar 12 19:13:00 GMT 2008
| 19:19:41,937 INFO [AlertServiceEJB] Executing timer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=wise-ear.ear,jar=wiccore-alert.jar,na
| me=AlertServiceEJB],remaining=-221453,periode=180000,in_timeout]
| 19:19:41,937 INFO [AlertServiceEJB] Remaining time: -221 Next timeout: Wed Mar 12 19:16:00 GMT 2008
So, when the server is restarted the timer is fired like it had never fired previously: the Next timeout value is 19:13 and the remaining value is -221 = -(3 * 60 + 21) which subtracted from 19:16:42 gives 19:13 again.
This is very awkward to me. I would have expected that the timer was persisted in such a way that only missed firings will be fired at server restart. Since I stopped the server after the timer fired and started it before the next time the timer was supposed to fire, I would expect that nothing happens at server startup, because the timer did not missed any firings.
Another thing that I have noticed is that when the timer is persisted the information that was associated to the timer when the timer was persisted is also persisted, but if this information is changed when the timer fires, this change is not persisted and at server restart the timer uses the information from creation time.
Is there any way to change this behavior(by configuration) or this is the expected behavior? I use JBOSS 4.2.1.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136252#4136252
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136252
18 years, 1 month
[JBoss AOP] - Re: AOP configuration in ejb3-interceptors-aop.xml
by kabir.khan@jboss.com
"maralcbr" wrote :
| <annotation expr="!class((a)org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class((a)org.jboss.annotation.ejb.Clustered)">
| | @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
| | @org.jboss.annotation.ejb.Clustered(loadBalancePolicy=org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies.class)
| | </annotation>
|
| This block would add the do tags defined inside if CacheConfig tag is not found on the Bean and Clustered tag is found on the bean?
|
Yes, it would add the @CacheConfig, and override the @Clustered annotation. I am not sure if what you have posted would work or if you should do the following instead
<annotation expr="!class((a)org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class((a)org.jboss.annotation.ejb.Clustered)">
| @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300, removalTimeoutSeconds=0)
| </annotation>
| <annotation expr="!class((a)org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class((a)org.jboss.annotation.ejb.Clustered)">
| @org.jboss.annotation.ejb.Clustered(loadBalancePolicy=org.jboss.ha.framework.interfaces.FirstAvailableIdenticalAllProxies.class)
| </annotation>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136251#4136251
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136251
18 years, 1 month