Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19239
Modified Files:
SystemUtils.cs
Log Message:
SPRNET-486 - Provide better logging information in TransactionSynchronizationManager to identify ConnectionHolder, DbProvider and thread name
Index: SystemUtils.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/SystemUtils.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SystemUtils.cs 30 May 2007 21:06:25 -0000 1.4
--- SystemUtils.cs 7 Sep 2007 02:46:49 -0000 1.5
***************
*** 24,27 ****
--- 24,28 ----
using System.Configuration;
using System.Reflection;
+ using System.Threading;
using System.Xml;
***************
*** 87,90 ****
--- 88,117 ----
get { return isMono; }
}
+
+ /// <summary>
+ /// Gets the thread id for the current thread. Use thread name is available,
+ /// otherwise use CurrentThread.GetHashCode() for .NET 1.0/1.1 and
+ /// CurrentThread.ManagedThreadId otherwise.
+ /// </summary>
+ /// <value>The thread id.</value>
+ public static string ThreadId
+ {
+ get
+ {
+ string name = Thread.CurrentThread.Name;
+ if (StringUtils.HasText(name))
+ {
+ return name;
+ }
+ else
+ {
+ #if NET_1_0 || NET_1_1
+ return Thread.CurrentThread.GetHashCode().ToString();
+ #else
+ return Thread.CurrentThread.ManagedThreadId.ToString();
+ #endif
+ }
+ }
+ }
}
}
\ No newline at end of file
|