title: NullPointerException occurred when put something into map concurrently
body: <p>I use a map to store data by running several sqls. Recently I wanna improve the efficiency of searching, so I create some threads, each thread corresponds to each sql, then put query results into the map at the same time. 
  When running the code, I get NullPointerExceptions but do not know why.
  Here is my code:</p>
  
  <pre><code>public Map&lt;String, Object&gt; getIndexStatistics(final Integer themeId, final String time, final Integer projectId) {
      final Map&lt;String, Object&gt; res = new ConcurrentHashMap&lt;&gt;();
      final AtomicInteger ai = new AtomicInteger(0);
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part1", getSumVolume(themeId, time, true, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part2", getVolumeTendency(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part3", getPlatformDistribution(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part4", getFeelingProportion(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part5", getLocationDistribution(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part6", getPositiveCloudList(themeId, time));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part7", getNegativeCloudList(themeId, time));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part8", getLatestNegativeSentiments(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("part9", getHotRank(themeId, time, null, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("statistic_counts", getCountStatistics(time, themeId, projectId));
              ai.getAndIncrement();
          }
      }).start();
      new Thread(new Runnable() {
          @Override
          public void run() {
              res.put("region_counts", getRegionDistribution(themeId, time, projectId));
              ai.getAndIncrement();
          }
      }).start();
      while (true) {
          if (ai.get() == 11) {
              break;
          }
      }
      return res;
  }
  </code></pre>
  
  <p>stacktrace:</p>
  
  <pre><code>java.lang.NullPointerException
      at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
      at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
      at com.bolaa.main.service.impl.ProjectNameDataServiceImpl$7.run(ProjectNameDataServiceImpl.java:309)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>By the way, all of the operations are addings and puttings. Do I need to use AtomicInteger and ConcurrentHashMap?</p>