Start a process as soon as Application Server starts

Discussion in 'Java' started by nkunapa, Jan 18, 2006.

  1. nkunapa

    nkunapa Guest

    I have a process which is packaged in a JAR file and what it does is
    collect some statistics on the server and email it as soon as the
    Application Server (Tomcat/WebSphere...etc) starts automatically? Can
    this be achieved?

    Thanks.
     
    nkunapa, Jan 18, 2006
    #1
    1. Advertising

  2. nkunapa

    Larry Guest

    nkunapa wrote:
    > I have a process which is packaged in a JAR file and what it does is
    > collect some statistics on the server and email it as soon as the
    > Application Server (Tomcat/WebSphere...etc) starts automatically? Can
    > this be achieved?
    >
    > Thanks.


    Yes, you can. First, create a servlet and reference your process in
    the servlet's init() method. Then, in your web.xml file, put this line
    in your servlet's <servlet> definition block:
    <load-on-startup>1</load-on-startup> This will force the app server to
    load your servlet when it starts and the servlet's init() method will
    run as soon as the servlet is loaded, kicking off your process.

    Larry
     
    Larry, Jan 18, 2006
    #2
    1. Advertising

  3. nkunapa

    nkunapa Guest

    Thanks Larry for the information. In that case, will it possible for
    the same process to get kicked off say every 2 minutes. Also, add a
    check that if the previous process was still not finished don't start
    the subsequent process. Should all this be implemented in my code using
    Timer classes etc or is there any builtin functionality to achieve the
    same?

    Thanks.
     
    nkunapa, Jan 18, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jody Fisher
    Replies:
    0
    Views:
    497
    Jody Fisher
    Jul 29, 2003
  2. AW
    Replies:
    4
    Views:
    443
  3. Replies:
    2
    Views:
    332
    Larry
    Dec 21, 2005
  4. etam
    Replies:
    7
    Views:
    354
    Luke Meyers
    Jan 9, 2006
  5. Satish Talim
    Replies:
    0
    Views:
    143
    Satish Talim
    Dec 8, 2007
Loading...

Share This Page