• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Use Read / Write lock patern permitted ?

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic