Skip to content

Commit

Permalink
Merge branch 'upstream-develop'
Browse files Browse the repository at this point in the history
# 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
hxy1991 committed Dec 3, 2018
2 parents 30e7c52 + be0ba62 commit cbc8b0a
Show file tree
Hide file tree
Showing 76 changed files with 117 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public interface NamingService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

/**
* event interface
*
* @author dungu.zpf
* @author <a href="mailto:[email protected]">nkorange</a>
*/
public interface Event {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Map;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class Cluster {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Map;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class Instance {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.List;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class ListView<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Map;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class Service {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class ServiceInfo {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.concurrent.*;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class FailoverReactor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class BeatInfo {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public HostReactor(EventDispatcher eventDispatcher, NamingProxy serverProxy, Str
private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "com.vipserver.client.updater");
Thread thread = new Thread(r, "com.alibaba.nacos.client.naming.updater");
thread.setDaemon(true);

return thread;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.concurrent.TimeUnit;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class NamingProxy {

Expand Down Expand Up @@ -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;
}
Expand All @@ -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",
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.zip.GZIPInputStream;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class IoUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static String localIP() {
return LOCAL_IP;
}

String ip = System.getProperty("com.taobao.vipserver.localIP", InetAddress.getLocalHost().getHostAddress());
String ip = System.getProperty("com.alibaba.nacos.client.naming.local.ip", InetAddress.getLocalHost().getHostAddress());

return LOCAL_IP = ip;
} catch (UnknownHostException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public interface Poller<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Map;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class NamingTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static String getClusterConfFilePath() {
public static List<String> readClusterConf() throws IOException {
List<String> instanceList = new ArrayList<String>();
List<String> lines = IoUtils.readLines(
new InputStreamReader(new FileInputStream(new File(CLUSTER_CONF_FILE_PATH)), UTF_8));
new InputStreamReader(new FileInputStream(new File(CLUSTER_CONF_FILE_PATH)), UTF_8));
String comment = "#";
for (String line : lines) {
String instance = line.trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.UUID;

/**
* @author dungu.zpf
* @author <a href="mailto:zpf[email protected]">nkorange</a>
*/
public class UuidUtil {

Expand Down
Loading

0 comments on commit cbc8b0a

Please sign in to comment.