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

XxlJobSpringExecutor 提供是否立即start选项供用户使用,在某些客户端有自己的初始化逻辑的时候,用户可自己控制未完成… #3458

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationContextAware, SmartInitializingSingleton, DisposableBean {
private static final Logger logger = LoggerFactory.getLogger(XxlJobSpringExecutor.class);

private final boolean atOnceStart;

public XxlJobSpringExecutor() {
this(true);
}

public XxlJobSpringExecutor(boolean atOnceStart) {
this.atOnceStart = atOnceStart;
}

// start
@Override
Expand All @@ -41,10 +50,12 @@ public void afterSingletonsInstantiated() {
GlueFactory.refreshInstance(1);

// super start
try {
super.start();
} catch (Exception e) {
throw new RuntimeException(e);
if (atOnceStart) {
try {
super.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

Expand Down