Re: Quartz Scheduler -- Clustering
Re: Quartz Scheduler -- Clustering
- Subject: Re: Quartz Scheduler -- Clustering
- From: Samuel Pelletier via Webobjects-dev <email@hidden>
- Date: Sun, 16 Feb 2025 09:07:50 -0500
I do not have startup problems and use these properties to disable job by
default and only start then on the designed instance:
er.quartzscheduler.schedulerServiceToLaunch=true
er.quartzscheduler.triggersAutomaticallyPaused=true
On the instance that should run the tasks I set
er.quartzscheduler.triggersAutomaticallyPaused=false
This cause Quartz to load but no task are started, The is a component in the
frameworks to see the current scheduling state and individual task schedule at
runtime you can put in your app: <wo:ERQSJobInformations/>.
Havi you implemented a ERQSSchedulerServiceFrameworkPrincipal derived class as
explained in the readme file and call the initializer as described in the
readme ?
* Create your own framework principal and implement the methods: *
*
getListOfJobDescription that is called by the job supervisor to know the list
of jobs that must be handled by the Quartz scheduler. *
newEditingContext() called when a job needs a new ec *
newEditingContext(final EOObjectStore parent) called when a job needs a new ec
*
* Read more {@link
er.quartzscheduler.util.ERQSSchedulerServiceFrameworkPrincipal#newEditingContext()}
* *
Here is my code for that. ScheduledJob is my EOEntity use to store task
schedule.
In Application.java...
@Override
public void didFinishLaunching() {
super.didFinishLaunching();
new SchedulerPrincipal().finishInitialization();
}
public class SchedulerPrincipal extends ERQSSchedulerServiceFrameworkPrincipal {
EOEditingContext ec = null;
NSArray<? extends ERQSJobDescription> jobs = null;
static
{
setUpFrameworkPrincipalClass(SchedulerPrincipal.class);
}
@Override
public void finishInitialization() {
super.finishInitialization();
ERQSSchedulerServiceFrameworkPrincipal.setSharedInstance(this);
}
@Override
protected void initialize() {
super.initialize();
}
@Override
public NSArray<? extends ERQSJobDescription>
getListOfJobDescription(EOEditingContext ec) {
this.ec = ec;
jobs = ScheduledJob.fetchAllScheduledJobs(ec);
return jobs;
}
@Override
public EOEditingContext newEditingContext() {
return ERXEC.newEditingContext(); //?
}
@Override
public EOEditingContext newEditingContext(EOObjectStore parent) {
return ERXEC.newEditingContext(parent); //?
}
}
Samuel
> Le 15 févr. 2025 à 23:55, Jesse Tayler <email@hidden> a écrit :
>
> Thanks, I seem to have found that by initializing Quartz in my Applicaiton
> main(), very early even — I have it working but I GET TWO EMAILS! I have two
> instances and they both send the same notifications. Grrr...
>
> I was sure I read code that was locking the Database and I figured a date or
> something was being used to prevent that in a cluster?
>
> I also notice that I do NOT seem to have control over properties? Such as
> turning it on/off
>
> er.quartzscheduler.schedulerServiceToLaunch=true
>
> Vs false seems to have no effect.
>
> I have to spark Quartz up by hand, in my main() and that’s odd —
>
> Something is afoot!
>
>
>
>> On Feb 15, 2025, at 11:43 PM, Samuel Pelletier <email@hidden> wrote:
>>
>> Hi Jesse,
>>
>> I would try to set the main log level to debug and look at the entries...
>> There is maybe some hints there.
>>
>> In WOApplication, the code will print uncatched exception to stderr, make
>> sure you capture this output.
>> /* 556 */ NSLog.err.appendln((Object)("A fatal exception
>> occurred: " + throwable.getMessage()));
>>
>> It appears like this in debug console when I trigger an IllegalAccessError
>> in a framework didFinishInitialization() handler.
>> févr. 15 23:27:43 AppName[2325] WARN NSLog - A fatal exception occurred:
>> java.lang.IllegalAccessError
>> Exception stock trace printed here
>>
>> I have no idea where these 2 lines come from:
>>> Terminating Session Instance
>>> New Session Instance
>>
>> Hope this can help.
>>
>> Regards,
>>
>> Samuel
>>
>>
>>> Le 14 févr. 2025 à 18:00, Jesse Tayler <email@hidden> a écrit :
>>>
>>> I have the scheduler working but somehow on production, (which is in a
>>> container) it simply craps out seemingly right around the time Quartz rolls
>>> in.
>>>
>>> So the app starts up and connects to RDBMS as normal.
>>>
>>> A few seconds in, around the time I would expect Quartz to load up and
>>> query- it dies.
>>>
>>> But there’s no error, it seems like the app was asked to shut down?
>>>
>>> A watchdog?
>>>
>>> Too much RAM?
>>>
>>> Feb 14 17:10:07 TruAnon[2002] DEBUG NSLog - 0 row(s) processed
>>> Feb 14 17:10:07 TruAnon[2002] DEBUG NSLog - === Commit Internal
>>> Transaction
>>> Terminating Session Instance
>>> New Session Instance
>>> APPLICATION SHUTDOWN SEQUENCE COMPLETE
>>>
>>> Boom
>>>
>>> It’s dead and gone.
>>>
>>> Any idea how a WO app can gracefully die like that without any error?
>>>
>>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden