Monday, April 21, 2014

How to use sling thread pool in CQ/AEM

Use Case: You are designing an application where you might need to delegate Job to a separate thread and you want to control this using thread pool so that your application it self does not run out of threads.

Prerequisite: Knowledge of Java Threads and basic Knowledge of thread pool. Note that there are Java Level thread pool as well that you can use. Check for that.


Implementation Example:

Step 1: Create your Thread class

public YourThreadClass implements Runnable {

 public void run() {
    //Your custom logic

Step 2: Main class to use sling Thread pool

Use CQ dependency finder to find what dependency you need for above code in your pom.xml


  1. Nice use case. We will promote this from with Adobe.

  2. Thanks for this great share. This site is a fantastic resource. Keep up the great work here at Sprint Connection! Many thanks.

    Southbay Pool Cleaning Services