• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One instance of application at a time use database file

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

In instruction is written
"You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server."

Let say in standalone mode user starts application , now again he is going to start the application but at

most one program is accessing the database file

, how to do implement this logic when user is going to instance another instance of application , he shoud get message like "database file is already in use" .
how to do this?
how to get lock on database file ?

Regards,
Pramod



 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Pramod!

Partner, this is just to indicate that you don't have to worry about another application accessing the database concurrently with your application. So when you start the server, only your application will be accessing it, so you can, for instance, load all records to a cache in memory. So you don't really have to implement anything. Also, I assumed that only one instance of the application would be running at a time.
 
pramod karnani
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roberto,

So you did not implement this .
But what should happen if

once user started application in standalone mode.
Again user will start the application in standalone mode on same machine (same JVM) ,will application start again ? or we should give Alert message "Application is already running and database file is in used" ?
or second instance of application will start?
will Sun tester do this kind of testing of assignment ?
or Sun tester will not do this kind of testing?
I am just asking what will happen ?
what do you think?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pramod,

It's like Roberto tells you: if you may assume that just one application will access the database file, then you have to implement nothing at all. And the Sun tester will not try to do this, because that's against the instructions they gave you. So it would be stupid for him to try something like that.

You could always (it's your choice) implement something preventing this and you would add that to your choices-document, i guess then the sun tester will try to see if it works and if your solution fails, some points will be deducted. If your solution works, you will not receive extra points. Conclusion: you could only loose by doing it, so don't do it (and that's the opposite of the Nike slogan )
 
reply
    Bookmark Topic Watch Topic
  • New Topic