• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data.java

 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure question might have asked but need to clarify my assumption...

1. Data.java has to implement all locking thing because assignment has mention that clearly


Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above.


So all Synchronized thing has to be implemented by Data.java.

I think someone got failed for not doing that.

Thanks
[ May 27, 2005: Message edited by: Ken Boyd ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11866
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ken,

I am not sure what your question is.

If you are asking whether the locking code can exist in some other class than the Data class - I believe it can be, as long as the Data class acts as a front end to the locking methods (Facade pattern).

If you are asking whether methods that call the Data class' locking methods can be synchronised (or can contain synchronized blocks) - why not?

Or are you asking something else?

Regards, Andrew
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
My question is you have to provide locking mechanism in Data.java class (it is must according to above quote from assignment document) If you provide them in other class then SUN will fail you. So you have to provide all locking in Data.java and provide wrapper class to access all methods of Data.java

kind of answer myself but need validation from you.

Thanks,
Ken
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11866
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ken,

Originally posted by Ken Boyd
So you have to provide all locking in Data.java


When you have completed your coding of the Data class then any user of the Data class (whether the server you write, or some other programs that somebody else writes) must be able to call the lock methods of your Data class and obtain a logical lock on the requested record (or block until the logical lock is available).

Originally posted by Ken Boyd
So you have to [...] provide wrapper class to access all methods of Data.java


Personally I agree with that statement. However there are many who disagree. You might like to take a look at the topic "Should lock methods be callable by the client" for arguments for and against this position. It is worth noting that candidates do not appear to loose marks for not having such wrapper classes.

Regards, Andrew
 
Ken Boyd
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know Eric(65515) got fail because he didn't provide locking in Data.java (instead in wrapper class). So it is must to have locking in Data.java, so SUN can directly test it using other program or software.
I will provide wrapper class with different method name which in turn calls lock & unlock methods of Data.java.

Hope I am clear and right as well.

Thanks,
Ken
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic