jbertram commented on code in PR #6207:
URL: https://github.com/apache/artemis/pull/6207#discussion_r2756727800


##########
artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java:
##########
@@ -81,12 +82,10 @@ public final class StompConnection extends 
AbstractRemotingConnection {
    //this means login is valid. (stomp connection ok)
    private boolean valid;
 
-   private boolean destroyed = false;
+   private AtomicBoolean destroyed = new AtomicBoolean(false);

Review Comment:
   Readability isn't as straight-forward as with an `AtomicBoolean`, but once 
you see and compartmentalize the redirection it's not bad. Both `AtomicBoolean` 
and `AtomicIntegerFieldUpdater` are in `java.util.concurrent.atomic` and both 
use `compareAndSet`. We use patterns like this in over 80 other places across 
the code-base (not including tests). I don't think it's any less maintainable 
ultimately.
   
   Regarding GC pressure, there could potentially be many thousands of STOMP 
connections given that STOMP is a relatively lightweight protocol used by all 
sorts of devices (small & large). It's worth saving heap where we can.



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

Reply via email to