XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • None
    • 3.5.0
    • None
    • None

    Description

      findbugs is complaining

       if (sessionsById.get(id) == null) {
                   SessionImpl s = new SessionImpl(id, sessionTimeout);
                   sessionsById.put(id, s);
      }
      

      is not atomic for the gap between get() and put().

      I suggest using putIfAbsent() instead.

      Attachments

        1. ZOOKEEPER-1978.patch
          1 kB
          Hongchao Deng

        Issue Links

          Activity

            People

              hdeng Hongchao Deng
              hdeng Hongchao Deng
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: