hai-ben commented on code in PR #2790:
URL: https://github.com/apache/activemq/pull/2790#discussion_r4557241846
##########
activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java:
##########
@@ -188,8 +188,8 @@ final void writeCheck() {
return;
}
- if (!commandSent.get() && useKeepAlive && monitorStarted.get() &&
!ASYNC_TASKS.isShutdown()) {
- LOG.trace("{} no message sent since last write check, sending a
KeepAliveInfo", this);
+ if ((!commandSent.get() || isKeepAliveOnEveryWriteCheck()) &&
useKeepAlive && monitorStarted.get() && !ASYNC_TASKS.isShutdown()) {
Review Comment:
No This is a per-instance property, so each connection's monitor has its own
copy which off by default, except for STOMP.
##########
activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompInactivityMonitor.java:
##########
@@ -54,6 +54,12 @@ protected void processInboundWireFormatInfo(WireFormatInfo
info) throws IOExcept
protected void processOutboundWireFormatInfo(WireFormatInfo info) throws
IOException {
}
+ // STOMP requires a heartbeat even when a frame was sent just after a
previous check (AMQ-4710)
+ @Override
+ protected boolean isKeepAliveOnEveryWriteCheck() {
Review Comment:
Done.
##########
activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java:
##########
@@ -354,6 +354,15 @@ public void setUseKeepAlive(boolean val) {
useKeepAlive = val;
}
+ /**
+ * Send a keep-alive on every write check, even if a command was sent
since the last one.
+ *
+ * @return true to send a keep-alive on every write check, false to skip
it after a command
+ */
+ protected boolean isKeepAliveOnEveryWriteCheck() {
+ return false;
Review Comment:
Done. It's now a property so it can be set per connector.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact