Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Hrdlovics committed Dec 8, 2021
1 parent a8ac9f3 commit 09a7a01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,16 @@ public void setPartitionClient(PartitionClient client) {
/**
* Removes the client from the list of clients that are part of this partition.
* @param client The client that has to be removed from this partition.
* @return True if the partition is removed, otherwise returns False.
*/
public void removePartitionClient(PartitionClient client) {
public boolean removePartitionClient(PartitionClient client) {
synchronized (partitionClientSeqNums) {
Long currentSeqNum = partitionClientSeqNums.get(client.clientId());
if (currentSeqNum != null && currentSeqNum.equals(client.seqNum())) {
partitionClientSeqNums.remove(client.clientId());
return true;
}
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,15 @@ public void onChannelActive() {
@Override
public void onChannelInactive() {
synchronized (partitions) {
List<Integer> partitionClientsNotRemoved = new ArrayList<>();
for (Partition partition : partitions.values()) {
partition.removePartitionClient(handler);
if (!partition.removePartitionClient(handler)) {
partitionClientsNotRemoved.add(partition.partitionId);
}
}
if (!partitionClientsNotRemoved.isEmpty()) {
LOGGER.info(String.format("WaltzServerHandler ClientId: %d, SeqNum: %d, PartitionsNotRemoved: %s",
handler.clientId, handler.seqNum, partitionClientsNotRemoved));
}
}
}
Expand Down

0 comments on commit 09a7a01

Please sign in to comment.