-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement
Description
Jeff Badorek opened SPR-1514 and commented
It would be nice if a bound resource in TransactionSynchronizationManager was visible to child threads. I think this could be accomplished using InheritableThreadLocal.
Here is a test case that recreates the problem. (Changing to InheritableThreadLocal works.)
public void testTransactionSynchronizationManager() throws InterruptedException {
final ArrayList actual = new ArrayList();
final ArrayList expected = new ArrayList();
final Object key = new Object();
TransactionSynchronizationManager.bindResource(key, "value");
actual.add(TransactionSynchronizationManager.getResource(key));
Thread thread = new Thread() {
/* (non-Javadoc)
* @see java.lang.Thread#run()
*/
public void run() {
expected.add(TransactionSynchronizationManager.getResource(key));
}
};
thread.start();
thread.join();
assertEquals(actual, expected);
}
Affects: 1.2.6
Referenced from: commits spring-projects/spring-batch@d203f2a
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement