This doesn't sound like a requirement in the assignment. Can you copy the quote from the instructions that would lead you to think you need to include customer names?
posted 18 years ago
Hi James: Thank you for your reply I just notice the following in the instructions: "The user must be able to book one or more seats on a chosen flight. If the flight cannot provide those seats, teh user must be informed." After seen your reply, I think I make thing unnecessarily complicated. And I have some other problems unclearly: One: Suppose I implement this assignment by RMI, all clients use the same remote object on the server or each client can lookup a new remote object? If only one server object exist in the server another question is: In the source code supplied by Sun, method writeRecord is a private non-synchronized method. This method is called by add and modify, both these are public synchronized methods. My understanding is, when a synchronized method calls a non-synchronized method, the object that owns the synchronized method is still locked while non-synchronized method is being executed. If this is true, then why do we need lock, unlock methods ? In fact, I think, the only methods that need to be synchronized are seek and writeRecord, because this is where the shared data is manipulated. Your answer is very much appreciated. Thanks
posted 18 years ago
For your first question I think most people agree that Sun wants you to have two options for processing. 1) Local (one client, one DB) 2) Network (many clients, one DB) To me that means that I'll only have one DB object whether it's on the server or on a local machine. For your second question I honestly haven't started looking at making things thread safe yet, so I don't want to hazard a guess yet. Once I get to that point I'll jot my comments back here...
Harry, writeRecord() is a private method and it is only called by add() and modify(), both of which are synchronized. I don't see any problem as when one user calls, say, the add() method, another user cannot call the modify() method. As such, writeRecord() cannot be called by more than one user. Why lock/unlock mechanism? I think this is to provide a mechanism for a user to wait for the lock to modify the record. And it also embodies the concept of one complete transaction, lock -> start transaction -> finish transaction -> unlock.
[This message has been edited by Kevin Yip (edited August 14, 2001).]
Legend has it that if you rub the right tiny ad, a genie comes out.
Devious Experiments for a Truly Passive Greenhouse!