forked from alibaba/nacos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # api/src/main/java/com/alibaba/nacos/api/naming/listener/Event.java # client/src/main/java/com/alibaba/nacos/client/naming/net/HttpClient.java # config/src/main/java/com/alibaba/nacos/config/server/utils/RunningConfigUtils.java
- Loading branch information
Showing
76 changed files
with
117 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
import com.alibaba.nacos.api.exception.NacosException; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class NamingFactory { | ||
|
||
|
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
import java.util.List; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public interface NamingService { | ||
|
||
|
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 |
---|---|---|
|
@@ -17,8 +17,7 @@ | |
|
||
/** | ||
* event interface | ||
* | ||
* @author dungu.zpf | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public interface Event { | ||
} |
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import com.alibaba.nacos.api.naming.pojo.Instance; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class NamingEvent implements Event { | ||
|
||
|
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
import java.util.Objects; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public abstract class AbstractHealthChecker implements Cloneable { | ||
|
||
|
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class Cluster { | ||
|
||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class Instance { | ||
|
||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import java.util.List; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class ListView<T> { | ||
|
||
|
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class Service { | ||
|
||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
import java.util.List; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class ServiceInfo { | ||
|
||
|
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 |
---|---|---|
|
@@ -42,7 +42,7 @@ | |
import java.util.Properties; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
@SuppressWarnings("PMD.ServiceOrDaoClassShouldEndWithImplRule") | ||
public class NacosNamingService implements NamingService { | ||
|
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
import java.util.concurrent.*; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class FailoverReactor { | ||
|
||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class BeatInfo { | ||
|
||
|
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
import com.alibaba.nacos.client.naming.utils.LogUtils; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class ConcurrentDiskUtil { | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
package com.alibaba.nacos.client.naming.core; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class ProtectMode { | ||
|
||
|
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 |
---|---|---|
|
@@ -31,15 +31,13 @@ | |
import java.util.zip.GZIPInputStream; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class HttpClient { | ||
|
||
public static final int TIME_OUT_MILLIS = Integer.parseInt( | ||
System.getProperty("com.taobao.vipserver.ctimeout", "50000")); | ||
public static final int CON_TIME_OUT_MILLIS = Integer.parseInt( | ||
System.getProperty("com.taobao.vipserver.ctimeout", "3000")); | ||
private static final boolean ENABLE_HTTPS = Boolean.parseBoolean(System.getProperty("tls.enable", "false")); | ||
public static final int TIME_OUT_MILLIS = Integer.getInteger("com.alibaba.nacos.client.naming.ctimeout", 50000); | ||
public static final int CON_TIME_OUT_MILLIS = Integer.getInteger("com.alibaba.nacos.client.naming.ctimeout", 3000); | ||
private static final boolean ENABLE_HTTPS = Boolean.getBoolean("com.alibaba.nacos.client.naming.tls.enable"); | ||
|
||
static { | ||
// limit max redirection | ||
|
@@ -55,19 +53,17 @@ public static String getPrefix() { | |
|
||
} | ||
|
||
public static HttpResult httpGet(String url, List<String> headers, Map<String, String> paramValues, | ||
String encoding) { | ||
public static HttpResult httpGet(String url, List<String> headers, Map<String, String> paramValues, String encoding) { | ||
return request(url, headers, paramValues, encoding, "GET"); | ||
} | ||
|
||
public static HttpResult request(String url, List<String> headers, Map<String, String> paramValues, String encoding, | ||
String method) { | ||
public static HttpResult request(String url, List<String> headers, Map<String, String> paramValues, String encoding, String method) { | ||
HttpURLConnection conn = null; | ||
try { | ||
String encodedContent = encodingParams(paramValues, encoding); | ||
url += (null == encodedContent) ? "" : ("?" + encodedContent); | ||
|
||
conn = (HttpURLConnection)new URL(url).openConnection(); | ||
conn = (HttpURLConnection) new URL(url).openConnection(); | ||
|
||
conn.setConnectTimeout(CON_TIME_OUT_MILLIS); | ||
conn.setReadTimeout(TIME_OUT_MILLIS); | ||
|
@@ -80,7 +76,7 @@ public static HttpResult request(String url, List<String> headers, Map<String, S | |
try { | ||
if (conn != null) { | ||
LogUtils.LOG.warn("failed to request " + conn.getURL() + " from " | ||
+ InetAddress.getByName(conn.getURL().getHost()).getHostAddress()); | ||
+ InetAddress.getByName(conn.getURL().getHost()).getHostAddress()); | ||
} | ||
} catch (Exception e1) { | ||
LogUtils.LOG.error("NA", "failed to request ", e1); | ||
|
@@ -102,7 +98,7 @@ private static HttpResult getResult(HttpURLConnection conn) throws IOException { | |
|
||
InputStream inputStream; | ||
if (HttpURLConnection.HTTP_OK == respCode | ||
|| HttpURLConnection.HTTP_NOT_MODIFIED == respCode) { | ||
|| HttpURLConnection.HTTP_NOT_MODIFIED == respCode) { | ||
inputStream = conn.getInputStream(); | ||
} else { | ||
inputStream = conn.getErrorStream(); | ||
|
@@ -153,12 +149,12 @@ private static void setHeaders(HttpURLConnection conn, List<String> headers, Str | |
} | ||
|
||
conn.addRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" | ||
+ encoding); | ||
+ encoding); | ||
conn.addRequestProperty("Accept-Charset", encoding); | ||
} | ||
|
||
private static String encodingParams(Map<String, String> params, String encoding) | ||
throws UnsupportedEncodingException { | ||
throws UnsupportedEncodingException { | ||
StringBuilder sb = new StringBuilder(); | ||
if (null == params || params.isEmpty()) { | ||
return null; | ||
|
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class NamingProxy { | ||
|
||
|
@@ -71,7 +71,7 @@ public NamingProxy(String namespace, String endpoint, String serverList) { | |
@Override | ||
public Thread newThread(Runnable r) { | ||
Thread t = new Thread(r); | ||
t.setName("com.taobao.vipserver.serverlist.updater"); | ||
t.setName("com.alibaba.nacos.client.naming.serverlist.updater"); | ||
t.setDaemon(true); | ||
return t; | ||
} | ||
|
@@ -90,7 +90,7 @@ public void run() { | |
public List<String> getServerListFromEndpoint() { | ||
|
||
try { | ||
String urlString = "http://" + endpoint + "/vipserver/serverlist"; | ||
String urlString = "http://" + endpoint + "/nacos/serverlist"; | ||
|
||
List<String> headers = Arrays.asList("Client-Version", UtilAndComs.VERSION, | ||
"Accept-Encoding", "gzip,deflate,sdch", | ||
|
@@ -135,7 +135,7 @@ private void refreshSrvIfNeed() { | |
List<String> list = getServerListFromEndpoint(); | ||
|
||
if (CollectionUtils.isEmpty(list)) { | ||
throw new Exception("Can not acquire vipserver list"); | ||
throw new Exception("Can not acquire Nacos list"); | ||
} | ||
|
||
if (!CollectionUtils.isEqualCollection(list, serversFromEndpoint)) { | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import java.util.List; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class Chooser<K, T> { | ||
|
||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class GenericPoller<T> implements Poller<T> { | ||
|
||
|
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
import java.util.zip.GZIPInputStream; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class IoUtils { | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
package com.alibaba.nacos.client.naming.utils; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class Pair<T> { | ||
|
||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
import java.util.List; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public interface Poller<T> { | ||
/** | ||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
import java.util.Locale; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class StringUtils { | ||
public static boolean isEmpty(String str) { | ||
|
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class NamingTest { | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
import java.util.UUID; | ||
|
||
/** | ||
* @author dungu.zpf | ||
* @author <a href="mailto:zpf[email protected]">nkorange</a> | ||
*/ | ||
public class UuidUtil { | ||
|
||
|
Oops, something went wrong.