title: Struts2 session concurrency issue
body: <p>I have some troubles.</p>
  
  <p>For example, I have two actions: First and Second.</p>
  
  <p>I have written simple utility, that uses executor service to send 100000 asynchronous requests  to action First and to actions Second.</p>
  
  <p>In First action I do:</p>
  
  <pre><code>HitCounter.increment();
  ActionContext.getContext().getSession().put("counter", HitCounter.getAtomicCounter());
  return Action.SUCCESS;
  </code></pre>
  
  <p>In second action I do:</p>
  
  <pre><code>System.out.println("From session: "+ActionContext.getContext().getSession().get("counter"));
  System.out.println("Actual:"+ HitCounter.getAtomicCounter());
  return Action.SUCCESS;
  </code></pre>
  
  <p>And the output I see(and it really makes me mad):</p>
  
  <pre><code>From session: 2 
  Actual: 69352
  </code></pre>
  
  <p>After some time when I use this Fitst action/Second action only from my browsers and no concurrent requests come(generated by my load utility), results "are stabilized" to actual values. Thus, I have concurrency issues.</p>
  
  <p>Is there a standard way that I should use to avoid problems with concurrency in Struts2 ?</p>
  
  <p>P.S. HitCounter is thread safe, because it contains only one field and it's AtomicInteger.</p>
  
  <p>P.P.S. HitCounter realisation:</p>
  
  <pre><code>public class HitCounter {
      private static AtomicInteger counter = new AtomicInteger(0);
  
      public static void increment() {
          counter.incrementAndGet();
      }
      public static int getAtomicCounter() {
          return counter.get();
      }
  }
  </code></pre>
  
  <p>P.P.P.S. I removed Thread.yield(); but it didn't help. :(</p>