/** * Adds the specified listener to the list. * * @see #fireConnectionEvent * @see #removeConnectionEventListener */ public synchronized void addConnectionEventListener(ConnectionEventListener listener) { // Clone the list of listeners to avoid concurrent modifications. See // bug [1113040] Small bug in net.sourceforge.jtds.jdbcx.PooledConnection // for a description of how these can occur. The method still needs to // be synchronized to prevent race conditions. listeners = (ArrayList) listeners.clone(); // Now add the listener to the new, cloned list listeners.add(listener); }
/** * Adds the specified listener to the list. * * @see #fireConnectionEvent * @see #removeConnectionEventListener */ public synchronized void addConnectionEventListener(ConnectionEventListener listener) { _listeners.add(listener); }