void remove(int brokerId) {
        BrokerHeartbeatState broker = brokers.remove(brokerId);
        if (broker != null) {
            untrack(broker);
        }
    }
@Test
    public void testBrokerHeartbeatStateList() {
        BrokerHeartbeatStateList list = new BrokerHeartbeatStateList();
        assertNull(list.first());
        BrokerHeartbeatStateIterator iterator = list.iterator();
        assertFalse(iterator.hasNext());
        BrokerHeartbeatState broker0 = new BrokerHeartbeatState(0);
        broker0.lastContactNs = 200;
        BrokerHeartbeatState broker1 = new BrokerHeartbeatState(1);
        broker1.lastContactNs = 100;
        BrokerHeartbeatState broker2 = new BrokerHeartbeatState(2);
        broker2.lastContactNs = 50;
        BrokerHeartbeatState broker3 = new BrokerHeartbeatState(3);
        broker3.lastContactNs = 150;
        list.add(broker0);
        list.add(broker1);
        list.add(broker2);
        list.add(broker3);
        assertEquals(broker2, list.first());
        iterator = list.iterator();
        assertEquals(broker2, iterator.next());
        assertEquals(broker1, iterator.next());
        assertEquals(broker3, iterator.next());
        assertEquals(broker0, iterator.next());
        assertFalse(iterator.hasNext());
        list.remove(broker1);
        iterator = list.iterator();
        assertEquals(broker2, iterator.next());
        assertEquals(broker3, iterator.next());
        assertEquals(broker0, iterator.next());
        assertFalse(iterator.hasNext());
    }