This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Well I have a few questions on EJB Timer Services. I hope someone can help me. I searched on google and in this forum but didn't find any solutions. So these are my questions
1. I have jBoss as my application server where I need to start a timer service. Now I just created a stateless session bean and injected the timer service into it and I am calling the timer service on application startup by using a servlet which is loaded on startup to make a call to the timer service bean. There is no exception in the timer service startup but the timeout method is not getting called. Do I need some extra configurations to implement the timer service??
2. Can I make my timeout method private or protected??
3. Also I don't want the timer service to be persisted because I am starting the service on application startup already. I have not made any configurations for this so I think that the timer service will not sustain a server shutdown but still I want to confirm it.
4. If I set the first occurrence of the timer service to a time that has passed like 2 minutes ago, then will the timer service be called or not??
This is my code for the timer service
Now I can see "timer service started" on the jboss console but "starting work" doesn't get displayed meaning that timer service is not started.
Someone just give me a kick in my butt . cal2.getTimeInMillis() + 15000 was creating the problem. If you provide the first argument as milliseconds, then it is the delay in milliseconds from the current time to the first timeout. So my timeout would come after about 39 years (i.e. the time between 1Jan 1970 to 2009).
Thanks mayur for the help . For the fourth one I tried my timer with a past date and it fired a timeout right when I called createTimer so if you provide a timeout time which has expired, then the timeout event will occur. I still can't believe I made such a silly mistake. Anyways thanks again mayur...