feat(PlatformSelectionView): 使用线程池执行 Cookie 拦截任务

将原先直接调用 executeCookieIntercept() 方法改为通过ThreadPoolTaskExecutor 线程池来异步执行,避免阻塞 UI 线程,提升界面响应性能。对两个平台连接按钮的点击事件处理逻辑
进行了统一优化。
This commit is contained in:
wangchunxiang
2025-10-15 20:24:49 +08:00
parent 0655b1442f
commit 1609404ed4

View File

@@ -14,6 +14,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
public class PlatformSelectionView { public class PlatformSelectionView {
@@ -93,10 +94,11 @@ public class PlatformSelectionView {
connectButton.setOnAction(event -> { connectButton.setOnAction(event -> {
FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetMt"); FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetMt");
ftbCrawlNetMt.executeCookieIntercept(); ThreadPoolTaskExecutor poolTaskExecutor = SpringContext.getBean(ThreadPoolTaskExecutor.class);
poolTaskExecutor.execute(() -> {
ftbCrawlNetMt.executeCookieIntercept();
});
}); });
option.getChildren().addAll(imageView, titleLabel, connectButton); option.getChildren().addAll(imageView, titleLabel, connectButton);
return option; return option;
@@ -122,8 +124,10 @@ public class PlatformSelectionView {
connectButton.setOnAction(event -> { connectButton.setOnAction(event -> {
FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetDy"); FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetDy");
ftbCrawlNetMt.executeCookieIntercept(); ThreadPoolTaskExecutor poolTaskExecutor = SpringContext.getBean(ThreadPoolTaskExecutor.class);
poolTaskExecutor.execute(() -> {
ftbCrawlNetMt.executeCookieIntercept();
});
}); });
option.getChildren().addAll(imageView, titleLabel, connectButton); option.getChildren().addAll(imageView, titleLabel, connectButton);