RFC: Fix for datagram reader not shutting down.

Every time a client logs on and back off, another DatagramReader thread
is left around. This seems to fix it, but this method should be called
when either the reader or writer shut down..

Also: the didExit methods look funny:

    /**
     * Callback called by the datagram writer thread when it goes away.
     */
    protected synchronized void datagramWriterDidExit ()
    {
        // clear out our writer reference
        _datagramWriter = null;

        if (_datagramReader == null) {
            closeDatagramChannel();
        }

        log.debug("Datagram writer thread exited.");
    }

Why would it only try to shut things down if there's no reader?
Perhaps the idea here is that it won't shut down the channel until
both the reader and writer exit? It's not documented...
This commit is contained in:
Ray J. Greenwell
2013-12-05 14:07:51 -08:00
parent e842439bd0
commit cea4b3cfd8
@@ -949,6 +949,7 @@ public class BlockingCommunicator extends Communicator
if (_selector != null) { if (_selector != null) {
_selector.wakeup(); _selector.wakeup();
} }
closeDatagramChannel();
} }
} }