| From | Sent On | Attachments |
|---|---|---|
| Olivier Lamy | Oct 9, 2011 7:08 am | |
| Mark Thomas | Oct 9, 2011 9:39 am | |
| Olivier Lamy | Oct 9, 2011 10:37 am | |
| Konstantin Kolinko | Oct 9, 2011 3:58 pm | |
| Olivier Lamy | Oct 14, 2011 1:27 am | |
| Henri Gomez | Oct 14, 2011 1:34 am | |
| Konstantin Kolinko | Oct 14, 2011 4:33 am | |
| Mark Thomas | Oct 14, 2011 4:35 am | |
| Olivier Lamy | Oct 14, 2011 5:40 am | |
| Konstantin Kolinko | Oct 14, 2011 5:57 am |
| Subject: | Re: Embeded Tomcat using a Connector with a random port (port 0) | |
|---|---|---|
| From: | Henri Gomez (henr...@gmail.com) | |
| Date: | Oct 14, 2011 1:34:23 am | |
| List: | org.apache.tomcat.dev | |
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. 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).
Guys.
It make sense to have a way to get an unused random port for embedded mode in testing cases.
On a CI system, ie Jenkins, you could have many concurrents tests done at the same time, the only solution to get a free port is to discover it at startup time isn't it ?





