You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/02 13:39:39 UTC
[GitHub] [pulsar] racorn opened a new pull request #6454: Pulsar Java
client: Use System.nanoTime() instead of System.currentTimeMillis() to
measure elapsed time
racorn opened a new pull request #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454
Fixes #6453
### Motivation
`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()`.
### Modifications
The instance variable `createdAt` in `ConsumerBase$OpBatchReceive` and `ProducerImpl$OpSendMsg` is initialized with `System.nanoTime()`. Usage of the variable is updated to reflect that the variable holds nano time; computations of elapsed time takes the difference between the current system nano time and the `createdAt` variable.
The `createdAt` field is package protected, and is currently only used in the declaring class and outer class, limiting the chances for unwanted side effects.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] sijie commented on issue #6454: Pulsar Java client: Use
System.nanoTime() instead of System.currentTimeMillis() to measure elapsed
time
Posted by GitBox <gi...@apache.org>.
sijie commented on issue #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454#issuecomment-593586164
/pulsarbot run-failure-checks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] racorn commented on issue #6454: Pulsar Java client: Use
System.nanoTime() instead of System.currentTimeMillis() to measure elapsed
time
Posted by GitBox <gi...@apache.org>.
racorn commented on issue #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454#issuecomment-593640818
/pulsarbot run-failure-checks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] sijie merged pull request #6454: Pulsar Java client: Use
System.nanoTime() instead of System.currentTimeMillis() to measure elapsed
time
Posted by GitBox <gi...@apache.org>.
sijie merged pull request #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] yjshen commented on issue #6454: Pulsar Java client: Use
System.nanoTime() instead of System.currentTimeMillis() to measure elapsed
time
Posted by GitBox <gi...@apache.org>.
yjshen commented on issue #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454#issuecomment-593693576
/pulsarbot run-failure-checks
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [pulsar] jiazhai commented on issue #6454: Pulsar Java client: Use
System.nanoTime() instead of System.currentTimeMillis() to measure elapsed
time
Posted by GitBox <gi...@apache.org>.
jiazhai commented on issue #6454: Pulsar Java client: Use System.nanoTime() instead of System.currentTimeMillis() to measure elapsed time
URL: https://github.com/apache/pulsar/pull/6454#issuecomment-598574017
cherry-picked into branch-2.5
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services