code: public static TraceEventStatus getCCMStatus(List<TraceEvent> data, boolean ignoreIncomplete)
     {
        Map<Long, Deque<TraceEvent>> stacks = new TreeMap<Long, Deque<TraceEvent>>();
  
        for (TraceEvent te : data)
        {
           Long id = Long.valueOf(te.getThreadId());
  
           Deque<TraceEvent> stack = stacks.get(id);
  
           if (stack == null)
              stack = new ArrayDeque<TraceEvent>();
           
           if (te.getType() == TraceEvent.PUSH_CCM_CONTEXT)
           {
              stack.push(te);
           }
           else
           {
              TraceEvent top = stack.peek();
              if (top.getPayload1().equals(te.getPayload1()))
              {
                 stack.pop();
              }
              else
              {
                 return TraceEventStatus.RED;
              }
           }
  
           stacks.put(id, stack);
        }
  
        for (Deque<TraceEvent> entry : stacks.values())
        {
           if (!ignoreIncomplete && !entry.isEmpty())
              return TraceEventStatus.YELLOW;
        }
        
        return TraceEventStatus.GREEN;
     }
docs: Get CCM pool status
  @param data The data
  @param ignoreIncomplete Ignore incomplete stacks
  @return The status