-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support register persistent instance and tcp health check (#4636)
* Fix client beat error in cluster mode * Add health check for persistent ip port client * Add health check for persistent ip port client * Fix client beat error in cluster mode * Migrate default TCP health check v1.x to v2.x * Fix unit test error * Fix dump persistent client snapshot error problem * Fix load persistent client snapshot error problem * Fix subscribe error for client id
- Loading branch information
1 parent
98a821e
commit ac73e73
Showing
31 changed files
with
1,149 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...g/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/HealthCheckInstancePublishInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.nacos.naming.core.v2.pojo; | ||
|
||
import com.alibaba.nacos.naming.healthcheck.HealthCheckStatus; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
/** | ||
* Instance publish info with health check for v1.x. | ||
* | ||
* @author xiweng.yy | ||
*/ | ||
public class HealthCheckInstancePublishInfo extends InstancePublishInfo { | ||
|
||
private long lastHeartBeatTime = System.currentTimeMillis(); | ||
|
||
private HealthCheckStatus healthCheckStatus; | ||
|
||
public HealthCheckInstancePublishInfo() { | ||
} | ||
|
||
public HealthCheckInstancePublishInfo(String ip, int port) { | ||
super(ip, port); | ||
} | ||
|
||
public long getLastHeartBeatTime() { | ||
return lastHeartBeatTime; | ||
} | ||
|
||
public void setLastHeartBeatTime(long lastHeartBeatTime) { | ||
this.lastHeartBeatTime = lastHeartBeatTime; | ||
} | ||
|
||
public void initHealthCheck() { | ||
healthCheckStatus = new HealthCheckStatus(); | ||
} | ||
|
||
public boolean tryStartCheck() { | ||
return healthCheckStatus.isBeingChecked.compareAndSet(false, true); | ||
} | ||
|
||
public void finishCheck() { | ||
healthCheckStatus.isBeingChecked.set(false); | ||
} | ||
|
||
public void resetOkCount() { | ||
healthCheckStatus.checkOkCount.set(0); | ||
} | ||
|
||
public void resetFailCount() { | ||
healthCheckStatus.checkFailCount.set(0); | ||
} | ||
|
||
@JsonIgnore | ||
public AtomicInteger getOkCount() { | ||
return healthCheckStatus.checkOkCount; | ||
} | ||
|
||
@JsonIgnore | ||
public AtomicInteger getFailCount() { | ||
return healthCheckStatus.checkFailCount; | ||
} | ||
} |
42 changes: 0 additions & 42 deletions
42
naming/src/main/java/com/alibaba/nacos/naming/core/v2/pojo/HeartBeatInstancePublishInfo.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.