I'm going to use multiable Data object in server part, each
thread has their own Data object.
I'm wondering under this situation if there are two client need to modify different record in database at the same time what will happend?
Does SUN allow several file handlers to modify the different part of the dbfile at same time?
such as client-no.1 need to update record[1] , client-no.2 need to update record[3]
because they are updating different record , we needn't use locking mechanism to lock record[1] or record[3].
becasue I ust mutilable data object to implement my project , each client has their own Data object and file handler.
And because each thread has their own Data object the "synchronize" will not work for different Data object ,even I synchronize all write() , update() , modify() method.
That means , different client could modify data file at the same time and It can't be avoid.
is it allowed, or is it safe. if not, is there a good way to avoid this happened.
I can only find one way to avoid this situation, declare a static file handler object in Data class, so all different data object will share same file handler and I can synchronize this file handler object in write() update() method .
I don't know is it a good way or not, anyone has a better idea about it.
thank you very much.