@@ -9,43 +9,17 @@ namespace NHibernate.Connection
9
9
/// <summary>
10
10
/// A ConnectionProvider that uses an IDriver to create connections.
11
11
/// </summary>
12
- /// <remarks>
13
- /// This IConnectionProvider implements a rudimentary connection pool.
14
- /// </remarks>
15
12
public class DriverConnectionProvider : ConnectionProvider
16
13
{
17
14
private static readonly log4net . ILog log = log4net . LogManager . GetLogger ( typeof ( DriverConnectionProvider ) ) ;
18
- private static object poolLock = new object ( ) ;
19
- private readonly ArrayList pool = new ArrayList ( ) ;
20
15
21
- private int checkedOut = 0 ;
22
-
23
16
public DriverConnectionProvider ( )
24
17
{
25
18
}
26
19
27
20
28
21
public override IDbConnection GetConnection ( )
29
22
{
30
- if ( log . IsDebugEnabled ) log . Debug ( "total checked-out connections: " + checkedOut ) ;
31
-
32
- lock ( poolLock )
33
- {
34
- if ( pool . Count > 0 )
35
- {
36
- int last = pool . Count - 1 ;
37
- if ( log . IsDebugEnabled )
38
- {
39
- log . Debug ( "using pooled connection, pool size: " + last ) ;
40
- checkedOut ++ ;
41
- }
42
-
43
- IDbConnection conn = ( IDbConnection ) pool [ last ] ;
44
- pool . RemoveAt ( last ) ;
45
- return conn ;
46
- }
47
- }
48
-
49
23
log . Debug ( "Obtaining IDbConnection from Driver" ) ;
50
24
try
51
25
{
@@ -68,38 +42,13 @@ public override bool IsStatementCache
68
42
public override void Close ( )
69
43
{
70
44
log . Info ( "cleaning up connection pool" ) ;
71
-
72
- for ( int i = 0 ; i < pool . Count ; i ++ )
73
- {
74
- try
75
- {
76
- ( ( IDbConnection ) pool [ i ] ) . Close ( ) ;
77
- }
78
- catch ( Exception e )
79
- {
80
- log . Warn ( "problem closing pooled connection" , e ) ;
81
- }
82
- }
83
-
84
- pool . Clear ( ) ;
85
45
}
86
46
87
47
public override void CloseConnection ( IDbConnection conn )
88
48
{
89
- if ( log . IsDebugEnabled ) checkedOut -- ;
90
-
91
- lock ( poolLock )
92
- {
93
- int currentSize = pool . Count ;
94
- if ( currentSize < PoolSize )
95
- {
96
- if ( log . IsDebugEnabled ) log . Debug ( "returning connection to pool, pool size: " + ( currentSize + 1 ) ) ;
97
- pool . Add ( conn ) ;
98
- return ;
99
- }
100
- }
101
-
102
49
base . CloseConnection ( conn ) ;
50
+ //TODO: make sure I want to do this - pretty sure I do because of Oracle problems.
51
+ conn . Dispose ( ) ;
103
52
}
104
53
105
54
0 commit comments