[SPRNET-1461] Transaction Timeout value not adhered while using TransactionAttribute Created: 17/Aug/11  Updated: 18/Aug/11  Resolved: 18/Aug/11

Status: Resolved
Project: Spring.NET
Component/s: Spring-NET-TX
Affects Version/s: 1.3.2
Fix Version/s: 2.0 M1

Type: Bug Priority: Major
Reporter: Ramiah Balasubramanian Assignee: Steve Bohlen
Resolution: Fixed Votes: 0
Labels: feature-support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Transaction timeout value seem to be not adhered if one configures using the TransactionAttribute. It is adhered if TransactionTemplate API is used.

I suspect the problem might lie in the following piece of code where the RulebasedTransactionAttribute is not populated with the Timeout value there by leaving it as default i.e. DefaultTransactionDefinition.DEFAULT_TIMEOUT.

protected override ITransactionAttribute FindTransactionAttribute(Attribute[] attributes)

{ if (attributes == null) { return null; } foreach (Attribute attr in attributes) { if (attr is TransactionAttribute) { TransactionAttribute ta = (TransactionAttribute)attr; RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute(); //TODO another reminder to sync property names rbta.PropagationBehavior = ta.TransactionPropagation; rbta.TransactionIsolationLevel = ta.IsolationLevel; rbta.ReadOnly = ta.ReadOnly; #if NET_2_0 rbta.EnterpriseServicesInteropOption = ta.EnterpriseServicesInteropOption; #endif Type[] rbf = ta.RollbackFor; IList rollBackRules = new ArrayList(); if (rbf != null) { foreach (Type t in rbf) { RollbackRuleAttribute rule = new RollbackRuleAttribute(t); rollBackRules.Add(rule); } } Type[] nrbfc = ta.NoRollbackFor; if (nrbfc != null) { foreach (Type t in nrbfc) { NoRollbackRuleAttribute rule = new NoRollbackRuleAttribute(t); rollBackRules.Add(rule); } } rbta.RollbackRules = rollBackRules; return rbta; }

return null;

Comment by Steve Bohlen [ 18/Aug/11 ]

Updated code to reflect applying transation timeout value from the attribute

Generated at Sun Oct 20 18:52:22 UTC 2019 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.