Hi Hamlin,

I would expect endPoint().getPort() to be non-zero except during the
narrow window of the initialization before the server socket is opened.
See TCPEndPoint.listen().

If that's true, then either there is no server socket to close or
that part of the condition is always true and could be removed.

So I think we'd need to understand if it was intentional to leave
an application specified port open, while closing one that
the application has no (specific) knowledge of.

$.02, Roger

BTW, verifyPortFree() would easier to understand and code with if it returned a boolean instead throwing an exception.  The non-local exception handling makes the code harder to follow.



On 11/1/19 12:47 AM, Hamlin Li wrote:
Would you please to review the following patch?

bug: https://bugs.openjdk.java.net/browse/JDK-8233313

webrev: http://cr.openjdk.java.net/~mli/8233313/webrev.00/

With following code, port used behind is not closed after unexportObject

/Registry registry = LocateRegistry.createRegistry(0);//
//boolean b = UnicastRemoteObject.unexportObject(registry, true);/

But, the port can be closed if pass in an explicit port number to createRegistry.

I think is not right and is a resource leak.


Thank you

-Hamlin


Reply via email to