Hi you all guys.
I'm nearly finish my assingment, but still have a question puzzle me when
checking my locking mechanism.My implemention at server side only one instance of data class,and all clients share same refrence of data object through RMI.Currently, i synchronize both lock and unlock method.
My confusion is:
If synchronize a method, that means only one
thread can access it at a time.Suppose a thread enter the lock method and wait a former thread to unluck a record,meanwhile,no other threads could access lock method.But our purpuse is allow all threads enter lock method and wait(if need) rather than wait outside lock method.On the other hand, multi-thread access single method may arise issues.What i should do or any other better solution?
Any comment?
[ November 01, 2004: Message edited by: Po Sun ]