Re: Thread Spawn - Weblogic

This is a discussion on Re: Thread Spawn - Weblogic ; Iam not getting what u mean by stopping the context... But what I suggest you is in the destroy() method of the servlet (which is bascially the destructor of the servlet ) you can interrupt (thread.interrupt() )the thread which was ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: Thread Spawn

  1. Re: Thread Spawn


    Iam not getting what u mean by stopping the context...
    But what I suggest you is in the destroy() method of the servlet (which is bascially
    the destructor of the servlet ) you can interrupt (thread.interrupt() )the thread
    which was spawned initially...

    pls let me know if my understanding was correct..
    Ref:http://java.sun.com/j2ee/sdk_1.3/tec....html#destroy()
    Thanks
    Perianayagam.T


    "TH Lim" wrote:
    >
    >Hi,
    >
    >What is the best way to spawn a thread when the servlet context starts
    >and terminates
    >when the context stops or ends in Weblogic 6.1? At the moment, I use
    >a startup
    >on load servlet to kick off a thread to start my background process.
    >This process
    >does a JDBC SELECT, performs some calculations and finally, JDBC INSERT
    >or UPDATE
    >resutls into a few tables. The problem I'm faing now is that when the
    >context
    >is stopped, the thread still running. Pls. advise. Thank you.
    >
    >/lim/



  2. Re: Thread Spawn


    I have set a flag to end the thread since interrupt() is deprecated. However, destroy()
    method is not called when I unload my webapp thru the admin console. Therefore,
    the thread still running after I have unload my webapp.

    "Perianayagam.T" wrote:
    >
    >Iam not getting what u mean by stopping the context...
    >But what I suggest you is in the destroy() method of the servlet (which
    >is bascially
    >the destructor of the servlet ) you can interrupt (thread.interrupt()
    > )the thread
    >which was spawned initially...
    >
    >pls let me know if my understanding was correct..
    >Ref:http://java.sun.com/j2ee/sdk_1.3/tec....html#destroy()
    >Thanks
    >Perianayagam.T
    >
    >
    >"TH Lim" wrote:
    >>
    >>Hi,
    >>
    >>What is the best way to spawn a thread when the servlet context starts
    >>and terminates
    >>when the context stops or ends in Weblogic 6.1? At the moment, I use
    >>a startup
    >>on load servlet to kick off a thread to start my background process.
    >>This process
    >>does a JDBC SELECT, performs some calculations and finally, JDBC INSERT
    >>or UPDATE
    >>resutls into a few tables. The problem I'm faing now is that when the
    >>context
    >>is stopped, the thread still running. Pls. advise. Thank you.
    >>
    >>/lim/

    >



+ Reply to Thread