This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Timer Services in EJb 3.0

 
Amar Deep Singh Chaudhary
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
ranchers

i have written a Ejb Timer in the Ejb 3.0. I want to know that where this timer is registered in the Application and how i can change the time of invocation of the method. When i change the time in my code it does't make any effect on scheduler. I am using J Boss 4.0.0GA as application Server.


Amar Deep Singh Chaudhary amardeep@amardeep.100webspace.net
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amar,

The timers are usually stored in memory and can be persisted to a table (if that's how you have it configured in Jboss). Can you post the part of the code where your are creating the timer and subsequently scheduling it?
 
Amar Deep Singh Chaudhary
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am sending here the code by which i am creating the Timer and The Function Which i am calling By the Timer.

//function to create timer

public void createSheduleMaintenance() throws PisException,Exception
{TimerService timer=ejbContext.getTimerService();
Calendar now=Calendar.getInstance();
timer.createTimer(now.getTimeInMillis()+1*60*1000, 24*60*60*1000,"hi");

}


// method to execute after time expires

@Timeout
public void monitorearing(Timer timer)
{
// my Code to perform some Operation
}
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just of future reference you should put your code inside [ CODE ][ /CODE ] (remove the spaces to enable the tag) tags.

Take a look at the following line:



When do you think that is going to trigger? (Hint it's a long time from now)

[ September 04, 2008: Message edited by: Martijn Verburg ]
[ September 04, 2008: Message edited by: Martijn Verburg ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic