1
- using System . Collections ;
2
-
3
1
using System . Collections . Generic ;
2
+ using System . Runtime . CompilerServices ;
3
+
4
4
5
5
namespace NHibernate . Impl
6
6
{
@@ -39,6 +39,7 @@ static SessionFactoryObjectFactory()
39
39
/// <param name="name">The name of the ISessionFactory.</param>
40
40
/// <param name="instance">The ISessionFactory.</param>
41
41
/// <param name="properties">The configured properties for the ISessionFactory.</param>
42
+ [ MethodImpl ( MethodImplOptions . Synchronized ) ]
42
43
public static void AddInstance ( string uid , string name , ISessionFactory instance , IDictionary < string , string > properties )
43
44
{
44
45
if ( log . IsDebugEnabled )
@@ -66,6 +67,7 @@ public static void AddInstance(string uid, string name, ISessionFactory instance
66
67
/// <param name="uid">The identifier of the ISessionFactory.</param>
67
68
/// <param name="name">The name of the ISessionFactory.</param>
68
69
/// <param name="properties">The configured properties for the ISessionFactory.</param>
70
+ [ MethodImpl ( MethodImplOptions . Synchronized ) ]
69
71
public static void RemoveInstance ( string uid , string name , IDictionary < string , string > properties )
70
72
{
71
73
if ( ! string . IsNullOrEmpty ( name ) )
@@ -81,11 +83,12 @@ public static void RemoveInstance(string uid, string name, IDictionary<string, s
81
83
/// </summary>
82
84
/// <param name="name">The name of the ISessionFactory.</param>
83
85
/// <returns>An instantiated ISessionFactory.</returns>
86
+ [ MethodImpl ( MethodImplOptions . Synchronized ) ]
84
87
public static ISessionFactory GetNamedInstance ( string name )
85
88
{
86
89
log . Debug ( "lookup: name=" + name ) ;
87
90
ISessionFactory factory ;
88
- bool found = NamedInstances . TryGetValue ( name , out factory ) ;
91
+ bool found = NamedInstances . TryGetValue ( name , out factory ) ;
89
92
if ( ! found )
90
93
{
91
94
log . Warn ( "Not found: " + name ) ;
@@ -98,6 +101,7 @@ public static ISessionFactory GetNamedInstance(string name)
98
101
/// </summary>
99
102
/// <param name="uid">The identifier of the ISessionFactory.</param>
100
103
/// <returns>An instantiated ISessionFactory.</returns>
104
+ [ MethodImpl ( MethodImplOptions . Synchronized ) ]
101
105
public static ISessionFactory GetInstance ( string uid )
102
106
{
103
107
log . Debug ( "lookup: uid=" + uid ) ;
0 commit comments