Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-76

ConcurrentModificationException on calling close() on MySQLPooledConnections

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • 1.1.5
    • 1.1.8
    • None
    • None

    Description

      I have a simple pool implementation, which deregisteres itself as listener from a pooled connection, when the method close is called on the pooled
      connection.

      The close method calls the internal method fireConnectionClosed which notifies all registered listeners. Thus even my pool implementation, which
      upon notifications removes itself as listener. Upon returning back to the calling
      fireConnectionClosed method a ConcurrentModificationException, because the for loop over the listeners got modified. BTW everything happens within the same Thread.

      If you want to be drop in replacement you can consider this as bug, else an
      improvement.

      A simple fix is to use a CopyOnWriteArrayList for the List instances for
      connectionEventListeners and statementEventListeners of the MySQLPooledConnection. This even doesn't break the minimum requirements for the driver regarding the java version, because CopyOnWriteArrayList wa introduced in Java 1.5.

      Attachments

        Activity

          People

            massimo.siani Massimo Siani (Inactive)
            max.larsson Max Larsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.