Review request for 7195249: Some jtreg tests use hard coded ports

Dmitry Samersoff dmitry.samersoff at
Wed Nov 20 05:04:21 PST 2013


*The only* correct way to take really free port is:

1. Chose random number between 49152 and 65535
2. Open socket

if socket fails - repeat step 1
if socket OK - return *socket*

If you can't keep the socket open (e.g. you have to pass port number as
property value) you shouldn't do any pre-check as it has no value - as
as soon as you close socket someone can take the port.

So just choose a random number within the range above and let networking
code opening socket to handle port conflict.


On 2013-11-20 15:54, taras ledkov wrote:
> Hi Everyone,
> I am working on bug
> There are two webrevs:
> Webrev for jdk part:
> Webrev for hs part:
> Please take a look at some notes:
> - After discussing with Yekaterina Kantserova & Jaroslav Bachorik some
> shell tests have been converted to java based tests
> - PasswordFilePermissionTest & SSLConfigFilePermissionTest tests looked
> very similar, so a common parent class was created for them:
> AbstractFilePermissionTest
> - What was called I've renamed to
> The java code to replace old shell script
> is called, hence the huge
> diff.
> - The new has some lines similar to the
>, I nevertheless decided to not
> complicate the code further and leave it as is. Please let me know if
> this is somehow not acceptable
> - com/oracle/java/testlibrary/ that is added to hotspot
> repository is taken from this patch:
> - These tests will need additional changes when test library process
> tools will support command line options inheritance
> (

Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.

More information about the serviceability-dev mailing list