ServletContext lifecycle

Discussion in 'Java' started by Joe Attardi, May 17, 2006.

  1. Joe Attardi

    Joe Attardi Guest

    Am I correct in the assumption that an instance of ServletContext
    associated with one particular web application will remain "alive"
    during the entire life of the application?

    I previously had some setup/cleanup code in the init() and destroy()
    methods of a servlet, but since the container is free to discard and
    re-initialize a servlet instance, my cleanup code was being called
    while the application was still running.

    If I move this code to a ServletContextListener, will the
    contextInitialized and contextDestroyed only be called once for the
    lifetime of the application?
     
    Joe Attardi, May 17, 2006
    #1
    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. iksrazal
    Replies:
    1
    Views:
    609
  2. Rick Roberts
    Replies:
    0
    Views:
    386
    Rick Roberts
    Aug 10, 2003
  3. RJGraham
    Replies:
    3
    Views:
    3,325
    Huang Kai
    Nov 27, 2003
  4. natG
    Replies:
    6
    Views:
    614
  5. Replies:
    2
    Views:
    10,343
Loading...

Share This Page