Skip to content

Commit

Permalink
fix bean circle
Browse files Browse the repository at this point in the history
  • Loading branch information
songyuyuyu committed Oct 17, 2023
1 parent 712880d commit 952b930
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public class DefaultStabilityHolder implements StabilityHolder {

private CheckerConfig config;

private boolean stable;
private boolean stable = true;

private long expiredAtMill;
private long expiredAtMill = 0L;

public DefaultStabilityHolder() {
}

@Autowired
public DefaultStabilityHolder(StabilityInspector inspector, CheckerConfig config) {
this.inspector = inspector;
this.config = config;
this.stable = true;
this.expiredAtMill = 0L;
}

@Override
Expand Down Expand Up @@ -54,6 +54,16 @@ public void setStaticStable(boolean stable, int ttl) {
this.expiredAtMill = System.currentTimeMillis() + (ttl * 1000);
}

@Autowired
public void setInspector(StabilityInspector inspector) {
this.inspector = inspector;
}

@Autowired
public void setConfig(CheckerConfig config) {
this.config = config;
}

@Override
public void useDynamicStable() {
this.expiredAtMill = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,26 @@ public class StabilityInspector extends AbstractLifecycle implements TopElement

private CheckerConfig config;

private AtomicBoolean stable;
private AtomicBoolean stable = new AtomicBoolean(true);

private AtomicInteger continuousMismatchTimes;
private AtomicInteger continuousMismatchTimes = new AtomicInteger();

private AtomicInteger continuousNoInterested;
private AtomicInteger continuousNoInterested = new AtomicInteger();

private DynamicDelayPeriodTask task;

private ScheduledExecutorService scheduled;

private static final String TYPE = "stability";

@Autowired
public StabilityInspector() {
}

public StabilityInspector(DefaultDelayPingActionCollector defaultDelayPingActionCollector, MetaCache metaCache,
CheckerConfig checkerConfig) {
this.collector = defaultDelayPingActionCollector;
this.metaCache = metaCache;
this.config = checkerConfig;
this.stable = new AtomicBoolean(true);
this.continuousMismatchTimes = new AtomicInteger();
this.continuousNoInterested = new AtomicInteger();
}

protected boolean isSiteStable() {
Expand Down Expand Up @@ -174,4 +173,18 @@ public int getOrder() {
return LOWEST_PRECEDENCE;
}

@Autowired
public void setCollector(DefaultDelayPingActionCollector collector) {
this.collector = collector;
}

@Autowired
public void setMetaCache(MetaCache metaCache) {
this.metaCache = metaCache;
}

@Autowired
public void setConfig(CheckerConfig config) {
this.config = config;
}
}

0 comments on commit 952b930

Please sign in to comment.