Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it ok to NOT taking care of client crash?

 
Jin Zhang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I do not want to take of client crash in my code, because it is not required in the docs and the chance for one client to crash with a locked record is pretty low.

Is it ok? Anybody passed the exam without taking care of it?

Thanks.

Cheers,
Zhang Jin
 
Serkan Yazici
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jin,

I didn't implement any checks for client-crashing in my server code and didn't lose any marks for that. However I have mentioned this in my design choices document.

-- Serkan
 
Denis Spirin
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean "dead cliens", ie when client crashes while record is locked, then it is better to handle such situation. In my design I handled it and get 80 / 80 on locking mechanism.
[ June 04, 2004: Message edited by: Denis Spirin ]
 
Jin Zhang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks both of you!

80/80, wow! Pass is enough to me I think. Do not want to spend too much time on it. So... Serkan, may I know your score for the locking portion?

Cheers,
Zhang Jin
 
Stephen Galbraith
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that to max out in the locking area you MUST have a mechanism that will prevent the locking of a record if the client crashes out. I did this by using a thin client design with the unlock on the server in a finally block.

Also document your descision.

Steve.
(I too got 80/80 locking)
 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how it is best to implement this client crash issue? I'm pretty stuck.

Thanx for any help.

Jarvis
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jarvis,

If you implement a thin client (so the client calls a "book" method on the server which does the whole "lock - verify - update - unlock" process, then you should never need to deal with dead clients.

However if, like me, you think the client should be handling the booking process, then there is the potential for a client to die before disconnecting. (For more on the whole fat client / thin client issue, see the long thread "Should lock methods be callable by the client").

The easiest ways to handle this involve setting up a connection factory on the server. This way, each client will have a unique instance of the remote class which provides all the functionality. You then have two ways of handling client death:
  • Implement the Unreferenced interface, so that the instance of your remote class will eventually be notified if the client dies - you can then perform any clean up operations.
  • Use the instance of the remote object as the key in a WeakHashMap (with the object in the map being the lock), so that when the client dies, the lock will automagically be removed from the map (you may want to have an extra thread monitoring the status of the map).



  • I have deliberately not gone into detail on any of these - have a think about them, and see if you can work out how to move forward with them.

    Regards, Andrew
     
    Serkan Yazici
    Ranch Hand
    Posts: 33
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Jin Zhang:
    Hi,

    Thanks both of you!

    80/80, wow! Pass is enough to me I think. Do not want to spend too much time on it. So... Serkan, may I know your score for the locking portion?

    Cheers,
    Zhang Jin


    I've got 80/80 as well (without crashed client detection).
    [ June 11, 2004: Message edited by: Serkan Yazici ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic