/**
   * Called by a subclass when a client connection fails. Removes <code>connectionId</code> from the
   * list returned by {@link #getConnectionIds()}, then emits a {@link JMXConnectionNotification}
   * with type {@link JMXConnectionNotification#FAILED}.
   *
   * @param connectionId the ID of the failed connection.
   * @param message the message for the emitted {@link JMXConnectionNotification}. Can be null. See
   *     {@link Notification#getMessage()}.
   * @param userData the <code>userData</code> for the emitted {@link JMXConnectionNotification}.
   *     Can be null. See {@link Notification#getUserData()}.
   * @exception NullPointerException if <code>connectionId</code> is null.
   */
  protected void connectionFailed(String connectionId, String message, Object userData) {

    if (connectionId == null) throw new NullPointerException("Illegal null argument");

    synchronized (connectionIds) {
      connectionIds.remove(connectionId);
    }

    sendNotification(JMXConnectionNotification.FAILED, connectionId, message, userData);
  }
 private void sendNotification(String type, String connectionId, String message, Object userData) {
   Notification notif =
       new JMXConnectionNotification(
           type, getNotificationSource(), connectionId, nextSequenceNumber(), message, userData);
   sendNotification(notif);
 }