Hi, I've designed a nice Connection Server, which is registered with a well-known address and dishes out a remote Data Access object to everyone who asks its getConnection() method. And all this works fine... I donated my ConnectionServer a command that prints out the current number of active connections. And this works fine, too - and helped me to see the following problem: If Larry the rodent and his kumpel Rudi bite the cable (or - what has the same effect -if the user presses Ctrl-C to kill the VM whein which the client is running), the remote DataAccess object does not say good-bye. So, if my application is running for a longer time, and if the users are not well-behaved (they do not take the exit door but simply kill the VM to leave their clients), then my server is getting congested with shadow DataAccess objects that no longer have a counterpart at the other end of the line. Here are some solutions I can think of:
Don't do anything about this (no hear - no see - no speak).
Tell the users they must no use Ctrl-C on the VM, and in case they do, they should tell the Systems Admin (or alternatively let the examiner know that you are aware of this problem but you did not implement a solution for it)
Have the connection polling the client whether it's still alive (uaarrgh)
Do not let the client have a connection but let it send Joblets to the server (quite elegant).
I've also checked custom sockets - but this would only help to implement the polling solution.
Any comments on how to address this problem in the context of the SCJD exam is welcomed!!!