• 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

Timer Services in EJb 3.0

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic