[ mx4j-Bugs-931214 ] HttpAdaptor doesn't stop cleanly

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.mx4j.devel
Message-ID <[email protected]>
Bugs item #931214, was opened at 2004-04-07 13:07
Message generated for change (Comment added) made by brulow
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=931214&group_id=47745

Category: HTTP Adaptor
Group: Release 2.0.1
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Bruce Lowery (brulow)
Assigned to: Brian Scully (btscully)
Summary: HttpAdaptor doesn't stop cleanly

Initial Comment:
The HttpAdaptor stop method triggers the client
connection accept loop to exit by setting a boolean
state variable, 'alive', to false and then opening a
client socket connection to the server socket.  The
logic in the loop checks the 'alive' flag and exits the
loop if it is false.

However, the new client socket isn't closed
immediately, so in an application that stops a
HttpAdaptor and then creates a new one soon after, the
new server socket may not be able to bind to the port
since the previous client socket may not yet have been
cleaned up.

The client socket just needs to be closed before the
loop is exited.


client = serverSocket.accept();
if (!alive)
{
    client.close(); // <----
    break;
}




----------------------------------------------------------------------

>Comment By: Bruce Lowery (brulow)
Date: 2004-06-15 15:56

Message:
Logged In: YES 
user_id=369956

Thanks for the fix.   Our app can be quite busy between the
closing of the old adapter and the opening of the new one,
so delays in garbage collection are more noticeable. 

----------------------------------------------------------------------

Comment By: Brian Scully (btscully)
Date: 2004-06-13 16:50

Message:
Logged In: YES 
user_id=234750

I have applied this patch.  Thanks for the submission.  I
agree this is the right way to do things, but I have not
been able to duplicate your particular problem.  Every time
I stop the HTTPAdaptor, I can immediately reopen it with no
"port already bound" error.  The fix is available in CVS HEAD.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=931214&group_id=47745


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
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.