• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB Timer Services Query

 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although I don't know much about it, still IMHO, this may help-

1.
http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/4/html/Additional_Services-The_Timer_Service.html
http://java.sun.com/javaee/5/docs/tutorial/doc/bnboy.html

2. From the docs,
A Timeout method can have public, private, protected, or package level access. A Timeout method must not be
declared as final or static.

3. http://techdetails.blogmatrix.com/:entry:techdetails-2007-03-15-0001/

4. No (I think).
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
reply
    Bookmark Topic Watch Topic
  • New Topic