public boolean isExpired(long timeout) { final long timeLeft = TIME_LEFT_UPDATER.get(this); final long timeEnter = TIME_ENTER_UPDATER.get(this); //due to how System::nanoTime works is better to use differences to prevent numerical overflow while comparing if (timeLeft - timeEnter < 0) { boolean expired = System.nanoTime() - timeEnter > timeout; if (expired) { Exception thistraceEnter = this.traceEnter; if (thistraceEnter != null) { logger.warn("Component " + getComponentName() + " is expired on path " + id, thistraceEnter); } else { logger.warn("Component " + getComponentName() + " is expired on path " + id); } } return expired; } return false; }
public boolean isExpired(long timeout) { final long timeLeft = TIME_LEFT_UPDATER.get(this); final long timeEnter = TIME_ENTER_UPDATER.get(this); //due to how System::nanoTime works is better to use differences to prevent numerical overflow while comparing if (timeLeft - timeEnter < 0) { boolean expired = System.nanoTime() - timeEnter > timeout; if (expired) { Exception thistraceEnter = this.traceEnter; if (thistraceEnter != null) { logger.warn("Component " + getComponentName() + " is expired on path " + id, thistraceEnter); } else { logger.warn("Component " + getComponentName() + " is expired on path " + id); } } return expired; } return false; }
public void leaveCritical() { if (logger.isTraceEnabled()) { CriticalAnalyzer analyzer = component != null ? component.getCriticalAnalyzer() : null; if (analyzer != null) { long nanoTimeout = analyzer.getTimeoutNanoSeconds(); if (isExpired(nanoTimeout)) { logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, leaving at", new Exception("entered")); logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, entered at", traceEnter); } } traceEnter = null; } TIME_LEFT_UPDATER.lazySet(this, System.nanoTime()); }
public void leaveCritical() { if (logger.isTraceEnabled()) { CriticalAnalyzer analyzer = component != null ? component.getCriticalAnalyzer() : null; if (analyzer != null) { long nanoTimeout = analyzer.getTimeoutNanoSeconds(); if (isExpired(nanoTimeout)) { logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, leaving at", new Exception("entered")); logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, entered at", traceEnter); } } traceEnter = null; } TIME_LEFT_UPDATER.lazySet(this, System.nanoTime()); }
public boolean isExpired(long timeout) { final long timeLeft = TIME_LEFT_UPDATER.get(this); final long timeEnter = TIME_ENTER_UPDATER.get(this); //due to how System::nanoTime works is better to use differences to prevent numerical overflow while comparing if (timeLeft - timeEnter < 0) { boolean expired = System.nanoTime() - timeEnter > timeout; if (expired) { Exception thistraceEnter = this.traceEnter; if (thistraceEnter != null) { logger.warn("Component " + getComponentName() + " is expired on path " + id, thistraceEnter); } else { logger.warn("Component " + getComponentName() + " is expired on path " + id); } } return expired; } return false; }
public boolean isExpired(long timeout) { final long timeLeft = TIME_LEFT_UPDATER.get(this); final long timeEnter = TIME_ENTER_UPDATER.get(this); //due to how System::nanoTime works is better to use differences to prevent numerical overflow while comparing if (timeLeft - timeEnter < 0) { boolean expired = System.nanoTime() - timeEnter > timeout; if (expired) { Exception thistraceEnter = this.traceEnter; if (thistraceEnter != null) { logger.warn("Component " + getComponentName() + " is expired on path " + id, thistraceEnter); } else { logger.warn("Component " + getComponentName() + " is expired on path " + id); } } return expired; } return false; }
public boolean isExpired(long timeout) { final long timeLeft = TIME_LEFT_UPDATER.get(this); final long timeEnter = TIME_ENTER_UPDATER.get(this); //due to how System::nanoTime works is better to use differences to prevent numerical overflow while comparing if (timeLeft - timeEnter < 0) { boolean expired = System.nanoTime() - timeEnter > timeout; if (expired) { Exception thistraceEnter = this.traceEnter; if (thistraceEnter != null) { logger.warn("Component " + getComponentName() + " is expired on path " + id, thistraceEnter); } else { logger.warn("Component " + getComponentName() + " is expired on path " + id); } } return expired; } return false; }
public void leaveCritical() { if (logger.isTraceEnabled()) { CriticalAnalyzer analyzer = component != null ? component.getCriticalAnalyzer() : null; if (analyzer != null) { long nanoTimeout = analyzer.getTimeoutNanoSeconds(); if (isExpired(nanoTimeout)) { logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, leaving at", new Exception("entered")); logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, entered at", traceEnter); } } traceEnter = null; } TIME_LEFT_UPDATER.lazySet(this, System.nanoTime()); }
public void leaveCritical() { if (logger.isTraceEnabled()) { CriticalAnalyzer analyzer = component != null ? component.getCriticalAnalyzer() : null; if (analyzer != null) { long nanoTimeout = analyzer.getTimeoutNanoSeconds(); if (isExpired(nanoTimeout)) { logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, leaving at", new Exception("entered")); logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, entered at", traceEnter); } } traceEnter = null; } TIME_LEFT_UPDATER.lazySet(this, System.nanoTime()); }
public void leaveCritical() { if (logger.isTraceEnabled()) { CriticalAnalyzer analyzer = component != null ? component.getCriticalAnalyzer() : null; if (analyzer != null) { long nanoTimeout = analyzer.getTimeoutNanoSeconds(); if (isExpired(nanoTimeout)) { logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, leaving at", new Exception("entered")); logger.trace("Path " + id + " on component " + getComponentName() + " is taking too long, entered at", traceEnter); } } traceEnter = null; } TIME_LEFT_UPDATER.lazySet(this, System.nanoTime()); }