how can I control only one user could use the application at any time

I would like to my web application is only allowed one user to access, let's say if userA try to login while the application is being userd by userB, UserA login will fail until UserB logout.Could anyone post some example codes for me? I am not familiar with session usage, thx!
[293 byte] By [henry_22a] at [2007-11-27 4:16:12]
# 1
Implement kind of "UserFilter" or "LoginFilter" based on javax.servlet.Filter.Here are some examples:[url] http://www.google.com/search?q=%22class UserFilter implements Filter%22[/url][url] http://www.google.com/search?q=%22class LoginFilter implements Filter%22[/url]
BalusCa at 2007-7-12 9:22:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
could anyone kindly post some examples about Filter usage to cater for my above requirement. many thx!! I am newer on filter....
henry_22a at 2007-7-12 9:22:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
I already have provided you two very useful links. You are the developer here. We are just here to give you new insights, not to develop for you :)
BalusCa at 2007-7-12 9:22:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
In login servlet page , implements SingleThread interface
Rajesh3677a at 2007-7-12 9:22:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...