mattrpav commented on code in PR #2790:
URL: https://github.com/apache/activemq/pull/2790#discussion_r4533214669


##########
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:
   inherit from base



##########
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:
   this should be a configuration parameter, not a hard-coded value



##########
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:
   Does isKeepAliveOnEveryWriteCheck() apply to _every_ protocol?  This PR is 
labeled for STOMP



-- 
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


Reply via email to