Karaf
  1. Karaf
  2. KARAF-1064

BootstrapLogManager does not reuse the instantiated Handler

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 3.0.0
    • Fix Version/s: 2.2.5, 3.0.0
    • Component/s: karaf-core
    • Labels:
      None

      Description

      When running Karaf in Master/Slave mode, the method getDefaultHandler() in class org.apache.karaf.main.BootstrapLogManager is being invoked twice, one time in org.apache.karaf.main.Main and another one in the lock file class (SimpleFileLock or DefaultJDBCLock), but the object instance of the Handler class is created without closing the previous one.

      I have created a patch which completes the singleton pattern, returning the previous handler if the instance is not null. The patch has been created against the trunk, but you can apply it to branch karaf-2.2.x.

      1. patchfile.txt
        0.5 kB
        Álvaro Alda
      2. patchfile.txt
        0.5 kB
        Álvaro Alda

        Activity

        Álvaro Alda created issue -
        Álvaro Alda made changes -
        Field Original Value New Value
        Attachment patchfile.txt [ 12505586 ]
        Andreas Pieber made changes -
        Fix Version/s 3.0.0 [ 12316040 ]
        Fix Version/s cave-3.0.0 [ 12317874 ]
        Affects Version/s 3.0.0 [ 12316040 ]
        Affects Version/s cave-3.0.0 [ 12317874 ]
        Andreas Pieber made changes -
        Assignee Andreas Pieber [ pieber ]
        Fix Version/s 2.2.6 [ 12319142 ]
        Andreas Pieber made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Ioannis Canellos added a comment -

        Looks good to me.

        I would make the getHandler method synchronized, just to be 100% that there isn't going to be a second handler created.

        Show
        Ioannis Canellos added a comment - Looks good to me. I would make the getHandler method synchronized, just to be 100% that there isn't going to be a second handler created.
        Hide
        Andreas Pieber added a comment -

        I've the same already in my queue (including sync); just having some problems to compile karaf trunk right now. Feel free to ahead and apply/close this issue; I'll try to fix the/my problems tonight otherwise

        Show
        Andreas Pieber added a comment - I've the same already in my queue (including sync); just having some problems to compile karaf trunk right now. Feel free to ahead and apply/close this issue; I'll try to fix the/my problems tonight otherwise
        Hide
        Andreas Pieber added a comment -

        @Álvaro: can you please reattach your patch checking the ASF License Agreement? (the checkbox besides the feather during the upload). Otherwise I wont be able to apply your patch.

        Thanks.

        Show
        Andreas Pieber added a comment - @Álvaro: can you please reattach your patch checking the ASF License Agreement? (the checkbox besides the feather during the upload). Otherwise I wont be able to apply your patch. Thanks.
        Hide
        Álvaro Alda added a comment - - edited

        Attached with grants. Sorry...

        Show
        Álvaro Alda added a comment - - edited Attached with grants. Sorry...
        Álvaro Alda made changes -
        Attachment patchfile.txt [ 12505738 ]
        Hide
        Andreas Pieber added a comment -

        thank you very much for the grant!

        Committing to https://svn.apache.org/repos/asf/karaf/trunk ...
        M main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java
        Committed r1208988

        Committing to https://svn.apache.org/repos/asf/karaf/branches/karaf-2.2.x ...
        M main/src/main/java/org/apache/karaf/main/BootstrapLogManager.java
        Committed r1208989

        Show
        Andreas Pieber added a comment - thank you very much for the grant! Committing to https://svn.apache.org/repos/asf/karaf/trunk ... M main/src/main/java/org/apache/karaf/main/util/BootstrapLogManager.java Committed r1208988 Committing to https://svn.apache.org/repos/asf/karaf/branches/karaf-2.2.x ... M main/src/main/java/org/apache/karaf/main/BootstrapLogManager.java Committed r1208989
        Andreas Pieber made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Andreas Pieber
            Reporter:
            Álvaro Alda
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development