/**
   * Removes a listener from receiving Edirectoryevents fired by this class.The listener may have
   * registered more than once with this EdirEventSource, perhaps with different events request
   * arguments. After this method is invoked, the listener will no longer receive events with this
   * EdirEvent instance as the event source (except for those events already in the process of being
   * dispatched).
   *
   * @param alistener Removes the listener from receiving the events fired by this EdirEventSource.
   * @throws LDAPException If problem is encountered while removing the listener or the listener is
   *     not registered for any event.
   */
  public void removeListener(final LDAPEventListener alistener) throws LDAPException {
    if (alistener == null) {
      throw new IllegalArgumentException("No parameter can be Null.");
    }

    super.stopeventpolling(alistener);
  }
  /**
   * Sends the LDAPExtendedRequest to the ldap server using the specified, connection and registers
   * the listener with the parent polling thread.
   *
   * @param conn LDAPConnection for sending LDAPOperation.
   * @param requestoperation LDAPExtendedOperation to be send as LDAPExtendedRequest.
   * @param alistener The LDAPListener to be registered.
   * @throws LDAPException When the underlying operations on connection fails.
   */
  private void sendExtendedRequest(
      final LDAPConnection conn,
      final LDAPExtendedOperation requestoperation,
      final LDAPEventListener alistener)
      throws LDAPException {
    LDAPResponseQueue queue = conn.extendedOperation(requestoperation, null, null);
    EdirEventsGenerator eventgenerator = null;
    int[] ids = queue.getMessageIDs();

    if (ids.length == 1) {
      eventgenerator = new EdirEventsGenerator(alistener);

      super.pollforevents(queue, conn, eventgenerator, ids[0], this);
    } else {
      /// CLOVER:OFF
      throw new LDAPException(null, LDAPException.LOCAL_ERROR, "Unable to Obtain Message Id");

      /// CLOVER:ON
    }
  }