feat(PlatformSelectionView): 使用线程池执行 Cookie 拦截任务
将原先直接调用 executeCookieIntercept() 方法改为通过ThreadPoolTaskExecutor 线程池来异步执行,避免阻塞 UI 线程,提升界面响应性能。对两个平台连接按钮的点击事件处理逻辑 进行了统一优化。
This commit is contained in:
@@ -14,6 +14,7 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
public class PlatformSelectionView {
|
||||
|
||||
@@ -93,10 +94,11 @@ public class PlatformSelectionView {
|
||||
|
||||
connectButton.setOnAction(event -> {
|
||||
FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetMt");
|
||||
ftbCrawlNetMt.executeCookieIntercept();
|
||||
|
||||
ThreadPoolTaskExecutor poolTaskExecutor = SpringContext.getBean(ThreadPoolTaskExecutor.class);
|
||||
poolTaskExecutor.execute(() -> {
|
||||
ftbCrawlNetMt.executeCookieIntercept();
|
||||
});
|
||||
});
|
||||
|
||||
option.getChildren().addAll(imageView, titleLabel, connectButton);
|
||||
|
||||
return option;
|
||||
@@ -122,8 +124,10 @@ public class PlatformSelectionView {
|
||||
|
||||
connectButton.setOnAction(event -> {
|
||||
FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetDy");
|
||||
ftbCrawlNetMt.executeCookieIntercept();
|
||||
|
||||
ThreadPoolTaskExecutor poolTaskExecutor = SpringContext.getBean(ThreadPoolTaskExecutor.class);
|
||||
poolTaskExecutor.execute(() -> {
|
||||
ftbCrawlNetMt.executeCookieIntercept();
|
||||
});
|
||||
});
|
||||
|
||||
option.getChildren().addAll(imageView, titleLabel, connectButton);
|
||||
|
||||
Reference in New Issue
Block a user