Codereview for JDK-8016221: A unit test should not use a fixed port to run a jmx connector (JDCMD MBean Tests)

shanliang shanliang.jiang at oracle.com
Tue Jun 18 07:16:16 PDT 2013


Jaroslav Bachorik wrote:
> Hi Shanliang,
>
> the change looks fine. The only small thing I have is whether it is good
> to wrap
> cc.close();
> cs.stop();
>
> in try/catch and swallow the exception. Wouldn't it be better to let the
> test fail if something goes wrong with closing JMXConnector and
> JXMConnectorServer?
>   
I close the client and server in any case (within "finally"), in case 
that the server or the client fails to start, closing the client/server 
throws too an exception, the user will not see the starting exception if 
the closing exception is not swallowed. Anyway here we test mainly 
JDCMD, so better to not make the test complicated to test jmx connection.

Thanks for the review.

Shanliang
> -JB-
>
> On 06/12/2013 09:56 AM, shanliang wrote:
>   
>> Re-send with right subject :)
>>
>> Shanliang
>>
>> shanliang wrote:
>>     
>>> Hi,
>>>
>>> The fix is to address https://jbs.oracle.com/bugs/browse/JDK-8016221
>>>
>>> Webrev: http://cr.openjdk.java.net/~sjiang/JDK-8016221/webrev.00/
>>>
>>> Instead to use a fixed port to run a JMX connector, we specify the
>>> port as 0:
>>>    JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
>>> to allow JMX to select a free port.
>>>
>>> and the fix makes sure to close the client and server when the test is
>>> finished (passed or failed).
>>>
>>> Shanliang
>>>
>>>
>>>       
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20130618/62132d1b/attachment.html 


More information about the serviceability-dev mailing list