Running background application in servlet container

Discussions

Web tier: servlets, JSP, Web frameworks: Running background application in servlet container

  1. Hi,
    I would like to integrate an existing multi-threading Java application in Tomcat (or other servlet container) in order servlets and web services have access to share memory data and services of this application. Is it possible to launch this application in the server background ? And how ?
    A standalone
    Thanks a lot,
    Antoine
  2. Hello Antoine,

    You are allowed to create new thread in the servlet container, so you can integrate your application inside a servlet and startup this servlet automatically, this will have for effect to start your threadpool.

    This is how we have been integrating the Quartz Scheduler, that has its own threadpool, in J2EE Applications.

    This article about Quartz integration to J2EE, and OC4J will probably guide you in the right direction.

    Hope that helps.../

    Regards
    Tugdual
  3. Thanks a lot Tugdual for your interesting answer. Its exactly the information I searched.
    If I accurately understand you and the article you have reference, I have to pack all the logical of my application in a GenericServlet that will automatically be start as soon as the servlet container is started. From this servlet, do you confirm me that I can launch a pool of Java threads that done a lot of cron job ? And do you know if this features is available on all servlet containers ? Moreover, in the "Quartz integration to J2EE" article you speak about "User Threads" and I don't know what do you mean ?
    Regards,
    Antoine
  4. hello,
    i am developing a project called auto responder which has to send mails to the appropriate person based on today's date and date when he subscribed to the auto responder.I have written a program using TimerTask.
     But i want to use quartz.Please can u provide me some sample snippets as i am a beginner.
    Should we use only an ejb to write the code which we want to schedule?where to place the quartz files.I am using tomcat.after downloading quartz where ,how should i integrate those files with tomcat.please give a clear idea.
    thank u for ur help.