Skip to content

Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time #6453

@racorn

Description

@racorn

Describe the bug

More an improvement than a bug, but

ConsumerBase and ProducerImpl use System.currentTimeMillis() to measure the elapsed time in the 'operations' inner classes (ConsumerBase$OpBatchReceive and ProducerImpl$OpSendMsg).

An instance variable createdAt is initialized with System.currentTimeMills(), but it is not used for reading wall clock time, the variable is only used for computing elapsed time (e.g. timeout for a batch).

When the variable is used to compute elapsed time, it would more sense to use System.nanoTime().

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions