Originally posted by William Ni:
What I found interesting is that the database file name reflects the magical cookie value. For my URLyBird 1.2.3 assignment, the db file is "db-1x3.db" and the magical cookie value is "00 00 01 03"; while my friend is doing the Contractor assignment, her db file is "db-2x2.db" and the magical cookie value is "00 00 02 02". Of course, this is a bad choice as no official guarantee is provided.
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?