ソースを参照

Pre-calculate intervalInSecond in LeapArray to reduce redundant calculation (#1700)

master
mikawudi GitHub 4年前
コミット
d5eb5f473f
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更3行の追加1行の削除
  1. +3
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/base/LeapArray.java

+ 3
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/statistic/base/LeapArray.java ファイルの表示

@@ -43,6 +43,7 @@ public abstract class LeapArray<T> {
protected int windowLengthInMs;
protected int sampleCount;
protected int intervalInMs;
private double intervalInSecond;

protected final AtomicReferenceArray<WindowWrap<T>> array;

@@ -64,6 +65,7 @@ public abstract class LeapArray<T> {

this.windowLengthInMs = intervalInMs / sampleCount;
this.intervalInMs = intervalInMs;
this.intervalInSecond = intervalInMs / 1000.0;
this.sampleCount = sampleCount;

this.array = new AtomicReferenceArray<>(sampleCount);
@@ -393,7 +395,7 @@ public abstract class LeapArray<T> {
* @return interval in second
*/
public double getIntervalInSecond() {
return intervalInMs / 1000.0;
return intervalInSecond;
}

public void debug(long time) {


読み込み中…
キャンセル
保存