title: How to track an object inside an ArrayList becoming null?
body: <p>The structure that I have is:</p>
  
  <pre><code>Map&lt;String, ArrayList&lt;Bean&gt;&gt;
  </code></pre>
  
  <p>This Arraylist is modified (added/removed) from different locations within different threads.</p>
  
  <p>At times, some bean inside the <code>ArrayList</code> is becoming <code>null</code>. How can I track when it becomes null? I want to track what makes the bean null, to fix the bug.</p>
  
  <p>This happens when the scenario is tested with a huge data set.</p>
  
  <p>Here's the exact code that's failing:</p>
  
  <pre><code>for (int i = 0; i &lt; eventlogs.size(); i++) {
      MessageEventLogBean msgEventLogBean = (MessageEventLogBean) eventlogs.get(i);
      eventlogs.remove(i); 
      try {
          logWriter.write(msgEventLogBean, context);
      } catch (FusionException e) {
          logger.error("Error While writing the event log bean ", e);
      }
  }
  </code></pre>