https://issues.apache.org/bugzilla/show_bug.cgi?id=42171
--- Comment #6 from [EMAIL PROTECTED] 2008-08-25 20:54:53 PST ---
Glad to see some activity on this. It's been quite some time since I looked at
this, but I reread the code to refresh my memory. Here's the flow that causes
the multiple SocketNodes, which then log duplicate messages
shutdown()
active=false
socket.close()
socket=null
connector.interrupted=true
connector=null
activateOptions()
active=true
fireConnector()
connector=new Connector() [because active=true (fron activateOptions)
&& connector=null (from shutdown)]
socketClosedEvent() (from an Exception in the original SocketNode, cause by
closing its socket)
connector=null
fireConnector()
connector=new Connector() [because active=true (fron activateOptions)
&& connector=null (from socketClosedEvent)]
As far as I can tell, the intent is that when the shutdown() causes a
socketClosedEvent(), active==false and fireConnector() will not create a new
connector. However, because the activateOptions() call happens in between,
active==true when socketClosedEvent() is called and we get a new connector that
lives in parallel with the one cerated by activateOptions().
The quick fix I posted before will fix this case, but I think that it will
break the automatic restarting that happens when there is a problem with the
socket. I belive that the easiest real fix would be to remove the
SocketHubReceiver from the original SocketNode's listenerList when shutdown()
is called so that socketClosedEvent() will not be called. The main code change
would be to keep a handle to the SocketNode when it is created, so that inside
shutdown(), the the receiver can call removeSocketNodeEventListener(this)
before it calls socket.close(). I don't have a setup right now to test this,
but I believe this will fix the problem and leave restarting intact.
However, I think that even that solution is a little gross because it's really
just a workaround for the fact that there isn't a way to shutdown a SocketNode
normally (and it doesn't work if there are multiple listeners). I think the
best solution wuld be to add a shutdown() to the SocketNode and not touch the
socket directly after the SocketNode has been created. This way it could
notify all listeners of the "normal shutdown" event (maybe just
socketEventClosed(null)). Because I don't know anything about the codebase as
a whole, I can't say how disruptive of a change this would be.
Hope that's some help. Sorry I don't have patches for you (or even tested
approaches), but I don't have the code checked out or an environment set up.
I'll see if I can get the code running and write a fix, but I wanted to post in
case someone else wanted to give it a try in the meantime.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]