• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FBN Locking Issue

 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
I have completed my FBN assignment.
Now I need to create the docs etc.
But I am facing a problem.
When a user has obtained a locked on a record, the other clients wait
for the record. I am using SwingWorker. All the waiting clients are shown a dialog wherein " Trying to acquire lock,pls wait" is dispalyed.
When the client acquires the lock teh correspnding code proceeds as normal.
Now if the user closes this wait dialog then the thread is still in wait state and the user is not abel to perform any operation.
I could think of the follwoing options
1). We confirm from the user whether to wait for the lock or not.
2). The wait should be a particulat time period after which teh user is again asked whether to still wait or do some other work.
But this requires that the lock mthd returns a boolean value signifying whether the lock is obtained or not.
Pls advise.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well to be honest, while your message popping up is a nice feature and in a real world you definitely do not want users waiting, this isn't necessary in your assignment.
In my submission I just had the client wait. So the client couldn't do anything, didn't get any message. I got 24/24 on the GUI portion. The only place I lost points was in the actual server, and this wasn't because of the client waiting.
So if you want you can remove the message completely. Or you can use a Swing thread to allow the users to continue while they are waiting, if you want.
Mark
 
Akshay Sharma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark,
I can think of two options to circumvent this.
1). I modify the signatures of lock and unlock to return a boolean.
or
2). I go as I have done and document it.
What do u suggest.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#1 is not an option. My suggestion was to have the client just wait, or use the existening woker threads in Swing.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic