Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem in Andrew's Denny DVD -

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:
I think there is a mistake in Andrew's DVD example. Inside the book, it uses '' to handle the server shut down. When the user shut down the server, 'CleanExit' will called by the JVM and do some clean up.

* This method will be executed by the JVM when the application is shutdown.
* It ensures that the database is in a clean state for shutdown (that is,
* there are no outstanding writes occuring).
public void run() {"Ensuring a clean shutdown");
try {
DvdDatabase database = new DvdDatabase(dbLocation);
} catch (IOException e) {
log.log(Level.SEVERE, "Failed to lock database before exiting", e);

I assume this is wrong. Because it creates a new database and locks the new database. The real database which has been used by the clients has not been locked for clean up.

Could anyone address please!

Thank you very much!
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only one database can get lock.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic