-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 André,
On 8/9/18 6:22 PM, André Warnier (tomcat) wrote: >> The problem remains though : Under Windows, a Service has a >> single executable, which Windows starts when starting the >> Service, and then waits for that executable to send back a >> message indicating that the Service has properly started. >> Similarly, to stop the Service, Windows sends a message "please >> stop" to that running executable, and waits for the executable to >> acknowedge that it is stopping. With Tomcat, this executable is >> "tomcatV.exe" (the renamed Apache Common wrapper). To my >> knowledge, there is no provision in Windows for starting a >> service by running one executable, and stopping it using >> *another* executable. This is true, but tomcatV.exe actually handles this correctly. But there is a difference between "java" and "jvm" modes. Go back and read Mark's message about it carefully, again; I had to do so myself before I understood why it will work by switching modes. >> So your suggestion above is indeed not usable for the Windows >> Service context. Correct. Even a self-contained "Tomcat-stopping win32 program" wouldn't work in a Windows-service-context. >> And thus, for stopping the Tomcat Service, the user is stuck >> with tomcatV.exe, which uses the *same* JVM command-line >> parameters whether it is to start or to stop tomcat. Unless "jvm" mode is used. >> A solution would be to add a separate options box to the >> "Startup" and "Shutdown" tabs of the tomcat9w.exe dialog for >> "additional JVM options at start" and "additional JVM options at >> stop" (and of course all the associated plumbing in the wrapper >> code). But I guess that this would go in the category of >> "enhancement request". Correct, but "jvm mode" should work with existing features. >> I've seen Mark's previous answer, which seems to indicate that >> there is actually another way, but I must confess that I did not >> understand it. If you use "java" mode, this is what happens: Service launch: 1. Windows Service Manager invokes tomcatV.exe 2. tomcatV.exe reads registry for config 3. tomcatV.exe invokes "java [params] o.a.c.Bootstrap start" Service shutdown: 1. Windows Service Manager invokes tomcatV.exe 2. tomcatV.exe reads registry for config 3. tomcatV.exe invokes "java [params] o.a.c.Bootstrap stop" You see the problem because "[params]" are the same in both cases, and the JMX port (and any other Java-specified ports, such as a profiling agent, etc.) conflict. If you use "jvm" mode, this is what happens: Service launch: 1. Windows Service Manager invokes tomcatV.exe 2. tomcatV.exe reads registry for config 3. tomcatV.exe launches an in-process JVM with "[params]" and then calls o.a.c.Bootstrap.main("start") Service shutdown: 1. Windows Service Manager invokes tomcatV.exe 2. tomcatV.exe reads registry for config 3. tomcatV.exe calls o.a.c.Bootstrap.main("stop") on the already-running in-process JVM In the "jvm mode" case, only one JVM is launched for the start/stop sequence instead of one JVM for each of start, stop. So he port-conflict is avoided, and the system is more efficient (launching a JVM is pretty expensive). - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlttvsEACgkQHPApP6U8 pFgnThAAvZXka+FYgjiJYM+RfYoBOuAwsym44WyToFo7JAAXhMzzIDM8CY6ZceOs ZojWLcCAYCzDjiBhuEh2KdUfnaelrUPG0451jj0cBqNe6kkSXZ4soS27t+uyUSKG SPx8u+j5CtHsvEhC5TwwBAVe9dLZ2kD4s8y14R7o3A/sbwim7kgKOw4cA7BdrrmT 0jK4+ce6d1vv5edTkU84HnjNx4y96jbr4/uKBOa+qPYgHeYct84/ADKXn4dZcce6 lliiPu6kGWOvpu04kqqSqwVY3KrcT91q5aXJ8UYyiSbOr+cj+HP4GhDy+Dxdnoze Kzi+9V7bqkSa9g995kED4v3mRTfg76dRjuxnHbw1hGThkCO5Pi3MJQOjaUfs1XMo EgT/OLvRqPQlYvi3S1r36QzDBCKh1LVyDntSMIiJn0ilthrwHJfhiPRH6n9jb7Gp egP3tb+s6LJp15uA8noyTBTBVlOwFE8Kw8XXyEtwOE7cW0QJQXpJSkbatJqsHB94 v10a37SuagkkzaJugGfey6Vcg9oGjWWjENIxB7yK2dZHm1+cm263/9Qmi37WVj4d KWMdghzoazdOxvK5ntFi2hOs0kdQ3v+EgxWQR9FKJz73piIvsIleVE3v4B49W5oh nTM/eJtOwJcoYdLG3ljNpND61BvpjuFCm9JUbWizFgJMu6OjY2k= =F5zk -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org