Chia-Ping Tsai created KAFKA-21577:
--------------------------------------

             Summary: Streamline ListenerContext
                 Key: KAFKA-21577
                 URL: https://issues.apache.org/jira/browse/KAFKA-21577
             Project: Kafka
          Issue Type: Sub-task
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


All changes to {{ListenerContext}} are under synchronized methods, so the 
{{AtomicReference}} is redundant.

Also, `setRebalanceListener(RebalanceListener)` is used by testing only, and 
the test doesn't need that since the `subscriptionState` is a mock object. We 
could use following code instead

 
{code:java}
        // Fatal error received in response for the last heartbeat. Member 
should remain in FATAL
        // state but no callbacks should be triggered because the member 
already left the group.
        mockListener(new CounterConsumerRebalanceListener());
        clearInvocations(backgroundEventHandler);
        membershipManager.transitionToFatal();
        membershipManager.onHeartbeatFailure(false);
        verify(backgroundEventHandler, 
never()).add(any(PartitionsRemovedEvent.class));
{code}
 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to