xsync
xsync copied to clipboard
Add StampedLockFactory and ReadWriteLockFactory
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
, andReadWriteLockFactoryTest
. - 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
Codecov Report
Merging #10 into master will increase coverage by
0.15%
. The diff coverage is100.00%
.
@@ 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.
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
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
2 Code Smells
No Coverage information
0.0% Duplication