Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need to created another database file to store the names of customers?

 
Harry Lufei
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do i need to create a new database to store the information of customers who booked seats or just add fields in db.db?
 
James McGee
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Harry Lufei
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
James McGee
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Kevin Yip
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic