title: Is there a possibility for concurrency issues when calling a method of class from a thread?
body: <pre><code>public class ThreadTest {
     private final ListeningExecutorService executor;
  
  public ThreadTest() {
     this.executor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
  }
  
  public void processAsync() {
   int i=0;
   do {
      final Future&lt;Integer&gt; future = processThread(i));
      futures.add(future);
      i++;
   } while (i&lt;10);
   int count = 0;
      for (Future&lt;Integer&gt; f : futures) {
          try {
              count+=f.get();
          } catch (InterruptedException | ExecutionException e) {
              throw new RuntimeException("Error occurred", e);
          }
      }
  }
  
  
  private Integer updateCount(Integer i) {
      Integer a = Math(i,2);
      a = a + 20;
      Integer b = a + 40;
      return b;
  }
  
  
  public ListenableFuture&lt;Integer&gt; processThread(Integer i) {
  
      return this.executor.submit(()-&gt;{
          return updateCount(i);
      });
  }
  </code></pre>
  
  <p>In this small snippet of code, would I need to synchronize anything in the <code>updateCount()</code> method if I called the <code>processAsync()</code> method of the class? Would multiple threads invoking <code>updateCount()</code> result in the temporary variables being <code>created(i, a , b)</code> to be out of synch and return garbage values?</p>