Anyone tried the ThreadPool in jenkins pipeline? it is not executing as
expected ? Please advise.

import java.util.concurrent.*
class MyRunnable implements Runnable{
   Integer l
   MyRunnable(Integer l){
      this.l  = l

   }
   void run(){
   try{
    print l
     }
    catch(Exception e){
          print e
    }
  }

}
node{
    stage('stage1') {
        ExecutorService executor = Executors.newFixedThreadPool(6)
        mylist = 1..100
        try{
            for(l in mylist){
                MyRunnable worker = new MyRunnable(l)
                executor.execute(worker)
        }
         }
        finally{
            executor.shutdown()
    }
}
}
-Ramesh

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CALEm6wTV_ScKAatBqapZz_-hhN%3DqFX_%2BAqw_qhWyOsUv7RgtGQ%40mail.gmail.com.

Reply via email to