Hi Goran,
Welcome to JavaRanch and this forum.
I have edited your post to put the code between [code] and [/code]
UBB tags. Doing this ensures that indenting is preserved, which makes the code easier to read.
When you are writing your post, there are a number of buttons just below the edit pane, which will insert the tags for you, so you don't have to remember what they are.
If you would like to edit your original post so that you can see what I have done, you can click on the
![]()
button that is just above
your post.
To clarify what Jon said, we try to limit the amount of code that is posted in this forum. However posting one method (like you have done) is fine. Our policy is described in the question "What is the policy on posting questions I saw on the exam / details of how to do the assignment?" in the JavaRanch
SCJD FAQ.
What is the best way to separate rmi and local mode in the Data class?
(How can i avoid lockin in local mode ?)
You can't.
Your method signatures require the use of the lock cookie. Therefore, even in local mode, you will still need the lock cookie in order to call the update method. Therefore you must still lock records even in single user mode.
While I agree that locking is not needed in single user mode, using the same locking logic allows reuse of code - always a good thing. And, as I said before, with the method signatures you have been given, you can't avoid it

.
Note that the Hashtable is synchronized, but you are calling it within a synchronized block. Therefore (as Jon mentioned) you are nesting synchronized blocks (implicitly, not explicitly) - this is a bad thing. Plus, you do not need the synchronization that Hashtables provide, so you may be better off looking at a different Collection object.
You have a lot of code inside your synchronized block. In general you want your synchronized block to be as small as possible. You might want to consider whether any of that code can be moved outside of the synchronized block.
You also have a case where you swallow the InterruptedException (catch it, but don't do anything with it) - this is generally considered a bad idea. You really should do something with that exception.
Regards, Andrew