Bug 62841

Summary: Refactor DeltaSession locking
Product: Tomcat 9 Reporter: Mark Thomas <markt>
Component: ClusterAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 9.0.x   
Target Milestone: -----   
Hardware: All   
OS: All   

Description Mark Thomas 2018-10-20 10:07:22 UTC
Background: https://tomcat.markmail.org/thread/26rl3hs6wjzf7ssu

It would helpful in some scenarios to reduce the scope of the DeltaSession lock.

Currently the sequence is:
- lock session
- serialize DeltaRequest to message
- recycle DeltaRequest
- unlock session
- send message

The proposed sequence is:
- lock session
- keep reference to populated DeltaRequest
- provide session with new DeltaRequest object
- unlock session
- serialize populated DeltaRequest to message
- send message

To avoid the expense of creating a new DeltaRequest each time, a pool of them could be used which should minimise the garbage.

Looking at the sequence of events, I don't think this does much that is
likely to harm coherence.
Comment 1 Mark Thomas 2019-05-16 14:28:05 UTC
Fixed in:
- master for 9.0.21 onwards
- 8.5.x for 8.5.42 onwards
- 7.0.x for 7.0.95 onwards