Discussions

Web tier: servlets, JSP, Web frameworks: How to schedule a servlet process in j2ee

  1. How to schedule a servlet process in j2ee (3 messages)

    can some tell me how to schedule a servlet process in j2ee application?
  2. You could write a .sh script called by cron.
  3. A good and hot dicussion is available at http://bnewport.typepad.com/devwebsphere/2003/09/j2se_timer_lets.html ( if you havent already gone through it).

    After going through that and with my personal experience, i agree with the fact that there isnt a good implementation of scheduling tasks in a well managed fashion in J2EE. If you have to make a decision, go by J2EE timer. Reason being atleast the application server vendors will keep the J2EE timer portable as a part of J2EE1.4 spec. Of course to use this option you need to have a J2EE1.4 compatible server.

    Another option is to get the even generated by a system outside your J2EE server. Eg. cron jobs. A client program executed by cron can send the event to J2EE server using a dedicated servlet. This keeps the event generation completely out of the app server and lets you manage state/frequency external to the server.
  4. Thank you Ashok.
    Do you have an example of how to use Timer class