• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock -1

 
Reshma Das
Ranch Hand
Posts: 125
  • 0
  • Mark post as helpful
  • send pies
  • 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 :
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
server shut down by pressing ctrlC. how can u issue -1 lock at that time?
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Nicky Moelholm
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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 ?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic