code: public static TraceEventStatus getCCMPoolStatus(List<TraceEvent> data, boolean ignoreIncomplete)
     {
        // Thread -> Connection Listener -> Set<Connection>
        Map<Long, Map<String, Set<String>>> threads = new HashMap<Long, Map<String, Set<String>>>();
        TraceEventStatus status = TraceEventStatus.GREEN;
        
        for (TraceEvent te : data)
        {
           Long id = Long.valueOf(te.getThreadId());
  
           Map<String, Set<String>> m = threads.get(id);
  
           if (m == null)
              m = new HashMap<String, Set<String>>();
  
           if (te.getType() == TraceEvent.REGISTER_CCM_CONNECTION)
           {
              Set<String> s = m.get(te.getConnectionListener());
              if (s == null)
              {
                 s = new HashSet<String>();
                 m.put(te.getConnectionListener(), s);
              }
              if (!s.add(te.getPayload1()))
                 status = TraceEventStatus.YELLOW;
           }
           else if (te.getType() == TraceEvent.UNREGISTER_CCM_CONNECTION)
           {
              Set<String> s = m.get(te.getConnectionListener());
              if (s == null)
              {
                 s = new HashSet<String>();
                 m.put(te.getConnectionListener(), s);
              }
              if (!s.remove(te.getPayload1()))
                 status = TraceEventStatus.YELLOW;
           }
           else if (te.getType() == TraceEvent.UNKNOWN_CCM_CONNECTION)
           {
              return TraceEventStatus.RED;
           }
           else if (te.getType() == TraceEvent.CLOSE_CCM_CONNECTION)
           {
              status = TraceEventStatus.YELLOW;
           }
  
           threads.put(id, m);
        }
  
        for (Map.Entry<Long, Map<String, Set<String>>> t : threads.entrySet())
        {
           for (Map.Entry<String, Set<String>> m : t.getValue().entrySet())
           {
              if (!ignoreIncomplete && m.getValue().size() > 0)
                 return TraceEventStatus.RED;
           }
        }
  
        return status;
     }
docs: Get CCM pool status
  @param data The data
  @param ignoreIncomplete Ignore incomplete stacks
  @return The status