Hey Devin,
Sorry for the late reply , I was down with covid for some time.
the code that you have given i tried and it works , but how to handle the
string parameters ?
some string parameters which I am assigning they are also interfering with
each other


On Fri, Apr 16, 2021 at 9:07 PM Devin Nusbaum <dnusb...@cloudbees.com>
wrote:

> This is a classic issue that a lot of people run into in various
> programming languages.
> https://groovyconsole.appspot.com/script/5078409050849280 shows the same
> problem and one way to fix it (click "edit in console" and then you can
> execute the script). This kind of issue is why in Java, anonymous classes
> and lambda expressions can only reference variables that are final or
> effectively final.
>
> On Apr 16, 2021, at 11:16, spratap singh <spratap2...@gmail.com> wrote:
>
> registeries = [1,2,3,4]
>  Map tasks = [:]
>  for (j=0;j<=registeries.size();j++)
> {
>  tasks["Code ${j}"] = { -> sh "touch ${j}" }
>  }
>  parallel(tasks)
>  sh "ls -lrt"
>
> Above code should create files 0,1,2,3,4,5
>
> but the last line ls -lrt only prints 5 which means it is only taking the
> last iteration value in all values of map tasks
>
> Can anyone tell what I am doing wrong here ?
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/bfde4364-d93d-4b7a-9ff6-7b2e7bd3c7a2n%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/bfde4364-d93d-4b7a-9ff6-7b2e7bd3c7a2n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/ao0SUF9L0H4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/FABC5220-69E1-449A-AA08-5C0BA770D025%40cloudbees.com
> <https://groups.google.com/d/msgid/jenkinsci-users/FABC5220-69E1-449A-AA08-5C0BA770D025%40cloudbees.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Shashipratap Singh

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CA%2By9W-zp3nuvgs3PHZ7PDPZrNO_5kA%2B6V_VmUAFGOebgWTjxRw%40mail.gmail.com.

Reply via email to