I am developing an application that needs to prevent multiple login using the same user name and password.
If it happens on the same machine then obviously we need t
I would simply suggest using a security framework to handle all these details for you. Spring Security, for example, is fairly easy to integrate into an existing project, can be customised quite heavily if needs be - and most importantly, it has built-in support for detecting and controlling concurrent logins.
Don't reinvent the wheel when it's not needed, else you'll end up spending a good bit of time to create a bumpy wheel.