Re: Does unexport() on UnicaseRemoteObject release the port?

Peter Jones - JavaSoft East <[email protected]>
Newsgroups gmane.comp.java.sun.rmi
Message-ID <20050720204743.GA25081@east>
> I'm trying to use RMI objects inside JBoss with JBoss'
> hotdeployment.  However, when the new EAR file is
> dropped on the JBoss server my RMI objects are not
> relasing the port they were listenning on.  I'm using
> the Naming server to bind them, and I'm calling
> unexport() and Naming.unbind() on each object.  How
> can I force RMI to close the socket these objects were
> sharing?  Is there a way to force the Naming service
> to also release his port?
>
> The exception I'm getting when I export my objects
> after hotdeployment is a bind SocketException.  I'm
> also using my own SocketFactories.

Not closing the server socket after all remote objects that had been
exported to it have become unexported is an RMI implementation bug:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0311&L=rmi-users&P=731
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4457683
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508962

But if the original port is just to be reused for new exported remote
objects in the same VM, then generally the new exports should succeed.
Perhaps if you provide some snippets of the code used for unexporting
and exporting the remote objects, and of the socket factory code too,
it would be more clear why the exports are failing.  One reason could
be if the server socket factory objects are not equal to the ones used
previously.

[The thread of the above-referenced post refers to a possible
workaround using a custom server socket factory that provides a way to
control the binding of the port explicitly; I happened to be helping
someone about such a workaround a few months ago, and it might be
worthwhile to post the result here...]

-- Peter

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.