On slow connections with larger messages to be exchanged, the inactivity monitor might kick in, drop the network connection and re-establish it again. This prevents two brokers from exchanging larger messages on a slow connection as the transmission always gets interrupted.
See the discussion of this on http://activemq.apache.org/slow-networks-drop-large-messages.html.
The problem is that the InactivityMonitor always waits for a complete message to be assembled on an active connection before clearing its internal flag.
I propose to change the behavior of the InactivityMonitor so that it clears its flag already when a few bytes were received on a network connection rather than waiting for the entire message to be sent. This should work around the problem of connections being dropped and re-established periodically when receiving large messages.