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

Don't start QuartzSchedulerThread in QuartzScheduler constructor #1083

Open
ruanwenjun opened this issue Dec 4, 2023 · 3 comments
Open

Don't start QuartzSchedulerThread in QuartzScheduler constructor #1083

ruanwenjun opened this issue Dec 4, 2023 · 3 comments
Labels
is:enhancement Enhancement to an existing feature

Comments

@ruanwenjun
Copy link

Hi team,

Right now, I have two server, one is a web, and another is worker.
The web server is used to CRUD Job and bind Trigger to Job, the worker server is used to execute the Job. Due to some reason, I cannot execute Job in portal server.

I use QuartzScheduler to CRUD Job and bind Trigger in web server, so I just initialize QuartzScheduler and don't execute the QuartzScheduler's start method.

I find quartz will start the QuartzSchedulerThread in QuartzScheduler 's constructor. This seems not needed, if the QuartzScheduler doesn't start, the QuartzSchedulerThread seems only block in a loop

while (paused && !halted.get()) {
    try {
        // wait until togglePause(false) is called...
        sigLock.wait(1000L);
    } catch (InterruptedException ignore) {
    }

    // reset failure counter when paused, so that we don't
    // wait again after unpausing
    acquiresFailed = 0;
}
@rohan-naik07
Copy link

@ruanwenjun can we add the schedThreadExecutor.execute(this.schedThread); line in the start method of the QuartzScheduler class?

@ruanwenjun
Copy link
Author

@ruanwenjun can we add the schedThreadExecutor.execute(this.schedThread); line in the start method of the QuartzScheduler class?

LGTM, if we can move the execute method move to start.

@jhouserizer
Copy link
Contributor

On initial cursory look, probably safe. I think (at least) past versions of the code relied upon the thread running even when used the way the poster describes - thus probably worth a closer look before any change is made.

@jhouserizer jhouserizer added the is:enhancement Enhancement to an existing feature label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:enhancement Enhancement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants