Re: Post B6 modifications...
On Fri, 20 Jul 2001, Pier P. Fumagalli wrote: This patch actually starts fixing things, but doesn't break the build neither compromises functionality (checked it already), but I would like someone (Craig/Remy/Amy/Glenn...) to review it and, if ok, apply it... I do have two design quibbles: * The initialize() method you added throws LifecycleException, but you are not using the remainder of the Lifecycle family of APIs. This is not particularly clean, and the obvious answer would be to extend pre-start() support in the Lifecycle interface itself. However, this would require changes to roughly 50 classes -- way too big to do at this point in 4.0, so let's plan on that refactoring in 4.1. * I like symmetry :-), so shouldn't there also be some sort of shutdown() method that is called after stop() that corresponds to initialize() being called before start()? I'll be playing with the actual code itself today. Cheers... Pier (back from the cops) Craig
Re: Post B6 modifications...
On Fri, 20 Jul 2001, Pier P. Fumagalli wrote: This patch actually starts fixing things, but doesn't break the build neither compromises functionality (checked it already), but I would like someone (Craig/Remy/Amy/Glenn...) to review it and, if ok, apply it... I do have two design quibbles: * The initialize() method you added throws LifecycleException, but you are not using the remainder of the Lifecycle family of APIs. This is not particularly clean, and the obvious answer would be to extend pre-start() support in the Lifecycle interface itself. However, this would require changes to roughly 50 classes -- way too big to do at this point in 4.0, so let's plan on that refactoring in 4.1. Ok. * I like symmetry :-), so shouldn't there also be some sort of shutdown() method that is called after stop() that corresponds to initialize() being called before start()? Ok, but it wouldn't be that useful. I'll be playing with the actual code itself today. It doesn't do anything yet. I tested a bit by hacking the BootstrapService main method, and calling load / start / Thread.sleep / stop. Remy
Re: Post B6 modifications...
Craig R. McClanahan at [EMAIL PROTECTED] wrote: I do have two design quibbles: * The initialize() method you added throws LifecycleException, but you are not using the remainder of the Lifecycle family of APIs. This is not particularly clean, and the obvious answer would be to extend pre-start() support in the Lifecycle interface itself. However, this would require changes to roughly 50 classes -- way too big to do at this point in 4.0, so let's plan on that refactoring in 4.1. I know, and remembering from what you told me last month, I assumed it was better to just modify (now) only strictly where those modifications were needed. Anyhow, I would have 2 interfaces for Lifecycle, a base lifecycle only with start() and stop() and something extending it with (let's say) initialize() and shutdown() (or init() and destroy(), still thinking about naming). This because I wouldn't want to have ALL components to be allowed to have an initialization stage running as root under unix... * I like symmetry :-), so shouldn't there also be some sort of shutdown() method that is called after stop() that corresponds to initialize() being called before start()? Yeah. I'm playing around with the Service interface a little bit right now, and was thinking to change load() into init(), add another destroy() method. But that will have to be reflected also in the ServiceController... I dunno... Want to come up with a very simple and clean API, and there are some lifecycle issues I still want to clean up in my mind... I'll be playing with the actual code itself today. Cool... If you compile jsvc for RH71, then you should be able to run Catalina as nobody but bound to port 80 using Remy's ServiceLoader... Pier
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: * I like symmetry :-), so shouldn't there also be some sort of shutdown() method that is called after stop() that corresponds to initialize() being called before start()? Ok, but it wouldn't be that useful. I don't know... If Service looked somehow like: public interface Service() { public void init(...) throws ...; public void start() throws ...; public void stop() throws ...; public void destroy() throws ...; } We could allow the service to be started and stopped several times during the life span of the JVM process, as Win32 does with pause and continue in their Service stuff... Pier
Re: Post B6 modifications...
Pier P. Fumagalli at [EMAIL PROTECTED] wrote: This is the first set of modifications I made to the Catalina code to allow port 1024 binding under Unix. Basically, I added an initialize() method to Server, Service and Connector, and that gets called appropriately before start(). Now, the only thing left to do is to move the ServerSocket creation within connectors in initialize(), and launch Catalina with a wrapper around the Service code I committed last week. Basically, during load() in service, we build the whole components tree and call initialize() on the Server. Then during start() and stop() we call the same methods in Server, and (in theory) the trick should be done. I'd need to modify Remy's BootstrapService and CatalinaService to perform a two-stage initialization process (and I don't know what JavaService, the one he's using under Windows does), but, more or less, that should be it... This patch actually starts fixing things, but doesn't break the build neither compromises functionality (checked it already), but I would like someone (Craig/Remy/Amy/Glenn...) to review it and, if ok, apply it... Cheers... Since no one commented, I'm just going to commit, and if there's something wrong, we can always roll back... Pier
Re: Post B6 modifications...
Pier P. Fumagalli at [EMAIL PROTECTED] wrote: This is the first set of modifications I made to the Catalina code to allow port 1024 binding under Unix. Basically, I added an initialize() method to Server, Service and Connector, and that gets called appropriately before start(). Now, the only thing left to do is to move the ServerSocket creation within connectors in initialize(), and launch Catalina with a wrapper around the Service code I committed last week. Basically, during load() in service, we build the whole components tree and call initialize() on the Server. Then during start() and stop() we call the same methods in Server, and (in theory) the trick should be done. I'd need to modify Remy's BootstrapService and CatalinaService to perform a two-stage initialization process (and I don't know what JavaService, the one he's using under Windows does), but, more or less, that should be it... This patch actually starts fixing things, but doesn't break the build neither compromises functionality (checked it already), but I would like someone (Craig/Remy/Amy/Glenn...) to review it and, if ok, apply it... Cheers... Since no one commented, I'm just going to commit, and if there's something wrong, we can always roll back... Hi Pier, That sucks for you appartment :-(( Sorry, I've been in Santa Cruz friday, and then I forgot about your patch (since I was s happy that we released b6 in a clean state). So I didn't have a chance yet to complain about it ;-) Actually, I think it's ok, esp since you didn't change the Container interface (that would have been a lot of trouble). Could you avoid the tabs next time ? Even Craig stopped it in TC 4.0 ;-) Q: Is there Win32 code already somewhere ? The port 80 binding trick won't mean much there, since the service is run by the System account by default (ie, it has more-than-root privileges), although you can change that (I don't know to which extent). If there is, does it use JNI ? JavaService is really cool, because it makes Tomcat look like a normal native process. Remy
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: [...] Actually, I think it's ok, esp since you didn't change the Container interface (that would have been a lot of trouble). Yeah, didn't want to create that many troubles... Could you avoid the tabs next time ? Even Craig stopped it in TC 4.0 ;-) Fuck, I forgot to preprocess the files Doin' it right now :) Q: Is there Win32 code already somewhere ? The port 80 binding trick won't mean much there, since the service is run by the System account by default (ie, it has more-than-root privileges), although you can change that (I don't know to which extent). If there is, does it use JNI ? JavaService is really cool, because it makes Tomcat look like a normal native process. Nope, there's nothing for Win32 as of now... If you give me a pointer to the sources, I'll integrate it with my service code for Tomcat (don't want to look at all crappy service code in the Win32 API... Wasn't it BSD? Pier
Re: Post B6 modifications...
Pier P. Fumagalli at [EMAIL PROTECTED] wrote: Remy Maucherat at [EMAIL PROTECTED] wrote: Could you avoid the tabs next time ? Even Craig stopped it in TC 4.0 ;-) Fuck, I forgot to preprocess the files Doin' it right now :) I'll run it over all catalina files... :) Pier
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: Wasn't it BSD? Yes, but BSD != Apache, so I don't think we can cut paste unless they agree to donate the code ;-) You can try talking to them. I just asked them the permission to integrate a binary, which they gladly gave me (although the license allowed me to use the binary without asking them). http://www.alexandriasc.com/software/JavaService/index.html Depends on the license... We can't modify their copyright, for sure, but if it's a post-2000 BSD license (without advertising clause), we won't have any problem... The binary was passed on the ML today, but without sources, we can't accept it, as IMVHO, it's unmaintainable code... Pier
Re: Post B6 modifications...
On Sunday July 22, 2001 Remy Maucherat wrote: Yes, but BSD != Apache, so I don't think we can cut paste unless they agree to donate the code ;-) You can try talking to them. I just asked them the permission to integrate a binary, which they gladly gave me (although the license allowed me to use the binary without asking them). http://www.alexandriasc.com/software/JavaService/index.html Depends on the license... We can't modify their copyright, for sure, but if it's a post-2000 BSD license (without advertising clause), we won't have any problem... I have no clue. I'd be happy to donate the code, if you want. Just let me know what, if anything, I need to do. Elijah Roberts [EMAIL PROTECTED]
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: http://www.alexandriasc.com/software/JavaService/license.html It's a post-2000 BSD... We don't have to alter the copyright, but we can included it without any other legal matter... Probably the best would be to start modifying their sources and update them to our model, while, at the same time, asking them to donate the code :) How does it sound? Pier
Re: Post B6 modifications...
Pier P. Fumagalli at [EMAIL PROTECTED] wrote: Pier P. Fumagalli at [EMAIL PROTECTED] wrote: Remy Maucherat at [EMAIL PROTECTED] wrote: Could you avoid the tabs next time ? Even Craig stopped it in TC 4.0 ;-) Fuck, I forgot to preprocess the files Doin' it right now :) I'll run it over all catalina files... :) Done, it's a _HUGE_ commit, but it's through cleanly, and it builds, so nothing has been tweaked... ALL files had at least ONE tab (can you believe it)? Now, no tabs anymore. Pier
RE: Post B6 modifications...
http://www.alexandriasc.com/software/JavaService/license.html It's a post-2000 BSD... We don't have to alter the copyright, but we can included it without any other legal matter... Probably the best would be to start modifying their sources and update them to our model, while, at the same time, asking them to donate the code :) How does it sound? Pier +1.
Re: Post B6 modifications...
Elijah Roberts at [EMAIL PROTECTED] wrote: I'd be happy to donate the code, if you want. Just let me know what, if anything, I need to do. Oh, that's great, I didn't figure out you were on the Mailing List... To give you a little background, I wrote the Service stuff in Tomcat 4.0 to allow port binding on Unix with ports 1024 and without running as Root... I'm planning to integrate it with some Windows code, and from a very fast reading of your JavaService, it can be integrated easily... I'll take a chance at it next week, and we'll see what comes up... Thanks for the help, though... Really appreciate it... Pier
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: http://www.alexandriasc.com/software/JavaService/license.html It's a post-2000 BSD... We don't have to alter the copyright, but we can included it without any other legal matter... Probably the best would be to start modifying their sources and update them to our model, while, at the same time, asking them to donate the code :) How does it sound? This + Elijah's answer = very good :-) Remy
Re: Post B6 modifications...
Remy Maucherat at [EMAIL PROTECTED] wrote: Remy Maucherat at [EMAIL PROTECTED] wrote: http://www.alexandriasc.com/software/JavaService/license.html It's a post-2000 BSD... We don't have to alter the copyright, but we can included it without any other legal matter... Probably the best would be to start modifying their sources and update them to our model, while, at the same time, asking them to donate the code :) How does it sound? This + Elijah's answer = very good :-) Ok, so what I need from you is an implementation of the Service interface for Catalina... All three methods (load, start and stop) are called by the container, so we should remove start and stop from the command line... Can you take a look @ it? Pier
Post B6 modifications...
This is the first set of modifications I made to the Catalina code to allow port 1024 binding under Unix. Basically, I added an initialize() method to Server, Service and Connector, and that gets called appropriately before start(). Now, the only thing left to do is to move the ServerSocket creation within connectors in initialize(), and launch Catalina with a wrapper around the Service code I committed last week. Basically, during load() in service, we build the whole components tree and call initialize() on the Server. Then during start() and stop() we call the same methods in Server, and (in theory) the trick should be done. I'd need to modify Remy's BootstrapService and CatalinaService to perform a two-stage initialization process (and I don't know what JavaService, the one he's using under Windows does), but, more or less, that should be it... This patch actually starts fixing things, but doesn't break the build neither compromises functionality (checked it already), but I would like someone (Craig/Remy/Amy/Glenn...) to review it and, if ok, apply it... Cheers... Pier (back from the cops) Index: Connector.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v retrieving revision 1.5 diff -c -3 -r1.5 Connector.java *** Connector.java 2001/05/09 23:42:07 1.5 --- Connector.java 2001/07/20 17:38:25 *** *** 240,244 --- 240,252 */ public Response createResponse(); + /** + * Invoke a pre-startup initialization. This is used to allow connectors + * to bind to restricted ports under Unix operating environments. + * + * @exception LifecycleException If this server was already initialized. + */ + public void initialize() + throws LifecycleException; } Index: Server.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Server.java,v retrieving revision 1.2 diff -c -3 -r1.2 Server.java *** Server.java 2000/09/30 19:15:43 1.2 --- Server.java 2001/07/20 17:38:25 *** *** 163,167 */ public void removeService(Service service); ! } --- 163,174 */ public void removeService(Service service); ! /** ! * Invoke a pre-startup initialization. This is used to allow connectors ! * to bind to restricted ports under Unix operating environments. ! * ! * @exception LifecycleException If this server was already initialized. ! */ ! public void initialize() ! throws LifecycleException; } Index: Service.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Service.java,v retrieving revision 1.2 diff -c -3 -r1.2 Service.java *** Service.java2000/12/14 02:56:13 1.2 --- Service.java2001/07/20 17:38:25 *** *** 150,154 --- 150,162 */ public void removeConnector(Connector connector); + /** + * Invoke a pre-startup initialization. This is used to allow connectors + * to bind to restricted ports under Unix operating environments. + * + * @exception LifecycleException If this server was already initialized. + */ + public void initialize() + throws LifecycleException; } Index: connector/http/HttpConnector.java === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v retrieving revision 1.18 diff -c -3 -r1.18 HttpConnector.java *** connector/http/HttpConnector.java 2001/07/10 07:36:42 1.18 --- connector/http/HttpConnector.java 2001/07/20 17:38:26 *** *** 258,263 --- 258,269 /** + * Has this component been initialized yet? + */ + private boolean initialized = false; + + + /** * Has this component been started yet? */ private boolean started = false; *** *** 1055,1060 --- 1061,1079 lifecycle.removeLifecycleListener(listener); + } + + + /** + * Initialize this connector (create ServerSocket here!) + */ + public void initialize() + throws LifecycleException { + if (initialized) + throw new LifecycleException ( + sm.getString(httpConnector.alreadyInitialized)); + this.initialized=true; + System.err.println(HTTP Connector initialized); } Index: connector/http/LocalStrings.properties === RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/LocalStrings.properties,v retrieving revision 1.3 diff -c -3 -r1.3