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

【feature】清理Backend无用代码 #1112

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 10 additions & 82 deletions sermant-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,72 +15,31 @@
<jdk.version>1.8</jdk.version>
<spring.boot.version>2.5.3</spring.boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.apache.tomcat.embed.version>9.0.43</org.apache.tomcat.embed.version>
<io.netty.version>4.1.75.Final</io.netty.version>
<spring-boot.version>2.5.8</spring-boot.version>
<frontend-maven-plugin.version>1.12.1</frontend-maven-plugin.version>
<webapp.path>${project.basedir}/src/main/webapp/frontend</webapp.path>
</properties>

<dependencyManagement>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.17.1</version>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${org.apache.tomcat.embed.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${org.apache.tomcat.embed.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${org.apache.tomcat.embed.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
<version>${org.apache.tomcat.embed.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down Expand Up @@ -128,11 +87,6 @@
<artifactId>protobuf-java</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -166,37 +120,11 @@
<version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-jute</artifactId>
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.6.3</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -217,7 +145,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<mainClass>com.huaweicloud.sermant.backend.NettyServerApplication</mainClass>
<mainClass>com.huaweicloud.sermant.backend.Backend</mainClass>
<outputDirectory>${package.output.dir}</outputDirectory>
</configuration>
<executions>
Expand All @@ -240,7 +168,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<mainClass>com.huaweicloud.sermant.backend.NettyServerApplication</mainClass>
<mainClass>com.huaweicloud.sermant.backend.Backend</mainClass>
<outputDirectory>${package.output.dir}</outputDirectory>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
*/
@SpringBootApplication
@ConfigurationPropertiesScan
public class NettyServerApplication {

public class Backend {
public static void main(String[] args) {
SpringApplication.run(NettyServerApplication.class, args);
SpringApplication.run(Backend.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package com.huaweicloud.sermant.backend.cache;

import com.huaweicloud.sermant.backend.entity.Consanguinity;
import com.huaweicloud.sermant.backend.entity.Contract;
import com.huaweicloud.sermant.backend.entity.ServerInfo;
import com.huaweicloud.sermant.backend.entity.ServiceType;
import com.huaweicloud.sermant.backend.entity.visibility.Consanguinity;
import com.huaweicloud.sermant.backend.entity.visibility.Contract;
import com.huaweicloud.sermant.backend.entity.visibility.ServerInfo;
import com.huaweicloud.sermant.backend.entity.visibility.ServiceType;

import com.alibaba.fastjson.JSONObject;

Expand All @@ -46,6 +46,11 @@ public class CollectorCache {
*/
public static final Map<String, ServerInfo> SERVER_MAP = new ConcurrentHashMap<>();

/**
* 服务有消息
*/
public static final Map<String, ServerInfo> SERVER_VALIDITY_PERIOD_MAP = new ConcurrentHashMap<>();

private static final Logger LOGGER = LoggerFactory.getLogger(CollectorCache.class);

private CollectorCache() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,24 @@

package com.huaweicloud.sermant.backend.cache;

import com.huaweicloud.sermant.backend.entity.HeartbeatEntity;
import com.huaweicloud.sermant.backend.entity.ServerInfo;
import com.huaweicloud.sermant.backend.entity.heartbeat.HeartbeatMessage;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* 心跳数据缓存
*
* @author xuezechao
* @since 2022-02-15
* @author luanwenfei
* @since 2022-10-27
*/
public class HeartbeatCache {
private static Map<String, HeartbeatEntity> heartbeatMessages = new ConcurrentHashMap<>();

private static Map<String, ServerInfo> lastHeartBeatDate = new ConcurrentHashMap<>();
private static final Map<String, HeartbeatMessage> HEARTBEAT_MESSAGE_MAP = new ConcurrentHashMap<>();

private HeartbeatCache() {
}

public static Map<String, HeartbeatEntity> getHeartbeatMessages() {
return heartbeatMessages;
}

public static Map<String, ServerInfo> getHeartbeatDate() {
return lastHeartBeatDate;
public static Map<String, HeartbeatMessage> getHeartbeatMessageMap() {
return HEARTBEAT_MESSAGE_MAP;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ public void addViewControllers(ViewControllerRegistry registry) {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(false)
.allowedMethods("POST","GET","DELETE","PUT","OPTIONS")
.allowedOrigins("*")
;
registry.addMapping("/**").allowCredentials(false).allowedMethods("POST", "GET", "DELETE", "PUT", "OPTIONS")
.allowedOrigins("*");
}
}

This file was deleted.

Loading