User implements HttpSessionBindingListener

public class User implements HttpSessionBindingListener {
private int id;
private String userName;
private String password;
private String email;

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

@Override
public void valueBound(HttpSessionBindingEvent arg0) {
//存入session时自动调用
Constants.ONLINE_USER_COUNT++;
}

@Override
public void valueUnbound(HttpSessionBindingEvent arg0) {
//从session中删除时自动调用
Constants.ONLINE_USER_COUNT--;
}

}

上一篇:项目中遇到的死锁问题: Lock wait timeout exceeded; try restarting transaction


下一篇:从模态视图push到另一个视图