提交 b423da81 编写于 作者: oldratlee's avatar oldratlee 🔥

add jdk 13 in travis-ci

上级 455befa7
...@@ -75,6 +75,10 @@ script: ...@@ -75,6 +75,10 @@ script:
- switch_to_open_jdk12 - switch_to_open_jdk12
- ./scripts/run-junit.sh skipClean - ./scripts/run-junit.sh skipClean
- ./scripts/run-agent-test.sh skipClean - ./scripts/run-agent-test.sh skipClean
# open jdk 12
- switch_to_open_jdk13
- ./scripts/run-junit.sh skipClean
- ./scripts/run-agent-test.sh skipClean
after_success: after_success:
# codecov # codecov
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
👉 The missing Java™ std lib(simple & 0-dependency) for framework/middleware, 👉 The missing Java™ std lib(simple & 0-dependency) for framework/middleware,
provide an enhanced `InheritableThreadLocal` that transmits `ThreadLocal` value between threads even using thread pooling components. provide an enhanced `InheritableThreadLocal` that transmits `ThreadLocal` value between threads even using thread pooling components.
Support `Java` 12/11/10/9/8/7/6. Support `Java` 13/12/11/10/9/8/7/6.
Class [`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html) in `JDK` Class [`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html) in `JDK`
can transmit value to child thread from parent thread. can transmit value to child thread from parent thread.
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
# 🔧 功能 # 🔧 功能
👉 在使用线程池等会池化复用线程的组件情况下,提供`ThreadLocal`值的传递功能,解决异步执行时上下文传递的问题。 👉 在使用线程池等会池化复用线程的组件情况下,提供`ThreadLocal`值的传递功能,解决异步执行时上下文传递的问题。
一个`Java`标准库本应为框架/中间件设施开发提供的标配能力,本库功能聚焦 & 0依赖,支持`Java` 12/11/10/9/8/7/6。 一个`Java`标准库本应为框架/中间件设施开发提供的标配能力,本库功能聚焦 & 0依赖,支持`Java` 13/12/11/10/9/8/7/6。
`JDK`[`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html)类可以完成父线程到子线程的值传递。但对于使用线程池等会池化复用线程的组件的情况,线程由线程池创建好,并且线程是池化起来反复使用的;这时父子线程关系的`ThreadLocal`值传递已经没有意义,应用需要的实际上是把 **任务提交给线程池时**`ThreadLocal`值传递到 **任务执行时** `JDK`[`InheritableThreadLocal`](https://docs.oracle.com/javase/10/docs/api/java/lang/InheritableThreadLocal.html)类可以完成父线程到子线程的值传递。但对于使用线程池等会池化复用线程的组件的情况,线程由线程池创建好,并且线程是池化起来反复使用的;这时父子线程关系的`ThreadLocal`值传递已经没有意义,应用需要的实际上是把 **任务提交给线程池时**`ThreadLocal`值传递到 **任务执行时**
......
...@@ -87,3 +87,13 @@ if [ -n "$JAVA12_HOME" ]; then ...@@ -87,3 +87,13 @@ if [ -n "$JAVA12_HOME" ]; then
else else
headInfo "skip Java 12 test" headInfo "skip Java 12 test"
fi fi
# Java 13
if [ -n "$JAVA13_HOME" ]; then
headInfo "test with Java 13"
export JAVA_HOME="${JAVA13_HOME}"
runCmd ./scripts/run-junit.sh skipClean
runCmd ./scripts/run-agent-test.sh skipClean
else
headInfo "skip Java 13 test"
fi
...@@ -7,37 +7,73 @@ if [ ! -f "$install_jdk_bin" ]; then ...@@ -7,37 +7,73 @@ if [ ! -f "$install_jdk_bin" ]; then
chmod +x "$install_jdk_bin" chmod +x "$install_jdk_bin"
fi fi
switch_to_open_jdk9() { readonly nl=$'\n' # new line
export JAVA_HOME=$HOME/.jdk/openjdk9 readonly ec=$'\033' # escape char
readonly eend=$'\033[0m' # escape end
colorEcho() {
local color=$1
shift
# if stdout is console, turn on color output.
[ -t 1 ] && echo "$ec[1;${color}m$@$eend" || echo "$@"
}
blueEcho() {
colorEcho 36 "$@"
}
runCmd() {
blueEcho "Run under work directory $PWD :$nl$@"
time "$@"
}
swith_jdk() {
(($# != 2)) && {
echo "Error: $@, only need version and license"
exit 2
}
local version="$1"
local license="$2"
case "$license" in
GPL)
export JAVA_HOME=$HOME/.jdk/openjdk$version
;;
BCL)
export JAVA_HOME=$HOME/.jdk/oraclejdk$version
;;
*)
echo "Error: $@, wrong license!"
exit 2
;;
esac
if [ ! -d "$JAVA_HOME" ]; then if [ ! -d "$JAVA_HOME" ]; then
"$install_jdk_bin" --feature 9 --license GPL --target "$JAVA_HOME" runCmd "$install_jdk_bin" --feature $version --license $license --target "$JAVA_HOME"
fi fi
} }
switch_to_open_jdk9() {
swith_jdk 9 GPL
}
switch_to_oracle_jdk11() { switch_to_oracle_jdk11() {
export JAVA_HOME=$HOME/.jdk/oraclejdk11 swith_jdk 11 BCL
if [ ! -d "$JAVA_HOME" ]; then
"$install_jdk_bin" --feature 11 --license BCL --target "$JAVA_HOME"
fi
} }
switch_to_open_jdk10() { switch_to_open_jdk10() {
export JAVA_HOME=$HOME/.jdk/openjdk10 swith_jdk 10 GPL
if [ ! -d "$JAVA_HOME" ]; then
"$install_jdk_bin" --feature 10 --license GPL --target "$JAVA_HOME"
fi
} }
switch_to_open_jdk11() { switch_to_open_jdk11() {
export JAVA_HOME=$HOME/.jdk/openjdk11 swith_jdk 11 GPL
if [ ! -d "$JAVA_HOME" ]; then
"$install_jdk_bin" --feature 11 --license GPL --target "$JAVA_HOME"
fi
} }
switch_to_open_jdk12() { switch_to_open_jdk12() {
export JAVA_HOME=$HOME/.jdk/openjdk12 swith_jdk 12 GPL
if [ ! -d "$JAVA_HOME" ]; then }
"$install_jdk_bin" --feature 12 --license GPL --target "$JAVA_HOME"
fi switch_to_open_jdk13() {
swith_jdk 13 GPL
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册