This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line!
See this thread for details.
Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Notifying waiting clients when the database is shutdowned

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wondered how have you handled the clients that were waiting for
some record to be unlocked when the database is shutdowned.

In my opinion the only two possibilities to wake up the waiting threads are either to use notifyAll or to send them an InterruptedException. Before trying to wait again for the record to be unlocked, the value of a "shutdowned" flag must be read . In case that the flag is set, an exception must come to the client, telling it that the database was shutdowned..

What do you think about this scenario ?

What is the expert opinion : use notify or use InterruptedException. Which one is theoretically better suited for such a cancellation task ?

Thanks,
Liviu
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your assignment say to handle these scenarios:
-Server shutdown.
-Client Crash.
 
Liviu Carausu
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, client crashes and database shutdown are not mentioned in my specifications. But you are never sure how much is expected from you....
 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read This!
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

We deal here with two problems :
1.The close server - waiting clients
2.Crash clients

1.The close server - waiting clients
Well the problem is simple that it seams. The sever close process must wait until all the clients are ready with them tasks, more precisely if there are no locked records. If a client tries to gain access to a record and the record is locked the client must wait until the record is free but the client does not lock the record so it is not involved in a transaction - he just wait to be involved. So it is acceptable to end this threads with an exception. Even more precisely if there are waiting threads, this threads must be wake up, so before the you interrupt thread work flow (with an Exception) you must notify the rest of the (possible) waiting threads.

2.Crash clients

I am not shore if this is part of the exam but I am not so shore. I use RMI and I have th possibility to use the Unref. interface, but I am not so shore about. Any way you must document your decisions so at least you must mention in your choiches.txt how/why/etc with Crashed clients.

Regards M.
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

No, client crashes and database shutdown are not mentioned in my specifications. But you are never sure how much is expected from you....


Please notice an important issue that do what are asking to do with.

If you implement extra features correctly, NO bonus point is given.

However, if you implement extra features incorrectly, points will be deducted.

So, be careful.

Nick
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic