New test.
[mono.git] / mcs / class / System.Data.OracleClient / System.Data.OracleClient / OracleConnectionPoolManager.cs
1 //
2 // OracleConnectionPoolManager.cs 
3 //
4 // Part of the Mono class libraries at
5 // mcs/class/System.Data.OracleClient/System.Data.OracleClient
6 //
7 // Assembly: System.Data.OracleClient.dll
8 // Namespace: System.Data.OracleClient
9 //
10 // Authors: 
11 //    Hubert FONGARNAND <informatique.internet@fiducial.fr>
12 //   
13 // (C) Copyright Hubert FONGARNAND, 2005
14 //
15 //
16 // Licensed under the MIT/X11 License.
17 //
18
19 using System;
20 using System.Collections;
21 using System.Collections.Specialized;
22 using System.ComponentModel;
23 using System.Data;
24 using System.Data.OracleClient.Oci;
25 using System.Drawing.Design;
26 using System.EnterpriseServices;
27 using System.Text;
28 using System.Threading;
29
30 namespace System.Data.OracleClient 
31 {
32         internal class OracleConnectionPoolManager 
33         {
34                 Hashtable pools = new Hashtable();
35                 
36                 public OracleConnectionPoolManager () 
37                 {
38                 }
39                 
40                 public OracleConnectionPool GetConnectionPool (OracleConnectionInfo info, int minPoolSize, int maxPoolSize) 
41                 {
42                         lock (pools) {
43                                 
44                                 OracleConnectionPool pool = (OracleConnectionPool) pools [info.ConnectionString];
45                                 if (pool == null) {
46                                         pool = new OracleConnectionPool (this, info, minPoolSize, maxPoolSize);
47                                         pools [info.ConnectionString] = pool;
48                                 }
49                                 return pool;
50                         }
51                 }
52                 
53                 public virtual OciGlue CreateConnection (OracleConnectionInfo info) 
54                 {
55                         OciGlue oci;
56                         oci = new OciGlue ();
57                         oci.CreateConnection (info);
58                         return oci;
59                 }
60
61                 public void Dispose () 
62                 {
63                         if (pools != null) {
64                                 foreach (OracleConnectionPool pool in pools)
65                                         pool.Dispose ();
66                                 pools.Clear ();
67                                 pools = null;
68                         }
69                 }
70
71                 ~OracleConnectionPoolManager () 
72                 {
73                         Dispose ();
74                 }
75         }
76 }
77