Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-7351

Wrong logic in method ClusterConnectionStates.isDisconnected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.0
    • None
    • clients
    • None

    Description

      I think the method 

      org.apache.kafka.clients.ClusterConnectionStates.isDisconnected

      has wrong logic in proccesing wrong ids.

      @Before
      public void setup() {
          this.connectionStates = new ClusterConnectionStates(10_000, 60_000);
      }
      
      @Test
      public void testIsDisconnected(){
          boolean connected = connectionStates.isConnected("fake_node");
          boolean disconnected = connectionStates.isDisconnected("fake_node");
      
          assertFalse(connected); // false
          assertFalse(disconnected); // false
      }
      

      It can be related with that that code block:

      public boolean isDisconnected(String id) {
        NodeConnectionState state = nodeState.get(id);
      // may be better is state == null ? true : state.isDisconnected()
        return state != null && state.state.isDisconnected(); 
      }
      

      link to github

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Zhguchev Boris Zhguchev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: