aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Timer Services Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Timer Services Query" Watch "EJB Timer Services Query" New topic
Author

EJB Timer Services Query

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Mayur Somani
Greenhorn

Joined: Apr 14, 2008
Posts: 26
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

Joined: Aug 03, 2008
Posts: 9280
    
  17

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Timer Services Query
 
Similar Threads
Bug in Weblogic 10? - TX concurrency
ejb as abstract ?
EJB Timer issue
Timer are persisted
Need to restart timer with different time