//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
+// Ankit Jain <JAnkit@novell.com>
//
// (C)2005 Novell Inc,
+// (C)2006 Novell Inc,
//
-using System.Collections;
-using System.Collections.Specialized;
-
-#if NET_2_0
+#if NET_2_0\r
+using System.Configuration;\r
+using System.Transactions.Configuration;
namespace System.Transactions
{
public static class TransactionManager
{
- // it could contain both Transaction and non-tx (Suppress).
- static Stack tx_states = new Stack ();
+ static TransactionManager()
+ {\r
+ defaultSettings = ConfigurationManager.GetSection("system.transactions/defaultSettings") as DefaultSettingsSection;\r
+ machineSettings = ConfigurationManager.GetSection("system.transactions/machineSettings") as MachineSettingsSection;
+ }\r
+\r
+ static DefaultSettingsSection defaultSettings;\r
+ static MachineSettingsSection machineSettings;\r
+ static TimeSpan defaultTimeout = new TimeSpan(0, 1, 0); /* 60 secs */\r
+ static TimeSpan maxTimeout = new TimeSpan(0, 10, 0); /* 10 mins */
- [MonoTODO]
- public static TimeSpan DefaultTimeout {
- get { throw new NotImplementedException (); }
+ public static TimeSpan DefaultTimeout {\r
+ get {\r
+ // Obtain timeout from configuration setting..\r
+ // - http://msdn.microsoft.com/en-us/library/ms973865.aspx\r
+ // - http://sankarsan.wordpress.com/2009/02/01/transaction-timeout-in-systemtransactions/\r
+ // 1. sys.txs/defaultSettings[@timeout]\r
+ // 2. defaultTimeout\r
+\r
+ if (defaultSettings != null)\r
+ return defaultSettings.Timeout;
+
+ return defaultTimeout;
+ }
}
- [MonoTODO]
+ [MonoTODO ("Not implemented")]
public static HostCurrentTransactionCallback HostCurrentCallback {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
}
- [MonoTODO]
public static TimeSpan MaximumTimeout {
- get { throw new NotImplementedException (); }
+ get {\r
+\r
+ if (machineSettings != null)\r
+ 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)
public static event TransactionStartedEventHandler
DistributedTransactionStarted;
-
- // internals
- internal static Transaction Current {
- get {
- if (tx_states.Count == 0)
- return null;
- return tx_states.Peek () as Transaction;
- }
- set {
- throw new NotImplementedException ();
- }
- }
-
- internal static void BeginScope (TransactionScope scope)
- {
- throw new NotImplementedException ();
- }
-
- internal static void EndScope (TransactionScope scope)
- {
- throw new NotImplementedException ();
- }
}
}