DefaultMetadataUpdater

DefaultMetadataUpdater is a MetadataUpdater that NetworkClient uses to…​FIXME

DefaultMetadataUpdater is created exclusively for a NetworkClient.

Tip

Enable ALL logging level for org.apache.kafka.clients.NetworkClient logger to see what happens inside.

Add the following line to log4j.properties:

log4j.logger.org.apache.kafka.clients.NetworkClient=ALL

Refer to Logging.

Creating DefaultMetadataUpdater Instance

DefaultMetadataUpdater takes the following to be created:

DefaultMetadataUpdater initializes the internal properties.

isUpdateDue Method

Caution
FIXME

maybeUpdate Internal Method (with timestamp only)

maybeUpdate(long now)
Note
maybeUpdate is a part of MetadataUpdater Contract.

maybeUpdate requests Metadata for timeToNextUpdate (with the input now).

maybeUpdate takes requestTimeoutMs for the time to wait till metadata fetch in progress finishes if metadataFetchInProgress flag is turned on or 0 otherwise.

maybeUpdate takes the maximum of the two values above to check if the current cluster metadata has expired.

If not, maybeUpdate gives the maximum value (that says how long to wait till the current cluster metadata expires).

Otherwise, maybeUpdate selects the node to request a cluster metadata from and maybeUpdate (with the input now timestamp and the node).

If no node was found, maybeUpdate prints out the following DEBUG message to the logs and gives reconnectBackoffMs.

Give up sending metadata request since no node is available

maybeUpdate Internal Method (with timestamp and node)

long maybeUpdate(long now, Node node)

maybeUpdate…​FIXME

Note
maybeUpdate is used exclusively when DefaultMetadataUpdater is requested to maybeUpdate (with the timestamp only).

handleAuthenticationFailure Callback Method

void handleAuthenticationFailure(AuthenticationException exception)
Note
handleAuthenticationFailure is a part of MetadataUpdater Contract.

handleCompletedMetadataResponse turns metadataFetchInProgress flag off.

handleCompletedMetadataResponse asks Metadata whether metadata update was requested and if so requests it to record a failure (passing on the exception).

handleCompletedMetadataResponse Callback Method

void handleCompletedMetadataResponse(
  RequestHeader requestHeader,
  long now,
  MetadataResponse response)
Note
handleCompletedMetadataResponse is a part of MetadataUpdater contract to handle a response to a metadata request.

handleCompletedMetadataResponse…​FIXME

handleDisconnection Callback Method

void handleDisconnection(
  String destination)
Note
handleDisconnection is a part of MetadataUpdater contract.

handleDisconnection…​FIXME

handleFatalException Callback Method

void handleFatalException(
  KafkaException fatalException)
Note
handleFatalException is a part of MetadataUpdater contract.

handleFatalException…​FIXME

maybeUpdate Method

long maybeUpdate(
  long now)
Note
maybeUpdate is part of the MetadataUpdater contract to…​FIXME.

maybeUpdate…​FIXME

maybeUpdate Internal Method

long maybeUpdate(
  long now,
  Node node)

maybeUpdate…​FIXME

Note
maybeUpdate is used when DefaultMetadataUpdater is requested to maybeUpdate.

Scheduling Update Of Cluster Metadata — requestUpdate Method

void requestUpdate()
Note
requestUpdate is part of the MetadataUpdater Contract to schedule an update of the current cluster metadata.

requestUpdate simply requests the Metadata for a metadata update.

hasFetchInProgress Internal Method

boolean hasFetchInProgress()

hasFetchInProgress…​FIXME

Note
hasFetchInProgress is used when…​FIXME

isAnyNodeConnecting Internal Method

boolean isAnyNodeConnecting()

isAnyNodeConnecting…​FIXME

Note
isAnyNodeConnecting is used when…​FIXME

Internal Properties

Name Description

inProgressRequestVersion

Defined if there is a request in progress, null otherwise.

Initialized to be null when DefaultMetadataUpdater is created

Set to the requestVersion of the Metadata when DefaultMetadataUpdater is requested to maybeUpdate

Reset to null when DefaultMetadataUpdater is requested to:

metadataFetchInProgress

Flag to control whether a cluster metadata update is in progress, i.e. FIXME

results matching ""

    No results matching ""