Skip to content

Commit

Permalink
refactor: update docean java21 (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
sadadw1 authored Dec 25, 2023
2 parents f684d9f + 381b67c commit ee667e3
Show file tree
Hide file tree
Showing 31 changed files with 82 additions and 89 deletions.
2 changes: 1 addition & 1 deletion jcommon/aop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>aop</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
Expand Down
2 changes: 1 addition & 1 deletion jcommon/buddy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
8 changes: 4 additions & 4 deletions jcommon/codecheck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>codecheck</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>dom4j</groupId>
Expand All @@ -18,7 +18,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>infra-result</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -33,8 +33,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>20</source>
<target>20</target>
<source>21</source>
<target>21</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
Expand Down
4 changes: 2 additions & 2 deletions jcommon/codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>codegen</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
Expand Down Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>infra-result</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>thrift</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jcommon/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jcommon/crypto/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
1 change: 1 addition & 0 deletions jcommon/docean-plugin/docean-plugin-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean-plugin-api</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
</project>
1 change: 1 addition & 0 deletions jcommon/docean-plugin/docean-plugin-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean-plugin-config</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
</project>
1 change: 1 addition & 0 deletions jcommon/docean-plugin/docean-plugin-datasource/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean-plugin-datasource</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>run.mone</groupId>
Expand Down
3 changes: 2 additions & 1 deletion jcommon/docean-plugin/docean-plugin-db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean-plugin-db</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>run.mone</groupId>
Expand All @@ -17,7 +18,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean-plugin-datasource</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
Expand Down
7 changes: 4 additions & 3 deletions jcommon/docean-plugin/docean-plugin-sql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean-plugin-sql</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean-plugin-api</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean-plugin-datasource</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean-plugin-config</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion jcommon/docean-plugin/docean-plugin-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean-plugin-db</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
Expand Down
10 changes: 5 additions & 5 deletions jcommon/docean-spring-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<artifactId>jcommon</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<version>1.4-jdk21-SNAPSHOT</version>

<artifactId>docean-spring-starter</artifactId>

Expand All @@ -31,7 +32,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>docean</artifactId>
<version>1.4-java20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -47,12 +48,11 @@
<version>3.11.0</version>
<configuration>
<compilerArgs>
<arg>--add-modules=jdk.incubator.concurrent</arg>
<arg>--enable-preview</arg>
</compilerArgs>
<compilerVersion>20</compilerVersion>
<source>20</source>
<target>20</target>
<compilerVersion>21</compilerVersion>
<source>21</source>
<target>21</target>
</configuration>
</plugin>

Expand Down
11 changes: 5 additions & 6 deletions jcommon/docean/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>docean</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
<properties>
<netty.version>4.1.97.Final</netty.version>
</properties>
<dependencies>
<dependency>
<groupId>run.mone</groupId>
<artifactId>easy</artifactId>
<version>1.4-jdk20-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
Expand Down Expand Up @@ -58,12 +58,11 @@
<version>3.11.0</version>
<configuration>
<compilerArgs>
<arg>--add-modules=jdk.incubator.concurrent</arg>
<arg>--enable-preview</arg>
</compilerArgs>
<compilerVersion>20</compilerVersion>
<source>20</source>
<target>20</target>
<compilerVersion>21</compilerVersion>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
package com.xiaomi.youpin.docean.mvc;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.xiaomi.youpin.docean.anno.RequestParam;
import com.xiaomi.youpin.docean.exception.DoceanException;
import com.xiaomi.youpin.docean.mvc.httpmethod.HttpMethodUtils;
import io.netty.handler.codec.http.QueryStringDecoder;

Expand Down Expand Up @@ -47,9 +45,11 @@ public static JsonArray getParams(HttpRequestMethod method, String uri) {
RequestParam param = getRequestParam(it);
String name = param.value();
if (!params.containsKey(name)) {
throw new DoceanException("Missing parameter:" + name);
array.add("");
// throw new DoceanException("Missing parameter:" + name);
} else {
array.add(params.get(name));
}
array.add(params.get(name));
}
});
return array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpResponseStatus;
import jdk.incubator.concurrent.ScopedValue;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.xiaomi.youpin.docean.mvc.common;

import com.xiaomi.youpin.docean.mvc.MvcContext;
import jdk.incubator.concurrent.ScopedValue;

/**
* @author [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.xiaomi.youpin.docean.test;

import com.xiaomi.youpin.docean.test.bo.M;
import jdk.incubator.concurrent.ScopedValue;
import lombok.SneakyThrows;
import org.checkerframework.checker.units.qual.C;
import org.junit.Test;

import java.util.concurrent.CountDownLatch;
Expand All @@ -30,23 +28,21 @@ public void test1() {

ScopedValue<M> sv = ScopedValue.newInstance();

IntStream.range(0, num).parallel().forEach(it -> {
pool.submit(() -> {
M m = new M();
m.setId(it);
ScopedValue.where(sv, m).run(() -> {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
i.incrementAndGet();
System.out.println(sv.get().getId());
latch.countDown();
});

IntStream.range(0, num).parallel().forEach(it -> pool.submit(() -> {
M m = new M();
m.setId(it);
ScopedValue.where(sv, m).run(() -> {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
i.incrementAndGet();
System.out.println(sv.get().getId());
latch.countDown();
});
});

}));
latch.await();
;
System.out.println(i);
Expand Down
1 change: 1 addition & 0 deletions jcommon/easy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<version>1.4-jdk20-SNAPSHOT</version>
</parent>
<artifactId>easy</artifactId>
<version>1.4-jdk21-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>cglib</groupId>
Expand Down
20 changes: 11 additions & 9 deletions jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* @author [email protected]
*/
@Slf4j
public class LogFile implements ILogFile{
public class LogFile implements ILogFile {

@Getter
private String file;
private String file;

private MoneRandomAccessFile raf;

Expand All @@ -38,13 +38,15 @@ public class LogFile implements ILogFile{
@Getter
private int beforePointerHashCode;

private long pointer;
@Getter
private volatile long pointer;

//行号
private long lineNumber;

//每次读取时文件的最大偏移量
private long maxPointer;
@Getter
private volatile long maxPointer;

private String md5;

Expand All @@ -71,14 +73,14 @@ public LogFile(String file, ReadListener listener, long pointer, long lineNumber

private void open() {
try {
//日志文件进行切分时,减少FileNotFoundException概率
TimeUnit.SECONDS.sleep(5);
//日志文件进行切分时,减少FileNotFoundException概率,这个应该删掉了,在使用前保证就好了,由于历史原因,降低了休眠时间
// TimeUnit.SECONDS.sleep(1);
//4kb
this.raf = new MoneRandomAccessFile(file, "r", 1024 * 4);
reOpen = false;
reFresh = false;
} catch (InterruptedException e) {
log.error("open file InterruptedException", e);
// } catch (InterruptedException e) {
// log.error("open file InterruptedException", e);
} catch (FileNotFoundException e) {
log.error("open file FileNotFoundException", e);
} catch (IOException e) {
Expand Down Expand Up @@ -238,7 +240,7 @@ public String md5(String msg) {
md.update(msg.getBytes());
byte[] digest = md.digest();
StringBuilder sb = new StringBuilder(2 * digest.length);
for(byte b : digest) {
for (byte b : digest) {
sb.append(String.format("%02x", b & 0xff));
}
return sb.toString().toUpperCase();
Expand Down
2 changes: 1 addition & 1 deletion jcommon/graalvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Loading

0 comments on commit ee667e3

Please sign in to comment.