X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Transactions%2FSystem.Transactions%2FTransactionManager.cs;h=a7a62b6388e559e3045f7dc5effcfaa16d94243f;hb=bcd18127a5236f916a523260c70c92b8fda4cb5c;hp=130df9be27a65f9f6936c60c315b1ebe40675d35;hpb=07ec1253c277856bdbb74213e2defc8ed23cf8e3;p=mono.git diff --git a/mcs/class/System.Transactions/System.Transactions/TransactionManager.cs b/mcs/class/System.Transactions/System.Transactions/TransactionManager.cs index 130df9be27a..a7a62b6388e 100644 --- a/mcs/class/System.Transactions/System.Transactions/TransactionManager.cs +++ b/mcs/class/System.Transactions/System.Transactions/TransactionManager.cs @@ -8,38 +8,63 @@ // (C)2005 Novell Inc, // (C)2006 Novell Inc, // -#if NET_2_0 +#if NET_2_0 +using System.Configuration; +using System.Transactions.Configuration; namespace System.Transactions { public static class TransactionManager { - /* 60 secs */ - static TimeSpan defaultTimeout = new TimeSpan (0, 1, 0); - /* 10 mins */ - static TimeSpan maxTimeout = new TimeSpan (0, 10, 0); + static TransactionManager () + { + defaultSettings = ConfigurationManager.GetSection ("system.transactions/defaultSettings") as DefaultSettingsSection; + machineSettings = ConfigurationManager.GetSection ("system.transactions/machineSettings") as MachineSettingsSection; + } + + static DefaultSettingsSection defaultSettings; + static MachineSettingsSection machineSettings; + static TimeSpan defaultTimeout = new TimeSpan (0, 1, 0); /* 60 secs */ + static TimeSpan maxTimeout = new TimeSpan (0, 10, 0); /* 10 mins */ - public static TimeSpan DefaultTimeout { - get { return defaultTimeout; } + public static TimeSpan DefaultTimeout { + get { + // Obtain timeout from configuration setting.. + // - http://msdn.microsoft.com/en-us/library/ms973865.aspx + // - http://sankarsan.wordpress.com/2009/02/01/transaction-timeout-in-systemtransactions/ + // 1. sys.txs/defaultSettings[@timeout] + // 2. defaultTimeout + + if (defaultSettings != null) + return defaultSettings.Timeout; + + return defaultTimeout; + } } - [MonoTODO] + [MonoTODO ("Not implemented")] public static HostCurrentTransactionCallback HostCurrentCallback { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } public static TimeSpan MaximumTimeout { - get { return maxTimeout; } + get { + + if (machineSettings != null) + return machineSettings.MaxTimeout; + + return maxTimeout; + } } - [MonoTODO] + [MonoTODO ("Not implemented")] public static void RecoveryComplete (Guid manager) { throw new NotImplementedException (); } - [MonoTODO] + [MonoTODO ("Not implemented")] public static Enlistment Reenlist (Guid manager, byte[] recoveryInfo, IEnlistmentNotification notification)