Skip to content

Commit e5e4157

Browse files
committed
- remove spring utils (make it provided)
- change the method compute on the more productivity computeIfAbsent - a little style fixes in tests
1 parent 09a308c commit e5e4157

File tree

15 files changed

+30
-7164
lines changed

15 files changed

+30
-7164
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jdk:
33
- oraclejdk8
44

55
script:
6-
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.exclusions="src/main/java/com/antkorwin/xsync/springframework/util/*" -Dsonar.issue.ignore.multicriteria="e1" -Dsonar.issue.ignore.multicriteria.e1.ruleKey="squid:S00119" -Dsonar.issue.ignore.multicriteria.e1.resourceKey="**/*.java"
6+
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.issue.ignore.multicriteria="e1" -Dsonar.issue.ignore.multicriteria.e1.ruleKey="squid:S00119" -Dsonar.issue.ignore.multicriteria.e1.resourceKey="**/*.java"
77

88
addons:
99
sonarcloud:

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
<version>3.1.0</version>
5353
<scope>test</scope>
5454
</dependency>
55+
<dependency>
56+
<groupId>org.springframework</groupId>
57+
<artifactId>spring-core</artifactId>
58+
<version>5.0.7.RELEASE</version>
59+
<scope>provided</scope>
60+
</dependency>
5561
<dependency>
5662
<groupId>junit</groupId>
5763
<artifactId>junit</artifactId>

src/main/java/com/antkorwin/xsync/XMutex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@Getter
1313
public class XMutex<KeyT> {
1414

15-
private KeyT key;
15+
private final KeyT key;
1616

1717
public XMutex(KeyT key) {
1818
this.key = key;

src/main/java/com/antkorwin/xsync/XMutexFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.antkorwin.xsync;
22

33

4-
import com.antkorwin.xsync.springframework.util.ConcurrentReferenceHashMap;
4+
5+
6+
import org.springframework.util.ConcurrentReferenceHashMap;
57

68
import java.util.concurrent.ConcurrentMap;
79

@@ -51,7 +53,8 @@ public XMutexFactory(int concurrencyLevel,
5153
* then returns the same reference of the mutex.
5254
*/
5355
public XMutex<KeyT> getMutex(KeyT key) {
54-
return this.map.compute(key, (k, v) -> (v == null) ? new XMutex<>(k) : v);
56+
//return this.map.compute(key, (k, v) -> (v == null) ? new XMutex<>(k) : v);
57+
return this.map.computeIfAbsent(key, XMutex::new);
5558
}
5659

5760
/**

0 commit comments

Comments
 (0)