clean code remove unused dependency javatuple (#11976)

This commit is contained in:
shalk(xiao kun) 2024-04-24 15:51:58 +08:00 committed by GitHub
parent 17dea53d20
commit de10c07146
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 26 deletions

View File

@ -58,10 +58,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>nacos-common</artifactId>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>

View File

@ -18,8 +18,8 @@ package com.alibaba.nacos.consistency;
import com.alibaba.nacos.common.utils.Observable;
import com.alibaba.nacos.common.utils.Observer;
import com.alibaba.nacos.common.utils.Pair;
import com.alibaba.nacos.common.utils.StringUtils;
import org.javatuples.Pair;
import java.util.Map;
import java.util.TreeMap;
@ -37,13 +37,17 @@ public final class ProtocolMetaData {
private final Map<String, MetaData> metaDataMap = new ConcurrentHashMap<>(4);
/**
* used for jackson serialization.
*
* @return metaMap
*/
public Map<String, Map<Object, Object>> getMetaDataMap() {
return metaDataMap.entrySet().stream().map(entry -> Pair.with(entry.getKey(),
entry.getValue().getItemMap().entrySet().stream()
.collect(TreeMap::new, (m, e) -> m.put(e.getKey(), e.getValue().getData()), TreeMap::putAll)))
.collect(TreeMap::new, (m, e) -> m.put(e.getValue0(), e.getValue1()), TreeMap::putAll);
entry.getValue().getItemMap().entrySet().stream()
.collect(TreeMap::new, (m, e) -> m.put(e.getKey(), e.getValue().getData()), TreeMap::putAll)))
.collect(TreeMap::new, (m, e) -> m.put(e.getFirst(), e.getSecond()), TreeMap::putAll);
}
// Does not guarantee thread safety, there may be two updates of
// time-1 and time-2 (time-1 <time-2), but time-1 data overwrites time-2

View File

@ -75,11 +75,6 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -77,11 +77,6 @@
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>

View File

@ -138,7 +138,6 @@
<mysql-connector-java.version>8.0.33</mysql-connector-java.version>
<derby.version>10.14.2.0</derby.version>
<jjwt.version>0.11.2</jjwt.version>
<javatuples.version>1.2</javatuples.version>
<grpc-java.version>1.57.2</grpc-java.version>
<proto-google-common-protos.version>2.17.0</proto-google-common-protos.version>
<protobuf-java.version>3.22.3</protobuf-java.version>
@ -942,12 +941,6 @@
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
<version>${javatuples.version}</version>
</dependency>
<!-- gRPC dependency start -->
<dependency>
<groupId>io.grpc</groupId>