Hello again,
I got a method to manage the case in which the user logoff the computer. It is using addShutdownHook(). An example:
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
System.out.println("Inside Add Shutdown Hook");
}
});
It works really good.
For the moment I have absolutely no idea how manage the user switching. Just needed a listener or a handle of users switchings!! But I dont find anything!!!!
--- Update ---
If I get a way to manage when a switch/wakeup/hibernate, etc takes place I could close the port and open again with the other user....I mean, at the end is same that free up the port...