pradeep85841 commented on PR #1659:
URL: https://github.com/apache/activemq/pull/1659#issuecomment-3903816329

   I have updated to address the feedback from @cshannon and @jeanouii. This 
revision ensures total thread safety for the VM Transport "defensive copy" 
logic while adhering to the project's coding standards and memory-management 
goals.
   
   Key Changes:
   
   Full Synchronization: Per the suggestion to "go all the way," I have applied 
the synchronized keyword to all state-dependent methods in ActiveMQTextMessage. 
This includes getText(), setText(), getSize(), clearBody(), and 
clearUnMarshalledState().
   
   Data Integrity: In clearUnMarshalledState(), I ensured that storeContent() 
is called (if bytes are missing) before the local text reference is nulled. 
This prevents the "double-null" scenario where a message could lose its content 
entirely during a race.
   
   Encapsulation: Reverted the copy(ActiveMQTextMessage) helper method to 
private visibility.
   
   Stress Test Improvements: * Replaced printStackTrace with SLF4J logging.
   
   Added proper braces {} to all conditional blocks.
   
   Refined the concurrency logic using an ExecutorService and Future validation 
to simulate high-pressure dispatching across multiple durable and non-durable 
subscribers.
   
   Optimized the test payload and iteration count to verify the fix under high 
contention without triggering OutOfMemoryError on restricted heap environments.
   
   Verification: The updated ActiveMQTextMessageStressTest confirms that even 
when multiple consumers hammer getText() and clearUnMarshalledState() 
concurrently on messages dispatched via the VM transport, the data remains 
intact and instances remain independent.
   
   The fix has been verified in original environment and the test suite is now 
passing with a clean exit.


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