code: private void cleanChildRefsInParent(ChannelData channelDataArray[], boolean childrenNew[]) {
          ChildChannelDataImpl child = null;
          // Clean up the already child refs in the parent.
          for (int i = 0; i < channelDataArray.length; i++) {
              if (childrenNew[i] == true) {
                  child = (ChildChannelDataImpl) channelDataArray[i];
                  child.getParent().removeChild(child);
              }
          }
      }
docs: This is a helper function. The same logic needs to be done in multiple
  places so
  this method was written to break it out. It will be called in times when an
  exception
  occurred during the construction of a chain. It cleans up some of the
  objects that
  were lined up ahead of time.
  
  @param channelDataArray
  @param childrenNew