Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM Scheduler running even if scheduler is disabled and Bundle is stopped

Avatar

Avatar
Validate 1
Level 1
sg08
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
sg08
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Applaud 5
View profile
sg08
Level 1

02-06-2020

Hi,

 

I had created a custom scheduler for sending emails based on inbox tasks in aem. It was working properly until a day ago when suddenly, even if the scheduler is disabled, and the bundle is stopped, it is still somehow running and I get emails for newly created tasks. But in the project logs it shows that the scheduler has been stopped and no evidence of the code being executed. So a different scheduler is somehow still running and it is not part of this bundle?

Please let me know how I should go about fixing this issue and finding/stopping that scheduler. 

 

Thanks.

Adobe Experience Manager AEM AEM 6.5 bundle Configuration osgi scheduler scheduling

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct Reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct Reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
Nupur_Jain
MVP

02-06-2020

Hi @sg08 

 

Scheduler or we can say thread can still run even if the bundle is down. We have to remove scheduler on deactivation of scheduler service. You can remove it in @Deactivate annotated method of your service. Find the sample snippet:

 

@Component(immediate = true)
public class TestScheduler implements Runnable {

    @Reference
    private Scheduler scheduler;

    private String schedulerId = "Scheduler";
    
    @Activate
    @Modified
    protected void activate() {
        addScheduler();
    }

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

    private void removeScheduler() {
        scheduler.unschedule(String.valueOf(schedulerId));
    }

    private void addScheduler() {
        ScheduleOptions scheduleOptions = scheduler
                .EXPR("");
        scheduleOptions.name(String.valueOf(schedulerId));
        scheduler.schedule(this, scheduleOptions);
    }

    @Override
    public void run() {
    	//what needs to be done
    }

}

 

Hope it helps!

Answers (4)

Answers (4)

Avatar

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct Reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct Reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
Nupur_Jain
MVP

02-06-2020

@sg08 

 

There is system console to check for registered schedulers.

Access http://host:port/system/console/status-slingscheduler to check if you see your scheduler there.

Avatar

Avatar
Give Back 3
Employee
Manish_Singh_1
Employee

Likes

15 likes

Total Posts

18 posts

Correct Reply

4 solutions
Top badges earned
Give Back 3
Give Back
Boost 5
Boost 3
Boost 10
View profile

Avatar
Give Back 3
Employee
Manish_Singh_1
Employee

Likes

15 likes

Total Posts

18 posts

Correct Reply

4 solutions
Top badges earned
Give Back 3
Give Back
Boost 5
Boost 3
Boost 10
View profile
Manish_Singh_1
Employee

02-06-2020

Few steps:

 

1. Check if the scheduler is active from /system/console/status-slingscheduler. 

2. If not active then, Restart AEM

3. Check if you are using a workflow step which may be sending emails 

 

if not then open a support ticket for further investigation

Avatar

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct Reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct Reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
Singaiah_Chintalapudi
MVP

02-06-2020

You can check existing jobs under:/var/evening/jobs and also check the scheduler config under: /system/console/configMgr just to make sure the scheduler is disabled or removed.

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

02-06-2020

Can you check if there is any active jobs running ? If you check /var/eventing/jobs , may be you can find any active jobs running.