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

add, delete and modify

 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a public class RemoteDataImpl that extends UnicastRemoteObject and implements DataInterface
which has add,delete...and so on. I have a Data and LockManager as members.
1) Must i implement add and delete? If yes, during add and delete must i check if someone has locked the whole db?
2) My modify method looks like this:

The lockManager.isRecordLocked method is syncronized and checks if the client has a lock.
Any comments on that part?
Thank you all
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1) Must i implement add and delete? If yes, during add and delete must i check if someone has locked the whole db?

The add() and dlete() are already implemented in Data.java, but you don't need to worry about that because your client doesn't invoke these methods (it's not in the requirements).

2) My modify method looks like this:

Leave the modify() method of Data class along. The locking/unlocking should occur outside of the modify() method: lock-read-modify-unlock
Eugene.
[ March 05, 2003: Message edited by: Eugene Kononov ]
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer. I think I wasnt clear enought.
Leave the modify() method of Data class along. The locking/unlocking should occur outside of the modify() method: lock-read-modify-unlock

I have not touched modify() in Data. The method i showed is in a class that is implementing the same interface as Data. It has Data and a LockManager as members. So the modify method calls modify on Data.
The modify() method only checks if a lock as been made. The locking will not occur in of these classes.
DataInterface
/ / /
// /Data
//
//
/RemoteDataImpl
/
/
/
/
LocalDataImpl
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So the modify method calls modify on Data.

Oh, I see. The confusion comes from your best intention to make the outer modify() generic. I don't really think that it needs to be generic, -- after all, the client can only modify the "seats" field. So I would suggest that you rename your outer modify() to bookFlight() or something like this.
Eugene.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Woo-hoo I couldn't disagree more. Making your entire database server generic is a great idea. I mean, have a look at Data. Does that strike you as a class conceived specifically for the "Fly By Night" project? Well, no. It's completely generic. And you can make a very good case indeed for the assertion that the networked layer you build on top of Data should be just as generic as Data itself is. Reusability and all that jazz. The Data class gives you a very strong and hard to ignore hint there.
- Peter
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

And you can make a very good case indeed for the assertion that the networked layer you build on top of Data should be just as generic as Data itself is.

After some thought, I must tell that you are right once again, Peter. I am perhaps the biggest reuse advocate in the North-Eastern US, yet I recommended against my own convictions. So, Peter, have you ever been wrong or at least alleged to be wrong?
Eugene.
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, to conclude. The method i wrote in my first post is ok? A method calls lock-read-modify-unlock on for example RemoteDataImpl. The modfy method in RemoteDataImpl checks if the client has a lock and if yes it modifys.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic