Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-954

Findbugs/ClientCnxn: Bug type JLM_JSR166_UTILCONCURRENT_MONITORENTER

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: java client
    • Labels:
      None

      Description

      JLM Synchronization performed on java.util.concurrent.LinkedBlockingQueue in org.apache.zookeeper.ClientCnxn$EventThread.queuePacket(ClientCnxn$Packet)

      Bug type JLM_JSR166_UTILCONCURRENT_MONITORENTER (click for details)
      In class org.apache.zookeeper.ClientCnxn$EventThread
      In method org.apache.zookeeper.ClientCnxn$EventThread.queuePacket(ClientCnxn$Packet)
      Type java.util.concurrent.LinkedBlockingQueue
      Value loaded from field org.apache.zookeeper.ClientCnxn$EventThread.waitingEvents
      At ClientCnxn.java:[line 411]
      JLM Synchronization performed on java.util.concurrent.LinkedBlockingQueue in org.apache.zookeeper.ClientCnxn$EventThread.run()

      Bug type JLM_JSR166_UTILCONCURRENT_MONITORENTER (click for details)
      In class org.apache.zookeeper.ClientCnxn$EventThread
      In method org.apache.zookeeper.ClientCnxn$EventThread.run()
      Type java.util.concurrent.LinkedBlockingQueue
      Value loaded from field org.apache.zookeeper.ClientCnxn$EventThread.waitingEvents
      At ClientCnxn.java:[line 436]

      The respective code:

      409 public void queuePacket(Packet packet) {
      410 if (wasKilled) {
      411 synchronized (waitingEvents)

      { 412 if (isRunning) waitingEvents.add(packet); 413 else processEvent(packet); 414 }

      415 } else

      { 416 waitingEvents.add(packet); 417 }

      418 }
      419
      420 public void queueEventOfDeath()

      { 421 waitingEvents.add(eventOfDeath); 422 }

      423
      424 @Override
      425 public void run() {
      426 try {
      427 isRunning = true;
      428 while (true) {
      429 Object event = waitingEvents.take();
      430 if (event == eventOfDeath)

      { 431 wasKilled = true; 432 }

      else

      { 433 processEvent(event); 434 }

      435 if (wasKilled)
      436 synchronized (waitingEvents) {
      437 if (waitingEvents.isEmpty())

      { 438 isRunning = false; 439 break; 440 }

      441 }
      442 }

        Attachments

        1. ZOOKEEPER-954.patch
          4 kB
          Hiroshi Ikeda
        2. ZOOKEEPER-954-V2.patch
          4 kB
          Hiroshi Ikeda

          Issue Links

            Activity

              People

              • Assignee:
                ikeda Hiroshi Ikeda
                Reporter:
                thkoch Thomas Koch
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: