更新依赖;去除无用代码

This commit is contained in:
chuzhongzai 2023-11-25 15:33:14 +08:00
parent b0f27784dc
commit 55c28d358c
6 changed files with 26 additions and 39 deletions

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
@ -7,7 +8,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

40
pom.xml
View File

@ -9,8 +9,8 @@
<version>1.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -18,7 +18,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.86.Final</version>
<version>4.1.101.Final</version>
</dependency>
<dependency>
@ -30,7 +30,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
</dependency>
<dependency>
@ -48,7 +48,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.18</version>
<version>5.8.20</version>
</dependency>
<dependency>
@ -61,26 +61,30 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.28</version>
<executions>
<execution>
<phase>package</phase>
<id>native</id>
<goals>
<goal>single</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>lion.Main</mainClass>
</manifest>
</archive>
<mainClass>lion.Main</mainClass>
<imageName>storageNode</imageName>
<fallback>false</fallback>
<verbose>true</verbose>
<quickBuild>true</quickBuild>
<buildArgs>
<arg>-H:+ReportExceptionStackTraces</arg>
</buildArgs>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
</configuration>
</plugin>
</plugins>

View File

@ -1,17 +1,7 @@
package lion;
import lion.ErrorCode.ErrorCode;
import lombok.extern.log4j.Log4j;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.SocketChannel;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
@Log4j
public class Main {
@ -21,8 +11,4 @@ public class Main {
new storageNode();
}
}

View File

@ -32,7 +32,6 @@ public class MessageCodec extends ByteToMessageCodec<AbstractMessage> {
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
byte messageType = byteBuf.readByte();
int length = byteBuf.readInt();
System.out.println(length);
byte[] bytes = new byte[length];
byteBuf.readBytes(bytes);
final String metadata = new String(bytes, StandardCharsets.UTF_8);

View File

@ -18,8 +18,7 @@ public class MultiThreadedHTTPServer {
String real_ip;
try{
real_ip = InetAddress.getByName("lionwebsite.xyz").getHostAddress();
}
catch (UnknownHostException ignored){
} catch (UnknownHostException ignored){
real_ip = "207.60.50.74";
}
try(ServerSocket serverSocket = new ServerSocket(PORT)) {

View File

@ -59,10 +59,8 @@ public class storageNode {
channel.pipeline().addLast(new LengthFieldBasedFrameDecoder(100000000, 1, 4));
channel.pipeline().addLast(new MessageCodec());
channel.pipeline().addLast(new MyChannelInboundHandlerAdapter(tempQueue));
}
}).option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true)
})
.bind(26321);
log.info("listen port:8080");