On 6/24/06, Tim Ellison <[EMAIL PROTECTED]> wrote:
Andrew Zhang wrote: > On 6/23/06, Tim Ellison <[EMAIL PROTECTED]> wrote: >> >> Andrew Zhang wrote: >> > Hi Alexander, >> > >> > Thanks for your kind reminder. >> > >> > Certainly I'll use sth. like Support_PortManager.getNextPort() to avoid >> > such >> > port conflict issue. >> >> No, please! Don't perpetuate that abomination<g>! Alexander is right, >> you should bind to port 0 and let the OS assign one. > > Yes, I agree that getNextPort doesn't really get the next free port, and > bind to port 0 is the right way. > > But if I remembered clearly, in Jetty based tests thread, someone objected > automatically select port. > "> What's the problem if the port is selected automatically? > > Repeatability. IMO, there should be no random elements in our testing. > That leads to frustration, fear, despair, pathos, pain, agony, angst and > much pulling of limited resources, like hair, in my case."
Sorry. I forgot to say that the paragraph above is cited from "Jetty based tests" thread. I totally agree that bind to port 0 is the right way. LOL. Have you seen Support_PortManager.getNextPort()?, there is nothing
repeatable about that either (unless you always run the test at the same time of day ;-) ) _and_ it may give you a port that is in use. > Additionally, getNextPort() is referenced many times in LUNI, NIO modules. > Most of them are used to avoid port conflict. How do they do that? the port manager gives out numbers sequentially starting at a 'somewhat random' point. > Shall we fix those codes? IMHO it should be on the to-do list, yes.
Then does getNextPort() make sense under any circumstance? Thanks! Regards,
Tim -- Tim Ellison ([EMAIL PROTECTED]) IBM Java technology centre, UK. --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Andrew Zhang China Software Development Lab, IBM