public class AliveBrokersSnapshot extends Object implements AliveBrokersMetadata
Modifier and Type | Field and Description |
---|---|
static AliveBrokersSnapshot |
EMPTY_SNAPSHOT |
Constructor and Description |
---|
AliveBrokersSnapshot(Map<Integer,Long> liveBrokerIdsAndEpochs,
Set<Integer> brokerReplicaExclusions,
Set<Integer> demotedBrokers) |
Modifier and Type | Method and Description |
---|---|
Set<Integer> |
aliveBrokers()
Returns the brokers that are alive in the cluster
|
Set<Integer> |
demotedBrokers()
Returns the demoted brokers in the cluster.
|
Optional<org.apache.kafka.common.Endpoint> |
endpointFor(org.apache.kafka.common.network.ListenerName listenerName)
Fetch an endpoint with a particular listener name from any broker in the cluster.
|
Optional<Long> |
epochFor(int brokerId)
Returns the broker epoch for the broker with ID
brokerId . |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isEmpty() |
Set<Integer> |
replicaExclusions()
Returns the active broker replica placement exclusions in the cluster
|
String |
toString() |
public static final AliveBrokersSnapshot EMPTY_SNAPSHOT
public AliveBrokersSnapshot(Map<Integer,Long> liveBrokerIdsAndEpochs, Set<Integer> brokerReplicaExclusions, Set<Integer> demotedBrokers)
liveBrokerIdsAndEpochs
- - a map, consisting of live broker ids as the key and their latest broker epoch as the valuebrokerReplicaExclusions
- - a set of broker ids where each broker present is excluded for replica placementpublic Set<Integer> aliveBrokers()
AliveBrokersMetadata
aliveBrokers
in interface AliveBrokersMetadata
public Set<Integer> replicaExclusions()
replicaExclusions
in interface AliveBrokersMetadata
public Set<Integer> demotedBrokers()
demotedBrokers
in interface AliveBrokersMetadata
public Optional<Long> epochFor(int brokerId)
brokerId
. Empty if no such broker exists.epochFor
in interface AliveBrokersMetadata
public Optional<org.apache.kafka.common.Endpoint> endpointFor(org.apache.kafka.common.network.ListenerName listenerName)
AliveBrokersMetadata
endpointFor
in interface AliveBrokersMetadata
listenerName
- the name of the listener for which an endpoint should be returnedlistenerName
, on any broker in the metadatapublic boolean isEmpty()
isEmpty
in interface AliveBrokersMetadata