Seems entirely reasonable.

On Jan 17 2013, at 12:18 , Jim Gish wrote:

> Please review 
> http://cr.openjdk.java.net/~jgish/Bug8006534-getUnusedRandomPort-retry-more/ 
> <http://cr.openjdk.java.net/%7Ejgish/Bug8006534-getUnusedRandomPort-retry-more/>
> 
> TestLibrary.getUnusedPort() attempts to retry getting an ephemeral port 10 
> times, which is the current number of ports in the reserved port range.  
> Debugging code added a few weeks back has revealed that intermittent failures 
> in tests using this method are caused when the underlying socket code first 
> returns the first number in the reserved port range.  Subsequent retries 
> result in incrementing the port number by one until reaching the max reserved 
> port number, which just happens to correspond to the 10th attempt, and the 
> code then quits trying.
> 
> The proposed fix (one of many possible alternatives, of course) simply 
> retries for twice the number of ports in the range.
> 
> Thanks,
>   Jim
> 
> -- 
> Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
> Oracle Java Platform Group | Core Libraries Team
> 35 Network Drive
> Burlington, MA 01803
> jim.g...@oracle.com
> 

Reply via email to