Class RemovedPartitionState<K,​V>

java.lang.Object
io.confluent.parallelconsumer.state.PartitionState<K,​V>
io.confluent.parallelconsumer.state.RemovedPartitionState<K,​V>

public class RemovedPartitionState<K,​V>
extends PartitionState<K,​V>
No op version of PartitionState used for when partition assignments are removed, to avoid managing null references or Optionals. By replacing with a no op implementation, we protect for stale messages still in queues which reference it, among other things.

The alternative to this implementation, is having PartitionStateManager.getPartitionState(TopicPartition) return Optional, which forces the implicit null check everywhere partition state is retrieved. This was drafted to a degree, but found to be extremely invasive, where this solution with decent separation of concerns and encapsulation, is sufficient and potentially more useful as is non-destructive. Potential issue is that of memory leak as the collection will forever expand. However, even massive partition counts to a single consumer would be in the hundreds of thousands, this would only result in hundreds of thousands of TopicPartition object keys all pointing to the same instance of RemovedPartitionState.