Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StampedLockFactory and ReadWriteLockFactory #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

l0s
Copy link
Contributor

@l0s l0s commented Jun 22, 2020

This adds two new factories that generate StampedLock and ReadWriteLock instances for applications that require more granular control over locking. The unit tests duplicate the verifications in XMutexFactoryImplTest and also introduce verifications specific to the synchronisation mechanisms.

Some things I considered, but did not end up implementing:

  • Create a common base test class for the common verifications used by XMutexFactoryImplTest, StampedLockFactoryTest, and ReadWriteLockFactoryTest.
  • Adding an interface and impl class for the new factories. It did not appear that multiple implementations for XMutexFactory were actually used and it was not clear to me why clients would provide a custom implementation.

I would be happy to revisit these, of course.

Addresses: #9

This adds two new factories that generate `StampedLock` and
`ReadWriteLock` instances for applications that require more granular
control over locking. The unit tests duplicate the verifications in
`XMutexFactoryImplTest` and also introduce verifications specific to the
synchronisation mechanisms.

Addresses: antkorwin#9
@codecov-commenter
Copy link

Codecov Report

Merging #10 into master will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #10      +/-   ##
============================================
+ Coverage     99.16%   99.32%   +0.15%     
- Complexity       37       51      +14     
============================================
  Files             4        6       +2     
  Lines           120      148      +28     
  Branches         10       10              
============================================
+ Hits            119      147      +28     
  Partials          1        1              
Impacted Files Coverage Δ Complexity Δ
...java/com/antkorwin/xsync/ReadWriteLockFactory.java 100.00% <100.00%> (ø) 8.00 <8.00> (?)
...n/java/com/antkorwin/xsync/StampedLockFactory.java 100.00% <100.00%> (ø) 6.00 <6.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a1bb6c...a2bfe30. Read the comment docs.

@l0s
Copy link
Contributor Author

l0s commented Jun 22, 2020

As an aside, while developing this, I noticed that the project builds fine with Java 9, but fails with Java 10 or higher. It produces this error during the testCompile phase:

java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags

@sonarcloud
Copy link

sonarcloud bot commented May 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants