Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Scheduler configs creating multiple PIDs

Avatar

Level 1

Hi All,

 

I have a scheduler, which scans assets and looks for expiring and send email notifications.
Here problem is instead of 1 email i am receiving 4 email for same content.

 

I had deployed code with with different cron expression in config file, seems all of them storing as a different PID. How do we make sure only one PID runs. here is my schedule job 

Class is made Runnable with immediate true
have OCD properties and below schedule options 

@Activate
protected void activate(Config cfg) {
this.config = cfg;
removeJob();
scheduleJob(cfg);

}

@Modified
protected void modified(Config cfg) {
removeJob();
this.config = cfg;
scheduleJob(cfg);
}

@Deactivate
protected void deactivate() {
removeJob();
}

private void scheduleJob(Config cfg) {
if (!cfg.enabled()) {
LOG.info("AssetExpiryScheduler disabled by config.");
return;
}
this.jobId = cfg.schedulerName();
ScheduleOptions opts = scheduler.EXPR(cfg.scheduler_expression());
opts.name(jobId);
opts.canRunConcurrently(false);
scheduler.schedule(this, opts);
LOG.info("Scheduled job '{}' with expression '{}'", cfg.schedulerName(), cfg.scheduler_expression());
this.config = cfg;

}

private void removeJob() {
if (jobId != null) {
scheduler.unschedule(jobId);
jobId = null;
}
}



Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Employee

The problem is usually caused by having multiple OSGi configurations active for your scheduler, which creates several instances (PIDs) and leads to duplicate job executions and multiple email notifications.

To resolve this, consolidate your configurations so that only one configuration file for your scheduler component PID exists. You can manage OSGi configurations using the Web Console at /system/console/configMgr. If multiple configurations for the same PID are present, remove the extras and make sure only a single configuration is active.

 

This approach ensures that only one scheduler job runs, preventing duplicate notifications.

 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/dep...

Avatar

Level 1

Thanks for the response. Yes we have made this basic check in configMgr to look for multiple PIDs. But  here we are only seeing 1 PID configuration !! Not sure why i don't see other PIDs.

For each deployment with different cron expression, I am able to see scheduler still runs even the config is changed.

I have 3 configs - config , config.dev and config.local  - This should not effect the running as only 1 will be picked at runtime based on environment.

I have service listed with 1 PID service with 1 component ID in core project bundle. and 1 config under /system/console/configMgr

Is there a way to remove existing all PID from code deployment as i am not seeing them in configMgr from developer console screen ?? 

Thanks much