Or you do it lazily when the first synchronization is added locally. That's what we do in the JTS. Check it out.
Tom Jenkinson wrote:
This is what I was attempting to describe above. That said, the limitation with this approach is clear, in the case where there are no synchronizations registered on the subordinate TM, we will still have to call each subordinate TM with a beforeCompletion message as the root TM will not be aware of which subordinates do/don't have sync's registered, a perfomance penalty.