Lock Pattern #71: Added mutex and semaphore modules to demonstrate locks #397
Conversation
Added two modules to demonstrate locks. Mutex demonstrates a simple mutual exclusion lock. Semaphore demonstrates a semaphore for controlling access to a pool of resources. The main class of both programs is App.java.
|
Hi, just thought I'd check if anyone has had the opportunity to review this yet. i understand I haven't put any documentation in here yet but I just wanted to see if this is what you wanted to demonstrate the pattern |
|
@gwildor28 It will be picked up for review soon. |
|
OK thanks |
|
Review comments:
|
| */ | ||
| public class Jar { | ||
|
|
||
| private Lock lock; |
|
@gwildor28 you have my review comments. Please comment on this thread once you've addressed them so we'll do another review. |
- Added descriptions - Added junit tests - Added javadoc - Added index.md - Added class diagrams
|
I've addressed the items listed in the review comments in my commit 2 days ago |
|
@gwildor28 there are merge conflicts. Can you pull the latest changes into your fork from the master? |
|
I've merged your code into my branch, unfortunately Maven is complaining of problems in project dao. The first issue is a missing version tag in the pom.xml file, for junit-hierarchicalcontextrunner. Even after putting the tag in the file, Maven fails the tests for this project: com.iluwatar.dao.AppTest - fails with a java.io.IOException related to the location of the database Have you added any requirements for other software to be installed on this system? |
|
@gwildor28 I am the culprit for these errors. I will solve them first thing tomorrow. Sorry for the delay |
|
No problem. |
|
hi @npathai have you been able to look at this yet? |
|
@gwildor28 Not yet. Give me a day, have been a bit busy. |
|
@npathai OK no problem |
|
Hi @npathai just thought to say I'm actually doing this lock pattern as part of a third year undergraduate degree module (open-source software) where I have to contribute to an existing open source project, The report is due on the 24th April and I'll get substantially more marks if I'm able to show a pull request of mine that got accepted. Do you think you'll realistically be able to sort out the errors within the next few days? Thanks |
|
All seems to have passed the checks now, please review. Thanks |
|
Looking quite good now @gwildor28 but still the tests are insufficient. Can you add unit test for |
|
Hi @iluwatar I've done the tests, please review. Thanks |
|
Good work @gwildor28 Great to see you pull this through! 😄 |
|
Thanks |
|
@all-contributors please add @gwildor28 for code |
|
I've put up a pull request to add @gwildor28! 🎉 |
Added two modules to demonstrate locks.
Mutex demonstrates a simple mutual exclusion lock. This is a binary lock which only allows one thread at a time to access the resource. See: Locks on Wikipedia
Semaphore demonstrates a semaphore for controlling access to a pool of resources. See Semaphores on Wikipedia
The main class of both programs is App.java.
I haven't created any documentation yet. Let me know if you want any changes or need some explanations of the code, etc.