Forums Register Login

EJB3 timer clarification

+Pie Number of slices to send: Send
Hi All,

Are ll types of session beans supporting timer service?As per my understanding only stateless session bean supports it.

Also if i say When the server is shut down, the timer is persisted automatically and becomes active again
when the server is restarted can i consider as a true statement?

As per my understanding this is true only for persistent timers and you can easily disable persistent property programmatically.


Please clarify above?

Thanks,
Isuru
+Pie Number of slices to send: Send
Hello Isuru,

Please kindly familiarize yourself with the following very important topic on the coderanch site:

https://coderanch.com/how-to/java/HowToAskQuestionsOnJavaRanch

I would highly recommend you the following two sections in particular - "ShowSomeEffort" and "SearchFirst"
https://coderanch.com/how-to/java/ShowSomeEffort
https://coderanch.com/how-to/java/SearchFirst

I am only recommending this, since the information you are asking about is readily available in "Java EE 6 Tutorial" and can be found by everyone with minimal effort.
http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html

--
Have a wonderful day,

Mike
+Pie Number of slices to send: Send
Hi Mike,
Thanks for the reply.Yes I also read this material.However in the exam I faced unanswerable question.It was so hard to choose 2 out of 4 options.

So according to the article only stateless beans supporttimerservice .So we can discard the statement "all types of session beans supports timers"

My second claim is if i say "timers are persisted automatically and become active when server is started" ,it is also wrong.

Programmatically you can disable the persistent=true flag( TimerConfig.setPersistent(false)).

So I could chose only 1 option out of 4 properly and above 2 statements were confusing and remaining option was definitely wrong.

Any clue on how to choose in between above 2?

Thanks,
ISuru
+Pie Number of slices to send: Send
Hello Isuru,


You said

My second claim is if i say "timers are persisted automatically and become active when server is started" ,it is also wrong.



This is in obvious contradiction with "The Java EE 6 Tutorial" - please make 100% certain you read and understood what is in there ?


Timers are persistent by default. If the server is shut down or crashes, persistent timers are saved and will become active again when the server is restarted. If a persistent timer expires while the server is down, the container will call the @Timeout method when the server is restarted.



--
Cheers, Mike
+Pie Number of slices to send: Send
Hi Mike,
Thanks again for the reply.Question does not specify about default configuration.
In case timer is created with TimerConfig.setPersistent(false) my claim is correct.


I think there is some thing is missing in the statement "timers are persisted automatically and become active when server is started"

This should be corrected as" timers are persisted automatically and become active when server is started under default configurations"


Thanks,
Isuru
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 581 times.
Similar Threads
Invoking Timer methods from stateful/stateless session bean
session bean versus entity bean
Java EE timer service and periodical jobs
Invocation of a TimerService
WebMethod and statefull session bean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:00:17.