Revision 1125
Added by Jing Tao over 22 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
105 | 105 |
|
106 | 106 |
private ServletConfig config = null; |
107 | 107 |
private ServletContext context = null; |
108 |
//private Hashtable connectionPool = new Hashtable(); |
|
109 | 108 |
private String resultStyleURL = null; |
110 | 109 |
private String xmlcatalogfile = null; |
111 | 110 |
private String saxparser = null; |
... | ... | |
115 | 114 |
private String htmlpath = null; |
116 | 115 |
private PropertyResourceBundle options = null; |
117 | 116 |
private MetaCatUtil util = null; |
117 |
private DBConnectionPool connPool = null; |
|
118 | 118 |
|
119 | 119 |
/** |
120 | 120 |
* Initialize the servlet by creating appropriate database connections |
... | ... | |
127 | 127 |
System.out.println("MetaCatServlet Initialize"); |
128 | 128 |
|
129 | 129 |
util = new MetaCatUtil(); |
130 |
|
|
131 |
//initial DBConnection pool |
|
132 |
connPool = DBConnectionPool.getInstance(); |
|
130 | 133 |
|
131 | 134 |
// Get the configuration file information |
132 | 135 |
resultStyleURL = util.getOption("resultStyleURL"); |
... | ... | |
137 | 140 |
servletpath = util.getOption("servletpath"); |
138 | 141 |
htmlpath = util.getOption("htmlpath"); |
139 | 142 |
|
140 |
// MOVED IT TO doGet() & doPost() |
|
141 |
// try { |
|
142 |
// // Open a pool of db connections |
|
143 |
// connectionPool = util.getConnectionPool(); |
|
144 |
// } catch (Exception e) { |
|
145 |
// System.err.println("Error creating pool of database connections"); |
|
146 |
// System.err.println(e.getMessage()); |
|
147 |
// } |
|
143 |
|
|
148 | 144 |
} catch ( ServletException ex ) { |
149 | 145 |
throw ex; |
146 |
} catch (SQLException e) { |
|
147 |
MetaCatUtil.debugMessage("Error in MetacatServlet.init: " |
|
148 |
+e.getMessage(), 20); |
|
150 | 149 |
} |
151 | 150 |
} |
152 | 151 |
|
... | ... | |
158 | 157 |
if (util != null) { |
159 | 158 |
util.closeConnections(); |
160 | 159 |
} |
160 |
connPool.release(); |
|
161 | 161 |
} |
162 | 162 |
|
163 | 163 |
/** Handle "GET" method requests from HTTP clients */ |
... | ... | |
1389 | 1389 |
|
1390 | 1390 |
// get connection from the pool |
1391 | 1391 |
conn = util.getConnection(); |
1392 |
AccessControlList aclobj = new AccessControlList(conn);
|
|
1392 |
AccessControlList aclobj = new AccessControlList(); |
|
1393 | 1393 |
String acltext = aclobj.getACL(docid, username, groupnames); |
1394 | 1394 |
out.println(acltext); |
1395 | 1395 |
|
Also available in: Unified diff
Add DBConnectionPool object in servlet's init method and DBConnectionPool's release method in servlet's destory method.