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 http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html for that.

Reference: https://sling.apache.org/documentation/bundles/apache-sling-commons-thread-pool.html

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

20 comments:

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

    ReplyDelete
  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

    ReplyDelete
  3. Hi Guys , Greetings for the day for AEM 6 Online training classes visist : http://ibmitsolutions.com/aem-training-online
    call/whats app : +1-845-915-8712

    ReplyDelete
  4. interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts,Thanks a million once again, Regardsadobe cq5 training in hyderabad

    ReplyDelete
  5. Nice article thanks for the information. We also provide Adobe CQ online training. GO here if you’re looking for information on Adobe CQ Training.

    ReplyDelete
  6. Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog.
    Packers And Movers in Bangalore

    ReplyDelete
  7. There's a lot of interesting info here! I'm very grateful for the post! movers and packers hyderabad , is here to make your life simpler.
    Packers And Movers Hyderabad Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.

    ReplyDelete
  8. I admire the valuable advice you make available in your expertly written content. I want to thank you for this informative read; I really appreciate sharing this great.
    Packers And Movers Jaipur

    ReplyDelete
  9. This post is much helpful for us. this is really very massive value to all the readers and it will be the only reason for the post to get popular with great authority.
    Informatica Training in Chennai ECR

    ReplyDelete
  10. I must be thankful for sharing your ideas.Thank you for the good writeup.its a brellint job.please visit here for more detail:
    Packers and Movers Delhi
    http://packers-and-movers-delhi.in/packers-and-movers-dwarka-delhi
    http://packers-and-movers-delhi.in/packers-and-movers-gurgaon
    http://packers-and-movers-delhi.in/packers-and-movers-ghaziabad

    ReplyDelete
  11. his is just the kind of information that i had been looking for. thanks a lot
    return man 2 unblocked | tank trouble unblocked 1 player

    ReplyDelete
  12. Thanks a lot for providing me this opportunity to write here i feel myself very blessed.
    please visit our official website for all the useful details-
    Packers And Movers Ahmedabad

    ReplyDelete
  13. I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it.
    resorts near delhi for weekend

    ReplyDelete