<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=malcafig" rel="nofollow">Mario Alcaraz</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3272?redirect=false" rel="nofollow">SPR-3272</a></strong> and commented</p>
<p dir="auto">JSTL variables named "status" defined before a binding tag can interfere with "status" binding variable. This issue has been reported as <a href="http://opensource.atlassian.com/projects/spring/browse/SPR-1140" rel="nofollow">http://opensource.atlassian.com/projects/spring/browse/SPR-1140</a> and fixed on version 1.2.3. Applications developed with 1.2.7 can cope with this but after migrating to 2.0.x setting a variable with named "status" at the page context would throw a ClassCastException inside body tag. It appears this bug has been introduce in <a href="http://opensource.atlassian.com/projects/spring/browse/SPR-2166" rel="nofollow">http://opensource.atlassian.com/projects/spring/browse/SPR-2166</a> . A workaround would be to define JSTL variables named "status" in the request context to allow <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398058613" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5843" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5843/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5843">#5843</a> to take effect, or change their name.<br>
I'm currently working in a patch I'll soon attached to this Issue.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2.8, 2.0 final, 2.0.1, 2.0.2, 1.2.9, 2.0.3</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/12473/bindtest.zip" rel="nofollow">bindtest.zip</a> (<em>6.45 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/12474/patch.txt" rel="nofollow">patch.txt</a> (<em>2.30 kB</em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=benrowlands" rel="nofollow">Ben Rowlands</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3311?redirect=false" rel="nofollow">SPR-3311</a></strong> and commented</p>
<p dir="auto">To implement a custom local transaction manager we'd like to listen to what Spring is enlisting in the transaction. We don't use a distributed transaction manager or 2PC but instead use a local transaction manager that orders items in 'best-efforts' order and does single-phase commit.</p>
<p dir="auto">If we could listen to the TransactionSynchronizationManager we could reuse all of Springs current transaction support/integration to handle transaction resource management (using the Spring strategy of binding resources to the thread-local, ie in DataSourceUtils).</p>
<p dir="auto">In our implementation when the listeners are fired we update our list of transaction items so we can track the order in which items need to be committed (we commit the initiating transaction item last, typically this is the messaging resource so in the event of failure the message is rolled back and replayed - a limitation of this strategy is potential duplicate messages but no lost messages, however it is much simpler than using 2PC and distributed transaction manager and avoids the management overhead).</p>
<p dir="auto">An additional complexity is the implementation of Savepoints; we take a snapshot of the synchronizations and resources bound to the transaction when the savepoint is created and restore this state when we rollback to a savepoint (we rollback any resources added after the savepoint was created). If we could listen to the TransactionSynchronizationManager we could achieve this by tracking any new synchronizations/resources added after a savepoint was created and then remove them upon rollback of the savepoint.</p>
<p dir="auto">For example:</p>
<p dir="auto">public interface TransactionSynchronizationManagerListener<br>
{<br>
public void resourceBound( Object key, Object resource );</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public void resourceUnbound( Object key, Object resource );

public void synchronizationRegistered( TransactionSynchronization synchronization );

public void synchronizationUnregistered( TransactionSynchronization synchronization );"><pre class="notranslate"><code class="notranslate">public void resourceUnbound( Object key, Object resource );

public void synchronizationRegistered( TransactionSynchronization synchronization );

public void synchronizationUnregistered( TransactionSynchronization synchronization );
</code></pre></div>
<p dir="auto">}</p>
<p dir="auto">With API to register a listener for the current thread (and clear).</p>
<p dir="auto">TransactionSynchronizationManager#setListener( TransactionSynchronizationManagerListener listener )</p>
<p dir="auto">To handle the savepoint issue (i.e., shrink list of synchronizations to the state they were before the savepoint) an API to selectively remove synchronizations would be ideal:</p>
<p dir="auto">TransactionSynchronizationManager#unregisterSynchronization( TransactionSynchronization synchronization )</p>
<hr>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398089970" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9710" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9710/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9710">#9710</a> Add extension to TransactionSynchronizationManager to allow custom resolution of unbound transaction resources to allow "lazy-enlistment" TransactionManagers</li>
</ul>
<p dir="auto">13 votes, 19 watchers</p>