本文整理匯總了Java中org.LatencyUtils.PauseDetector類的典型用法代碼示例。如果您正苦於以下問題:Java PauseDetector類的具體用法?Java PauseDetector怎麽用?Java PauseDetector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PauseDetector類屬於org.LatencyUtils包,在下文中一共展示了PauseDetector類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TimeWindowLatencyHistogram
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
public TimeWindowLatencyHistogram(Clock clock, HistogramConfig histogramConfig,
io.micrometer.core.instrument.histogram.pause.PauseDetector pauseDetector) {
super(clock, histogramConfig, LatencyStats.class);
this.pauseDetector = requireNonNull(pauseDetectorCache.computeIfAbsent(pauseDetector, detector -> {
if (detector instanceof ClockDriftPauseDetector) {
ClockDriftPauseDetector clockDriftPauseDetector = (ClockDriftPauseDetector) detector;
return new SimplePauseDetector(clockDriftPauseDetector.getSleepInterval().toNanos(),
clockDriftPauseDetector.getPauseThreshold().toNanos(), 1, false);
} else if (detector instanceof NoPauseDetector) {
return new NoopPauseDetector();
}
return new NoopPauseDetector();
}));
initRingBuffer();
}
示例2: DefaultCommandLatencyCollector
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
public DefaultCommandLatencyCollector(CommandLatencyCollectorOptions options) {
this.options = options;
this.createLatencies = id -> {
if (PAUSE_DETECTOR_UPDATER.get(this) == null) {
if (PAUSE_DETECTOR_UPDATER.compareAndSet(this, null, GLOBAL_PAUSE_DETECTOR)) {
PAUSE_DETECTOR_UPDATER.get(this).retain();
}
}
PauseDetector pauseDetector = ((DefaultPauseDetectorWrapper) PAUSE_DETECTOR_UPDATER.get(this)).getPauseDetector();
if (options.resetLatenciesAfterEvent()) {
return new Latencies(pauseDetector);
}
return new CummulativeLatencies(pauseDetector);
};
}
示例3: getPauseDetector
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
/**
* Creates or initializes a {@link PauseDetector} instance.
*
* @return
*/
PauseDetector getPauseDetector() {
while (pauseDetector == null) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return pauseDetector;
}
}
return pauseDetector;
}
示例4: acquirePauseDetector
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
private static PauseDetector acquirePauseDetector() {
synchronized (PAUSE_DETECTOR_LOCK) {
if (pauseDetectorCount++ == 0) {
staticPauseDetector = new SimplePauseDetector(
TimeUnit.MILLISECONDS.toNanos(10),
TimeUnit.MILLISECONDS.toNanos(10),
3
);
}
return staticPauseDetector;
}
}
示例5: Latencies
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
Latencies(PauseDetector pauseDetector) {
firstResponse = LatencyStats.Builder.create().pauseDetector(pauseDetector).build();
completion = LatencyStats.Builder.create().pauseDetector(pauseDetector).build();
}
示例6: CummulativeLatencies
import org.LatencyUtils.PauseDetector; //導入依賴的package包/類
CummulativeLatencies(PauseDetector pauseDetector) {
super(pauseDetector);
firstResponse = super.firstResponse.getIntervalHistogram();
completion = super.completion.getIntervalHistogram();
}