I'm not sure if this should be in this forum, the
tomcat forum, or the distributed
java forum. Sorry if I guess the wrong one (feel free to move it).
I'm attempting to broker all user access to the backend through a java user interface class User.java which contains an rmi connection to my database server. When a user logs in, User.java creates a connection to the database:
public User(String user, String pass) {
...
database = (Database)Naming.lookup("//" + ipDatabase + "/Database");
}
Upon successful login, the User class is stored to the
jsp session:
User user = new User(username, password);
...
session.setAttribute("user", user);
When the session expires, will the connections to the database server be closed properly or do I need to add code to do this?
If so, I'd appreciate some advise. If a user goes to the logout page, I could call something like:
User user = (User)session.getValue("user");
user.close();
session.invalidate();
but that wouldn't clean up the sessions that time out.