• 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

lock -1

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did someone implemented lock(-1)? i think this is useful for local client. but iam confused with its implementation. can someone help me?
my logic:
client :
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it would probably be more useful in Remote mode. Because the only time it is called that way is when the server is being shutdown, and you want to close the database, but you don't want any clients to have a lock, and therefore corrupt the database when you close the database.
In Local mode isn't any need for locking of any kind.
Mark
 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
server shut down by pressing ctrlC. how can u issue -1 lock at that time?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't there a finalize method? like the one in Object.
Or maybe there is another way. I had a GUI for my server, so shutdown was the press of a button.
Mark
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I believe you shouldn't rely on the finalize method. At least thats what the spec says. Using a shutdown hook would also be possible, but again, it should be implemented with very few statements and probably wouldn't be appropriate, if your server takes a long time to shut down.
I would advise you to do like Mark says, add a gentle form for shutdown mechanism. You can do that either in a GUI (server) component or simply add a primitive prompt, in which users can enter "stop" or "exit".
 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If iam going to give a gui for server shutdown it will be total of 4 windows -
server - 1 dos prompt , 1 gui
client - 1 dos prompt , 1 gui.
thats why i didnt give gui for server. if i have to give gui, can i use Activation API and reduce the dos prompt. otherwise so many windows has to be kept open. i dont like that.
why do u guys think abt it ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic