|
54 | 54 | * <ul>
|
55 | 55 | * <li>Keeping member state</li>
|
56 | 56 | * <li>Keeping assignment for the member</li>
|
57 |
| - * <li>Reconciling assignment, for example if tasks need to be revoked before other tasks can be assigned</li> |
| 57 | + * <li>Reconciling assignment, for example, if tasks need to be revoked before other tasks can be assigned</li> |
58 | 58 | * <li>Calling the assignment and revocation callbacks on the Streams client</li>
|
59 | 59 | * </ul>
|
60 | 60 | */
|
61 | 61 | public class StreamsMembershipManager implements RequestManager {
|
62 | 62 |
|
63 | 63 | /**
|
64 |
| - * A data structure to represent the current task assignment, and current target task assignment of a member in a |
| 64 | + * A data structure to represent the current task assignment, and target task assignment of a member in a |
65 | 65 | * streams group.
|
66 | 66 | * <p/>
|
67 | 67 | * Besides the assigned tasks, it contains a local epoch that is bumped whenever the assignment changes, to ensure
|
@@ -590,7 +590,7 @@ public boolean shouldHeartbeatNow() {
|
590 | 590 | * If the member is already part of the group, this will only ensure that the updated subscription
|
591 | 591 | * is included in the next heartbeat request.
|
592 | 592 | * <p/>
|
593 |
| - * Note that list of topics of the subscription is taken from the shared subscription state. |
| 593 | + * Note that the list of topics in the subscription is taken from the shared subscription state. |
594 | 594 | */
|
595 | 595 | public void onSubscriptionUpdated() {
|
596 | 596 | subscriptionUpdated.compareAndSet(false, true);
|
@@ -875,12 +875,12 @@ private CompletableFuture<Void> leaveGroup(final boolean isOnClose) {
|
875 | 875 | transitionTo(MemberState.PREPARE_LEAVING);
|
876 | 876 | CompletableFuture<Void> onGroupLeft = new CompletableFuture<>();
|
877 | 877 | leaveGroupInProgress = Optional.of(onGroupLeft);
|
878 |
| - if (!isOnClose) { |
| 878 | + if (isOnClose) { |
| 879 | + leaving(); |
| 880 | + } else { |
879 | 881 | CompletableFuture<Void> onAllActiveTasksReleasedCallbackExecuted = releaseActiveTasks();
|
880 | 882 | onAllActiveTasksReleasedCallbackExecuted
|
881 | 883 | .whenComplete((__, callbackError) -> leavingAfterReleasingActiveTasks(callbackError));
|
882 |
| - } else { |
883 |
| - leaving(); |
884 | 884 | }
|
885 | 885 |
|
886 | 886 | return onGroupLeft;
|
@@ -933,9 +933,6 @@ private void processAssignmentReceived(Map<String, SortedSet<Integer>> activeTas
|
933 | 933 | log.debug("Target assignment {} received from the broker is equals to the member " +
|
934 | 934 | "current assignment {}. Nothing to reconcile.",
|
935 | 935 | targetAssignment, currentAssignment);
|
936 |
| - // Make sure we transition the member back to STABLE if it was RECONCILING (ex. |
937 |
| - // member was RECONCILING unresolved assignments that were just removed by the |
938 |
| - // broker), or JOINING (member joining received empty assignment). |
939 | 936 | if (state == MemberState.RECONCILING || state == MemberState.JOINING) {
|
940 | 937 | transitionTo(MemberState.STABLE);
|
941 | 938 | }
|
|
0 commit comments