Uploaded image for project: 'Remoting JMX'
  1. Remoting JMX
  2. REMJMX-106

Resources leak when an exception is thrown in "connect"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.0.1.Final
    • Connection
    • None
    • Hide
      JMXConnector jmxc JMXConnectorFactory.newJMXConnector(new JMXServiceURL("service:jmx:remote+https://127.0.0.1"));
      try
      {
          try
          {
              jmxc.connect();
          }
          finally
          {
              jmxc.close();
          }
      }
      catch (IOException e)
      {
      }
      

      On close, the XNIO threads will remains waiting but will never be reused (a second attempt to connect jmxc would create new threads).

      The reason for this, is that upon catching an exception in "RemotingConnector.connect()", "RemotingConnector.close()" is called but return almost immediately because the state of the connection is "UNUSED".

      There are two ways to fix this issue:

      1. Perform cleanup as is the connection was "OPEN" in "RemotingConnector.close()"
      2. Reuse the same XNIO threads upon a further connection and add a "dispose()" method to allow complete cleanup of the resources without the need to have a successful connection.
      Show
      JMXConnector jmxc JMXConnectorFactory.newJMXConnector( new JMXServiceURL( "service:jmx:remote+https: //127.0.0.1" )); try { try { jmxc.connect(); } finally { jmxc.close(); } } catch (IOException e) { } On close, the XNIO threads will remains waiting but will never be reused (a second attempt to connect jmxc would create new threads). The reason for this, is that upon catching an exception in "RemotingConnector.connect()", "RemotingConnector.close()" is called but return almost immediately because the state of the connection is "UNUSED". There are two ways to fix this issue: Perform cleanup as is the connection was "OPEN" in "RemotingConnector.close()" Reuse the same XNIO threads upon a further connection and add a "dispose()" method to allow complete cleanup of the resources without the need to have a successful connection.
    • Medium

            darran.lofthouse@redhat.com Darran Lofthouse
            dominique.toupin Dominique Toupin (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: