Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Scheduling jobs with the web container  RSS feed

 
Steve Granton
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • 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
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!