AnsweredAssumed Answered

JavaDelegate - local Variables

Question asked by rangoo on Sep 2, 2013
Latest reply on Sep 4, 2013 by rangoo
I am using Java Serice Task to get and set some processing variables. something like this.

public class CustomDelegate implements JavaDelegate {
  public void execute(DelegateExecution execution) throws Exception {

         int    i= (Integer)execution.getVariable("count");
        if(i<5) { i= i+ 1;
             execution.setVariable("count", i);

//External call
   String orderID= (String) execution.getVariable("orderID");
        String status= MyUtil.getStatus(orderID);
         execution.setVariable("status", status);


We have multiple orders and so mutliple threads. As recommended in userguide - we are not using any member variables. But using  local variables. But the last sentence in user guide says [red] class must be thread-safe[/red] too.

Do we still need to make our custom javadelegate  thread safe(using synchronize) ? Is it because references to variables are mutable?