Expand my Community achievements bar.

SOLVED

Long Running Threads / Scheduler in OSGI / AEM

Avatar

Level 2

Hi All,

I was facing an issue while reading a lots of data from external sources / DBs. The Data is huge and taking too much to time read those. Due to this, Scheduler is also running longer.

I tried to disabled Scheduler Component, Remove Bundle but still I see the thread in Adobe Experience Manager Web Console - Threads Console. And to kill that thread, I needed to restart the AEM Instance.

 

Is there any way to KILL the long running thread in OSGI Console / AEM.

 

Thanks in Advance.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Is this a regular task you are facing? In any way, killing a thread in Java is a bit tricky (and actually discouraged to do), so I would rather adapt your long-running process to react on the presence of a flag (can be a node in the repository or a global variable in the class, which is set from a different thread).

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Is this a regular task you are facing? In any way, killing a thread in Java is a bit tricky (and actually discouraged to do), so I would rather adapt your long-running process to react on the presence of a flag (can be a node in the repository or a global variable in the class, which is set from a different thread).

Avatar

Level 3

One way todo (not recommneded as Jorg pointed above), is delete the job instances under /var. Check here. https://helpx.adobe.com/experience-manager/kb/AEM-restart-takes-a-long-time-due-to-sling-jobs-AEM.ht...

 

A nicer way is to create as Async jobs - https://experienceleague.adobe.com/docs/experience-manager-65/administering/introduction/asynchronou...

Or split the job into multiple process steps and trigger a workflow modal. This way, even when job gets stuck somewer, workflow console will help what steps got complete and which step is stuck. And you can try some manual workarounds to push or terminate the workflow. Thread contention due to long running jobs has been a painpoint in AEM for a while.