Re: Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded
Hi there, 2009/4/6 Caldarale, Charles R chuck.caldar...@unisys.com: The metaphysical implications of existing without a trace are rather intriguing... Yeah, I was about to call Mulder and Scully to investigate it, but I thought I'd give the user list a chance first. Looks like it. In Tomcat 5.5, there was a non-daemon thread for each Connector named http-port-Monitor; this thread no longer exists in 6.0, since the whole area appears to have been re-architected. There are no non-daemon threads in Tomcat 6.0, other than the whatever thread gets the game started; the normal Tomcat bootstrap uses this lead thread to listen on the shutdown port. You'll need to have some thread hanging around to keep the JVM from terminating; if you don't have such a thread, why are you bothering with embedded? I usually ran the app with the GUI, but sometimes it is useful to ran it without, specially during development and testing of new containers, as I don't have to wait for the Windows to open. I did not know it was disallowed. OTOH, if I did not want my app to start alive, why would I have started a server listening in a port? I use embedded to test web applications and to run them inside Ant so I can perform integration tests on them within Ant, so the GUI part is optional. if I start the server with a GUI window, so the container remains alive due to the GUI thread, stopping the server does not really work, as even though it says that the Connector stopped, I can still access the server for some seconds and then it starts answering resource not available, but the thing is, it still answers to the port. It's your responsibility to terminate your GUI thread so the JVM can kill off all the daemon threads. Do you mean that the stop() method on the Server class is useless and in order to stop the embedded server I have to kill my whole application? That doesn't make much sense. You really use this. everywhere? Seems a bit tedious, to say nothing of making code reviews difficult. this is added automatically by the IDE and in this case, it helps me distinguish between the objetcs that are created on the start method and the ones I have to keep a reference to. You have to change your code; you got lucky in 5.5. To me it makes more sense the 5.5 behaviour, but oh well :). In any case, not being able to stop the server normally without killing my whole application is really a non-no for me. Yes, the doc could be improved here. You could create a FAQ/Wiki entry based on your findings. Once I get a clear picture, I'll try to. - Chuck Thanks for your help, D. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded
From: d.lope...@gmail.com [mailto:d.lope...@gmail.com] On Behalf Of Daniel Lopez Subject: Tomcat 5.5 embedded vs Tomcat 6.0.18 embedded when my other threads finish, the container simply exists without a trace. The metaphysical implications of existing without a trace are rather intriguing... I've seen a thread in the tomcat-dev list (embedded tomcat 6 14 Feb 2008) that seems to imply this is normal with Tomcat 6, but in Tomcat 5.5 this did not happen. Is this normal? Looks like it. In Tomcat 5.5, there was a non-daemon thread for each Connector named http-port-Monitor; this thread no longer exists in 6.0, since the whole area appears to have been re-architected. There are no non-daemon threads in Tomcat 6.0, other than the whatever thread gets the game started; the normal Tomcat bootstrap uses this lead thread to listen on the shutdown port. You'll need to have some thread hanging around to keep the JVM from terminating; if you don't have such a thread, why are you bothering with embedded? if I start the server with a GUI window, so the container remains alive due to the GUI thread, stopping the server does not really work, as even though it says that the Connector stopped, I can still access the server for some seconds and then it starts answering resource not available, but the thing is, it still answers to the port. It's your responsibility to terminate your GUI thread so the JVM can kill off all the daemon threads. The code looks like this: -- this.theEmbedded = new Embedded(); this.theEmbedded.setCatalinaHome(new File(tomcat_6).getAbsolutePath()); // Add the engine this.engine = this.theEmbedded.createEngine(); this.engine.setName(Catalina); this.engine.setDefaultHost(localhost); // Create the host this.host = this.theEmbedded.createHost(localhost, .); this.engine.addChild(this.host); this.theContext = this.theEmbedded.createContext(/, this.theConfiguration.getBasePath()); this.theContext.setReloadable(false); this.host.addChild(this.theContext); this.theEmbedded.addEngine(this.engine); // Add a conector this.connector = this.theEmbedded.createConnector((java.net.InetAddress) null, this.port, false); this.theEmbedded.addConnector(this.connector); this.theEmbedded.start(); You really use this. everywhere? Seems a bit tedious, to say nothing of making code reviews difficult. So, is the Tomcat 6 embedded engine broken or do I have to change the code? You have to change your code; you got lucky in 5.5. Nothing in the API seemed to indicate any changes needed Yes, the doc could be improved here. You could create a FAQ/Wiki entry based on your findings. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org