|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.kafka.clients.producer.internals.Metadata
public final class Metadata
A class encapsulating some of the logic around metadata.
This class is shared by the client thread (for partitioning) and the background sender thread. Metadata is maintained for only a subset of topics, which can be added to over time. When we request metdata for a topic we don't have any metadata for it will trigger a metadata update.
Constructor Summary | |
---|---|
Metadata()
Create a metadata instance with reasonable defaults |
|
Metadata(long refreshBackoffMs,
long metadataExpireMs)
Create a new Metadata instance |
Method Summary | |
---|---|
void |
add(java.lang.String topic)
Add the topic to maintain in the metadata |
void |
awaitUpdate(int lastVerison,
long maxWaitMs)
Wait for metadata update until the current version is larger than the last version we know of |
Cluster |
fetch()
Get the current cluster info without blocking |
long |
lastUpdate()
The last time metadata was updated. |
long |
refreshBackoff()
The metadata refresh backoff in ms |
int |
requestUpdate()
Request an update of the current cluster metadata info, return the current version before the update |
long |
timeToNextUpdate(long nowMs)
The next time to update the cluster info is the maximum of the time the current info will expire and the time the current info can be updated (i.e. |
java.util.Set<java.lang.String> |
topics()
Get the list of topics we are currently maintaining metadata for |
void |
update(Cluster cluster,
long now)
Update the cluster metadata |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Metadata()
public Metadata(long refreshBackoffMs, long metadataExpireMs)
refreshBackoffMs
- The minimum amount of time that must expire between metadata refreshes to avoid busy
pollingmetadataExpireMs
- The maximum amount of time that metadata can be retained without refreshMethod Detail |
---|
public Cluster fetch()
public void add(java.lang.String topic)
public long timeToNextUpdate(long nowMs)
public int requestUpdate()
public void awaitUpdate(int lastVerison, long maxWaitMs)
public java.util.Set<java.lang.String> topics()
public void update(Cluster cluster, long now)
public long lastUpdate()
public long refreshBackoff()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |