Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3 timer clarification

 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mike Degteariov
Ranch Hand
Posts: 145
8
Java Mac MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Isuru,

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

http://www.coderanch.com/how-to/java/HowToAskQuestionsOnJavaRanch

I would highly recommend you the following two sections in particular - "ShowSomeEffort" and "SearchFirst"
http://www.coderanch.com/how-to/java/ShowSomeEffort
http://www.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
 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mike Degteariov
Ranch Hand
Posts: 145
8
Java Mac MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Isuru Samaraweera
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic