On Thursday 21 June 2018 10:30 AM, mandy chung wrote:
On 6/20/18 1:14 AM, Harsha Wardhana B wrote:
Hi,
Please find the fix below for the bug
JDK-8204661 : Show error 'Port already in use' in
HashedPasswordFileTest.java
having webrev at,
http://cr.openjdk.java.net/~hb/8204661/webrev.00/
The problem root-cause is discussed in the comments section of the bug.
The fix above lets the default agent pick a free port by passing
'port=0' value and then reads the JMX Connector URL from Perf Counters.
This looks fine. Please add this issue number to @bug.
This is interesting. I was not aware of setting port=0 will
auto-assign a free port. Do you know if it was added for testing
purpose (which I assume so)?
Port number of 0 is not handled at JMX or RMI layer. The given port
number is passed onto the ServerSocket.
https://docs.oracle.com/javase/10/docs/api/java/net/ServerSocket.html#%3Cinit%3E(int)
For example
test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java uses
jdk.testlibrary.Utils.getFreePort() to get a free port number.
Mandy
Harsha