steph maybe

Greenhorn
+ Follow
since Apr 12, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by steph maybe

found a partial solution / work-around.

recall that i was looking for a hook that's launched at application-stop (similar to the Runtime shutdown hook that is called upon server-stop).
in other words, a method that's automatically called upon application-stop.

it turns out that application-stop launches the Garbage Collector, or at least it does in the tests that i've done.
i think the GC will call the destroy() method on all your loaded servlets.

so it suffices to add a destroy() method to a servlet, and there you have your application-stop hook.

so i wrote a simple servlet that launches upon application-startup (web.xml : <load-on-startup>1</load-on-startup>) and its destroy() method redefines a static boolean in a Singleton class that i've added as a condition to my while loop above.

when i do an application-stop in weblogic, the GC is launched, the destroy() is called, the boolean is redefined, the while loop stops, and we're golden.


i tried the same test and it seems that executeAction() can execute after application-undeploy (maybe it depends on what that method does).

my application is able to query an oracle database via JDBC and print the results in a file AFTER having been "undeployed" in Weblogic !



seems to me that it's unsafe to undeploy an application in Weblogic unless you follow that by stopping/restarting the application server.

anyone care to share their experience with this or any explanations ?
anyone have a suggestion on how to make my application stop upon undeploy ?

another thing ...

if your servlet does this :


Then upon application-undeploy, the servlet will keep writing until we reach time t, but then once we reach time t, the servlet will stop writing, leave the while loop, and ... do nothing ! That is, it does not call executeAction().

So what exactly is application-undeploy ?
It leaves your application running, sort of ?
It allows certain actions (looping, writing to files), but not others ?

I'll be very grateful to anyone who can explain this to me, I've gone through all of Oracle-BEA-Weblogic docs and can't find a straight answer.
I have the same problem in Weblogic 8 and Weblogic 10.

What I found is that if you have a servlet in you deployed .ear file that does :



then...
the servlet will continue writing to sysout after you stop the ear.
the servlet will continue writing to sysout after you undeploy the ear.
the servlet will finally stop writing when you shutdown the application server.

The proposed shutdown-hook solution is not useful here because the hook will only be called upon server shutdown.

Anyone know of a hook that can be called at the moment of the application-stop (or at the very least at the moment of the application-undeploy) ?

Seems to me a pretty huge breach in weblogic, the fact that your application will effectively keep running after you stop it and even after you undeploy it !

Comments & suggestions are welcome ...