java虚拟线程
配置eclipse支持jdk21及体验虚拟线程
星期四, 九月 21st, 2023 | JAVA-and-J2EE | 没有评论
jdk21支持了虚拟线程,又是长期版本,体验下感觉
当前为止还只有官方版本,其他AWS等还没有对应的JDK21版本
下载地址:
openjdk 21
https://jdk.java.net/21/
oracle jdk 21
https://www.oracle.com/java/technologies/downloads/#jdk21-windows
graalvm-community-jdk-21.0.0_windows-x64_bin.zip
https://github.com/graalvm/graalvm-ce-builds/releases
graalvm-jdk-21_windows-x64_bin.zip
https://www.oracle.com/java/technologies/downloads/#graalvmjava21
eclipse下载最新:
Eclipse IDE 2023-09 R Packages
https://www.eclipse.org/downloads/packages/
eclipse更新支持插件:
Java 21 Support for Eclipse 2023-09 (4.29)
You can also install this feature from the following p2 update site directly:
https://download.eclipse.org/eclipse/updates/4.29-P-builds/
在install soft里使用上面地址加载编译支持jdk21可选
更新启动异步线程加载,以前使用5个异步线程,现在用虚拟线程替换,其他不用更改
代码片段:
ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); @PostConstruct public void init() { executor.submit(() -> { xxx(); }); executor.submit(() -> { xxx2(); xxx3(); }); executor.submit(() -> { xx4(); xx5(); }); executor.submit(() -> { xxx6(); xxx7(); }); } |
启动 还比较流畅,应用使用了springboot3.1.3版本
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)