| Dove |
Mon Apr 27 06:10:57 BST 2009 |
| |
Hi,
I've 150 client connect to server using spring remoting and within 10 seconds retrieve data from server. Is it correct if in 10 seconds i always call method getConnection?Is it consume more memory if i using this method ?
public static Connection getConnection() {
Context ctx = null;
try {
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/" + poolName);
return ds.getConnection();
} catch (SQLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
return null;
} catch (NamingException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
return null;
} finally {
if (ctx != null) {
try {
ctx.close();
} catch (NamingException ne) {
ne.printStackTrace();
}
}
}
}
Thanks in advance,
Rgds,
Dove |
| |
| sedj |
Thu Apr 30 18:57:56 BST 2009 |
| |
| Looks fine to me ... |