Hey Aleks! On Sat, Oct 18, 2014 at 6:48 PM, Aleksandar Lazic <al-tomcatu...@none.at> wrote:
> Hi all. > > We have the need that the tomcat 7 connectors (ajp & http) only start > listening on the configured port after the application is started. > > I have take a look at > > https://tomcat.apache.org/tomcat-7.0-doc/connectors.html > https://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html > > but I haven't seen a "delay until app start done" flag. > > I have also searched in the archive > > http://marc.info/?l=tomcat-user&w=2&r=1&s=delay&q=b > > I'm sure that I don't understand the tomcat internals enough to see the > easy solution. > > Thanks for pointing me to the right direction. > Maybe It must be done in the app startup phase or somewhere else. > > It would help if you clarify your "need" and reasons why you want this. I suspect you don't want "traffic" until the app is ready and configured. Tell us more about what are your specific requirements and problem you are trying to solve. Few ideas to play with: 1) Figure out how to start Tomcat with Connectors disabled or not configured. After your application has been successfully deployed/configured - enable or configure your connectors. Look at JMX MBeans for ways to enable(start)/disable(stop). Also look at the connector attribute "bindOnInit", so the connector would wait for binding to a port until "start" operation is called on the connector MBean, e.g. Catalina:type=Connector,port=8080 Catalina:type=Connector,port=8009 2) Are you using Apache or some other webserver fronting your Tomcat instance(s)? You could disable the application path on Apache, and once the app is configured and ready, turn on the flood gates on Apache or whatever webserver you use. Hope that helps. Cheers! Neven