[
https://issues.apache.org/jira/browse/ARTEMIS-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16156988#comment-16156988
]
ASF GitHub Bot commented on ARTEMIS-1393:
-----------------------------------------
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1515#discussion_r137548960
--- Diff:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalMeasure.java
---
@@ -17,36 +17,48 @@
package org.apache.activemq.artemis.utils.critical;
-import org.jboss.logging.Logger;
+import java.util.concurrent.atomic.AtomicLongFieldUpdater;
public class CriticalMeasure {
- private static final Logger logger =
Logger.getLogger(CriticalMeasure.class);
+ //uses updaters to avoid creates many AtomicLong instances
+ private static final AtomicLongFieldUpdater<CriticalMeasure>
TIME_ENTER_UPDATER = AtomicLongFieldUpdater.newUpdater(CriticalMeasure.class,
"timeEnter");
+ private static final AtomicLongFieldUpdater<CriticalMeasure>
TIME_LEFT_UPDATER = AtomicLongFieldUpdater.newUpdater(CriticalMeasure.class,
"timeLeft");
private volatile long timeEnter;
--- End diff --
All I'm referring is the fact you said you would set timeEnter and timeLeft
as Long.MIN_VALUE (There's certainly a possible MIN_VALUE in long):
```java
private volatile long timeEnter = Long.MIN_VALUE;
private volatile long timeLeft = Long.MIN_VALUE;```
> CriticalAnalyzer timeout uses System::currentTimeMillis
> -------------------------------------------------------
>
> Key: ARTEMIS-1393
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1393
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
>
> To compute timeouts of the CriticalAnalyzer Instead of
> System::currentTimeMillis is preferrable to use System::nanoTime, that is not
> sensible to OS changes on the system clock (eg NTP compensation).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)