• 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

Scheduling jobs with the web container

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
We have the requirement to schedule regular tasks when the application starts. We are doing this by using TimerTasks and the Timer class to create background threads. This process works fine. Our problem is that the task doesn't seem to be able to get a hold of local references for either resources or ejbs.
Does anyone have any suggestions?
Thanks,
Steve
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, that will be a problem because the threads arent' running in a J2EE component context. You might be better off putting your Timer class and threads in a separate process that calls Servlets to invoke the processes.
Kyle
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My suggestion is to have your Timer drop off a JMS message and have an MDB waiting to consume it. The MDB can then invoke the necessary EJBs.
This of course is assuming you are using EJB 2.0.
[ January 23, 2003: Message edited by: Chris Mathews ]
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a good suggestion -- avoids the tedious messing around with URLConnection that my suggestion entailed.

Kyle
 
Steve Granton
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks for the suggestions - we'd toyed with the idea of making a request to the servlet but as you say its a bit nasty. The MDB is a good example but we are not using them - WAS4.0.3
Thanks for the suggestions. We've managed to get it working with global names - not ideal but a work around.
Cheers,
Steve
 
reply
    Bookmark Topic Watch Topic
  • New Topic