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

[ISSUE #483] Virtual thread compatible #489

Closed
wants to merge 0 commits into from

Conversation

TheFatRatre
Copy link
Contributor

No description provided.

* @Create 2024/10/14 15:33
* @Version 1.0
*/
public class VirtualThreadExecutorAdapter implements ExecutorAdapter<ExecutorService>{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否作为单独模块引入更好

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

Copy link
Collaborator

@KamToHung KamToHung Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

确实感觉开个新模块会方便些,做重构的话也对以前的功能没有影响

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

目前实现看也没依赖到jdk21的特性,还是基于ExecutorService体系来做的,放core也行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

目前实现看也没依赖到jdk21的特性,还是基于ExecutorService体系来做的,放core也行

adapter里有点东西如果不依赖jdk21应该会报错,我看看能不能改改吧

Copy link
Collaborator

@KamToHung KamToHung Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

目前实现看也没依赖到jdk21的特性,还是基于ExecutorService体系来做的,放core也行

adapter里有点东西如果不依赖jdk21应该会报错,我看看能不能改改吧

有个VersionUtil工具类看看能不能处理下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是指不实现ExecutorAdapter吗,感觉是属于adapter这个逻辑的。之前是想把ExecutorAdapter做一个重构,和yanhom哥聊过,说是目前不要改太多东西,重写的方法就空实现就好了

virtual thread是JDK21的,所以在想是否使用一个新模块来处理较好。不过简单来做应该也不用,做好版本判断

目前实现看也没依赖到jdk21的特性,还是基于ExecutorService体系来做的,放core也行

adapter里有点东西如果不依赖jdk21应该会报错,我看看能不能改改吧

有个VersionUtil工具类看看能不能处理下

image
就是这里要直接调用jdk21的方法,我做了下重构,现在估计没啥问题了

@TheFatRatre TheFatRatre changed the title Virtual thread compatible [ISSUE #483] Virtual thread compatible Nov 5, 2024
@KamToHung
Copy link
Collaborator

此pr是已经完成可以review了吗

@TheFatRatre
Copy link
Contributor Author

TheFatRatre commented Nov 5, 2024

此pr是已经完成可以review了吗

核心兼容部分是已经实现了,现在正在做监控模块这部分。核心这块可以review了,监控这块也可以看一下,看看有没有啥建议

@TheFatRatre
Copy link
Contributor Author

此pr是已经完成可以review了吗

老哥监控这边基本做完了哈,但是还没做测试的,你可以先看看,到时我有空再测试一下。我留了一些保留字段到时可以用来做报警啥的

@TheFatRatre
Copy link
Contributor Author

此pr是已经完成可以review了吗

然后我这边实现的VirtualThreadExecutorProxy感觉耦合度有些高,你看看能不能有其他的实现方法

@yanhom1314
Copy link
Collaborator

@KamToHung 这个pr你有空 review下

@KamToHung
Copy link
Collaborator

@KamToHung 这个pr你有空 review下

OK

@@ -0,0 +1,98 @@
package org.dromara.dynamictp.common.entity;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上license-header

* Collect virtual thread key metrics.
* @param vtTaskStats
*/
void collect(VTExecutorStats vtTaskStats);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加了此接口后,完善下example的EsCollector

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,你在本地测试正常吗,我这边测试自动扫描扫描不到bean不知道为什么,只能手动添加扫描路径

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,你在本地测试正常吗,我这边测试自动扫描扫描不到bean不知道为什么,只能手动添加扫描路径

我在test模块下测试的,可以启动

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,你在本地测试正常吗,我这边测试自动扫描扫描不到bean不知道为什么,只能手动添加扫描路径

我在test模块下测试的,可以启动

你用example 的nacos cloud试试呢

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,你在本地测试正常吗,我这边测试自动扫描扫描不到bean不知道为什么,只能手动添加扫描路径

我在test模块下测试的,可以启动

你用example 的nacos cloud试试呢

master分支的试了可以

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,你在本地测试正常吗,我这边测试自动扫描扫描不到bean不知道为什么,只能手动添加扫描路径

我在test模块下测试的,可以启动

你用example 的nacos cloud试试呢

master分支的试了可以

好的

*/
@Data
@EqualsAndHashCode(callSuper = true)
public class VTExecutorStats extends Metrics {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里感觉可以和ThreadPoolStats复用,不用定义一个?

Copy link
Contributor Author

@TheFatRatre TheFatRatre Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个pr后还有些其他的参数可以监控和告警,这个类还得要,但是估计可以把公共的提出来吧

@KamToHung
Copy link
Collaborator

老哥有在群吗,加下好友聊下方案?感觉可以做得更内聚点

@TheFatRatre
Copy link
Contributor Author

老哥有在群吗,加下好友聊下方案?感觉可以做得更内聚点

在的,待会我吃个饭就来加你哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants