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

Use Read / Write lock patern permitted ?

 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am thinking about using the ReadWriteLock pattern by Mark Grand to implement thread safety for my Data class (URLyBird 1.3.3).
However, my instructions say:

you must not submit any code that is not your own work


I have seen posts in this forum that almost literally copy the code from the book "Patterns in Java Volume 1" by Grand that has the ReadWriteLock concurrency pattern. Just do a search on "ReadWriteLock" and you will find it.

How can I use this pattern and NOT violate the above mentioned "MUST" ? Violating a must results in automatic failure ...

Regards,
Ronald Wouters
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess everyone has the same assignment for the java developer exam.
I got mine yesterday, and would be starting on the same soon.

I guess using a pattern should be fine, but they way you implement it, should be ok.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ronald,

You can use any pattern you like - but it has to be your implementation of the pattern.

Personally, if I was planning on using a ReadWriteLock, I would use JDK 5 to develop the assignment, as it has a ReadWriteLock class already built in.

Regards, Andrew
 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew for your suggestion.

I am currently reading the book "Java Threads, 3th Edition" by Scot Oaks and Henry Wong. I am at chapter five but after your suggestion I browsed thru the book and believe it or not but chapter six talks about new synchronization classes added in J2SE 5.0 like Semaphore, CyclicBarrier, CountDownLatch, Exchanger and yes, the interface ReadWriteLock and an implementation called ReentrantReadWriteLock ... eureca !
I will most certainly give that my full attention when I get to that chapter.
I thought I knew my Thread stuff reasonably well. Skimming thru that chapter makes me second guess that. The explicit Lock stuff I just read about in chapter five was also very interesting...
Anyway, thanks again for your suggestion.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic