code: public void addConnectionEventListener(ConnectionEventListener listener) {
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
  
          if (isTraceOn && tc.isDebugEnabled())
              Tr.debug(this, tc, "addConnectionEventListener", listener);
  
          if (listener == null)
              throw new NullPointerException(
                              "Cannot add null ConnectionEventListener.");
  
          // Not synchronized because of the contract that add/remove event listeners will only
          // be used on ManagedConnection create/destroy, when the ManagedConnection is not
          // used by any other threads. 
  
          // Add the listener to the end of the array -- if the array is full,
          // then need to create a new, bigger one
  
          // check if the array is already full
          if (numListeners >= ivEventListeners.length) {
              // there is not enough room for the listener in the array
              // create a new, bigger array
              // Use the standard interface for event listeners instead of J2C's. 
              ConnectionEventListener[] tempArray = ivEventListeners;
              ivEventListeners = new ConnectionEventListener[numListeners + CEL_ARRAY_INCREMENT_SIZE];
              // parms: arraycopy(Object source, int srcIndex, Object dest, int destIndex, int length)
              System.arraycopy(tempArray, 0, ivEventListeners, 0, tempArray.length);
              // point out in the trace that we had to do this - consider code changes if there
              // are new CELs to handle (change KNOWN_NUMBER_OF_CELS, new events?, ...)
              if (isTraceOn && tc.isDebugEnabled()) 
                  Tr.debug(this, tc, "received more ConnectionEventListeners than expected, " +
                                     "increased array size to " + ivEventListeners.length);
          }
  
          // add listener to the array, increment listener counter
          ivEventListeners[numListeners++] = listener; 
      }
docs: Adds a connection event listener to the ManagedConnection instance.
  <p>
  The registered ConnectionEventListener instances are notified of connection
  close and error events, also of local transaction related events on the
  Managed Connection.
  
  @param listener - a new ConnectionEventListener to be registered
  
  @throws NullPointerException if you try to add a null listener.