-
1. ServletContextListener not called when shutdown
nickarls Jan 24, 2011 6:50 AM (in response to javatwo)It sounds like a bug. Have you tried with the 5.1-series?
-
2. ServletContextListener not called when shutdown
javatwo Jan 24, 2011 10:31 AM (in response to nickarls)it is JBoss 5.1.0.GA. my typo.
-
3. ServletContextListener not called when shutdown
nickarls Jan 24, 2011 11:00 AM (in response to javatwo)Then I would think it's JIRA time. I assume the shutdown hook should still be the same. Some RedHattian can shoot it down later if they disagree ;-)
-
4. ServletContextListener not called when shutdown
jaikiran Jan 24, 2011 11:25 AM (in response to javatwo)Any chance you could try this with 6.0.0.Final? The chances of getting this fixed (assuming it's a bug in JBoss AS) in 5.x series of community edition are nil. If it's reproducible in 6.0.0.Final, we can fix it in 6.0.1
-
5. ServletContextListener not called when shutdown
nickarls Jan 24, 2011 3:37 PM (in response to jaikiran)Not reproducable on 6.0 Final, the context destroyed listener is called (Windows 7, 1.6.0_23 64bit)
But on a semi-related note, pressing the stop button in Eclipse JBoss Tools kills off the server just like it would have killed the process, no shutdown is performed...
-
6. ServletContextListener not called when shutdown
javatwo Jan 24, 2011 9:19 PM (in response to nickarls)I am looking for a callback mechanism when a web application starts and stops. Unfortunately I can not move to JBoss AS 6 because of the tomahawk bug.
https://issues.apache.org/jira/browse/TOMAHAWK-1562
Is there other nice way to do it except ServletContextListener?
Thanks for help.
Dave
-
7. ServletContextListener not called when shutdown
nickarls Jan 25, 2011 1:12 AM (in response to javatwo)Well, there is the JSF 2 PreDestroyApplicationEvent or then you could use @PreDestroy on application scoped components etc but unfortuntately EE doesn't have any standard startup/shutdown events yet. Not that those help if the shutdown hooks are never called...
-
8. ServletContextListener not called when shutdown
javatwo Feb 4, 2011 4:23 AM (in response to nickarls)I tried Runtime.getRuntime().addShutdownHook(...), and got the same result.
CTRL + C: worked.
net stop jboss: shutdown hook not called.
Is this related to shutdown.bat since it is called for windows service when "net stop jboss" is executed?
Thanks,
Dave
-
9. ServletContextListener not called when shutdown
javatwo Feb 4, 2011 4:26 AM (in response to javatwo)public class ShutdownHook extends Thread {
@Override
public void run() {
System.out.println("=============System stopped ==============");
try {
File file = new File("d:\\log.txt");
PrintWriter writer = new PrintWriter(new FileOutputStream(file));
writer.println("system stopped " + new Date());
writer.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
-
10. ServletContextListener not called when shutdown
nickarls Feb 4, 2011 6:20 AM (in response to javatwo)Not so sure about that since I saw a clean shutdown from service on a Windows host on AS 6.
-
11. ServletContextListener not called when shutdown
javatwo Feb 5, 2011 8:31 AM (in response to nickarls)I like to look at source code to see how JBoss 5.1.0 shutdown works, it is JMX bean.
I checked out 5.1.0 source
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBoss_5_1_0_GA
but I could not find its source code. Which class takes care of shutdown on server side?
Thanks,
Dave -
13. ServletContextListener not called when shutdown
javatwo Feb 5, 2011 1:46 PM (in response to nickarls)that is the jmx client. I like to see how the shutdown is handled in server side? does it call hooks? etc.
Thanks for reply. Dave
-
14. ServletContextListener not called when shutdown
nickarls Feb 5, 2011 3:16 PM (in response to javatwo)org.jboss.deployment.scanner.AbstractDeploymentScanner is the only place where I can find a shutdown hook that does something reasonable (the other is in PasswordTool) but I don't think that's the "general" one...