2011/10/14 Mark Thomas <ma...@apache.org>:
> On 14/10/2011 09:27, Olivier Lamy wrote:
>> 2011/10/10 Konstantin Kolinko <knst.koli...@gmail.com>:
>>> 2011/10/9 Olivier Lamy <ol...@apache.org>:
>>>> tomcat.getConnector().setPort( 0 );
>>>
>>> 1) Look at how TomcatBaseTest assigns subsequent port numbers,
>>> starting with 8001.
>>>
>>> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?view=markup#l84
>>>
>>>
>>> 2) While the proposed feature may have some usage, I think that I
>>> would want more control in what range the opened port number will be.
>>>
>>> Just setting a "0" would not provide such control.
>>>
>>>
>>> 3) There are several Connector/Endpoint implementations in Tomcat.
>>> While java.net.ServerSocket does support port number of "0",  I am not
>>> sure that APR-based implementation does allow it.
>> Sure but the use case is just to start a http/https (apr can be
>> omitted) connector on any random free port, do some unit test and stop
>> it.
>
> Consistency of behaviour and configuration across the connectors is
> important. Where there are differences, we should be looking to
> converge, not diverge.
Agree. Makes sense.
>
>> IMHO it's a valid use case (and with it folks will be able to use
>> tomcat rather than an other servlet container which has this feature
>> available :-) ).
>> See the code snippet I have pointed, the code to write for using
>> tomcat is really smaller/smarter (except all hacking I have to write
>> due to the restriction on port).
>
> An additional issue is that not specifying a port in server.xml will
> result in 0 being used which would then result in a random port being
> bound. I don't like that at all. I much prefer the current behaviour of
> throwing an error.
>
> If binding to a random port is to be supported I think it needs to be an
> explicit choice - e.g. by setting a special value such as "auto" - and
> ideally needs to be supported by all connectors.
This new auto attribute sounds a good solution to me.
Do we agree on the fact that after been started, the protocol handler
will update the connector.port field to make the real port used
available for use ?
I have opened https://issues.apache.org/bugzilla/show_bug.cgi?id=52028
and will try to propose a patch next week.

Thanks
--
Olivier

>
> In summary, I think the minimum I would find acceptable is:
> - use a special value
> - support for BIO and NIO
>
> Ideally, APR needs to be supported to.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to