code: public void addChain(ChainData newChain) throws ChainException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.entry(tc, "addChain: " + newChain.getName());
          }
  
          if (containsChain(newChain.getName())) {
              ChainException e = new ChainException("Chain already exists: " + newChain.getName());
              FFDCFilter.processException(e, getClass().getName() + ".addChain", "116", this, new Object[] { newChain });
              throw e;
          }
  
          // Create a chain array that is one element bigger than the current one.
          int currentLength = this.chainArray.length;
          ChainData[] newChains = new ChainData[currentLength + 1];
          // Copy the existing elements to the new array.
          System.arraycopy(getChains(), 0, newChains, 0, currentLength);
          // Add the new chain to the end of the new list.
          newChains[currentLength] = newChain;
          // Update this group's chain list
          setChains(newChains);
          // Add all group listeners to this chain. If some already exist,
          // this doesn't break anything.
          for (ChainEventListener listener : getChainEventListeners()) {
              ((ChainDataImpl) newChain).addChainEventListener(listener);
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
              Tr.exit(tc, "addChain");
          }
      }
docs: Adds the input chain to the group. All chain event listeners associated
  with the group are also added to the chain.
  
  @param newChain
  @throws ChainException
  if chain already exists in group.