Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync code #2

Merged
merged 90 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
e189cca
Fix #1865
ly641921791 Sep 25, 2019
0d304c0
#2237 1. use ByteArrayEntity 2. getDeclaredMethods
rushsky518 Jan 10, 2020
c997476
revert
rushsky518 Jan 13, 2020
b1ffbad
#2237 directly use byte[]
rushsky518 Jan 15, 2020
8fe3eba
#2237 add a IT_test
rushsky518 Jan 24, 2020
93e730d
wait for async op
rushsky518 Jan 25, 2020
9c5bead
remove blank lines
rushsky518 Jan 27, 2020
7179cc3
[ISSUE #2749]dumpAllTaskMgr did not add the correct processor
wangweizZZ May 21, 2020
ba5098e
fix:#2839
lin-mt May 22, 2020
a7bc539
fix the style
lin-mt May 22, 2020
0ddbe7d
Merge pull request #2875 from alibaba/develop
yanlinly May 25, 2020
6086089
fix #2858 Provide nacosRestTemplate implementation
Maijh97 May 27, 2020
d08eac6
change http client implementation, Unified apacheHttpClient
Maijh97 May 28, 2020
377bbb8
Add some callouts
Maijh97 May 28, 2020
52426d4
change http client implementation, Unified apacheHttpClient
Maijh97 May 28, 2020
238b238
change http client implementation, Unified apacheHttpClient
Maijh97 May 28, 2020
0d775ea
change http client implementation, Unified apacheHttpClient
Maijh97 May 28, 2020
92ca0e1
Remove extra lines
Maijh97 May 28, 2020
886fe6d
[#1815]define LifeCycle interface and related abstract class.
zongtanghu May 29, 2020
57ca56c
add async http request client
Maijh97 May 29, 2020
6981fbc
[#1815]add ResourceLifeCycleManager,adjust some code and fix some uni…
zongtanghu May 29, 2020
ea03121
add NacosRestTemplate and NacosAsyncRestTemplate test example
Maijh97 May 30, 2020
a3a64c5
change annotate
Maijh97 May 30, 2020
066968e
Merge branch 'develop' into develop
Maijh97 May 30, 2020
11cc8da
Resolve conflicts
Maijh97 May 30, 2020
6f3b3e3
test change
Maijh97 May 30, 2020
2b7ebbf
test change
Maijh97 May 30, 2020
6d1baed
[#1815]add the related lifecycle test cases codes.
zongtanghu May 31, 2020
2cb690a
[#1815]add class file license.
zongtanghu May 31, 2020
ab3b234
[#1815]add class file license.
zongtanghu May 31, 2020
031c9ef
perfect NacosRestTemplate and restResult
Maijh97 May 31, 2020
7e05f3e
add class file license.
Maijh97 May 31, 2020
0c02111
add class file license.
Maijh97 May 31, 2020
4fc79b0
code format.
Maijh97 Jun 1, 2020
177b8aa
Merge branch 'develop' into develop
Maijh97 Jun 1, 2020
8768de4
Merge code.
Maijh97 Jun 1, 2020
379aa15
Added syntax compatible with Java 6
Maijh97 Jun 1, 2020
8d6dd8f
[#1815]adjust codes and reput the lifecycle to ConfigService class le…
zongtanghu Jun 1, 2020
a832412
optimize response handler, remove AsyncRestOperations,RestOperations.
Maijh97 Jun 1, 2020
2ab2742
[#1815]adjust and optimize codes, reput the lifecycle to ConfigServic…
zongtanghu Jun 2, 2020
5e2840a
[#1815]adjust and optimize codes.
zongtanghu Jun 3, 2020
aae7b34
Merge remote-tracking branch 'alibaba/develop' into issue_2749
wangweizZZ Jun 3, 2020
dc0c537
Merge remote-tracking branch 'alibaba/develop' into issue_2749
wangweizZZ Jun 3, 2020
0320e58
Merge remote-tracking branch 'upstream/master' into feature_lifecycle
zongtanghu Jun 3, 2020
e86c158
resolve codes conflicts
zongtanghu Jun 3, 2020
c726dd0
Merge branch 'feature_lifecycle' of https://github.com/zongtanghu/nac…
zongtanghu Jun 3, 2020
09752e3
[#1815]adjust this keywords which just includes constructor and set m…
zongtanghu Jun 3, 2020
94c41e1
[#1815]fix unit test cases.
zongtanghu Jun 3, 2020
860a2d0
resolve codes conflicts
zongtanghu Jun 3, 2020
15fad5d
[#1815]remove destroyService from Factory Class.
zongtanghu Jun 3, 2020
8a2921e
[#1815]remove no used package name from Factory Class.
zongtanghu Jun 4, 2020
bf74511
simplify code
J-Cod3r Jun 7, 2020
5191838
fix: fixed Raft RPC being submitted to the Leader, error could not be…
chuntaojun Jun 7, 2020
d916d22
refactor: add ut
chuntaojun Jun 7, 2020
c2e3530
Merge pull request #2981 from alibaba/hotfix_jraft
KomachiSion Jun 7, 2020
7121715
fix: fix task executable judgment logic problems
chuntaojun Jun 7, 2020
99539dd
Merge pull request #2986 from alibaba/hotfix_job_execute_condition
chuntaojun Jun 7, 2020
ab22fc7
Merge pull request #2976 from J-Cod3r/develop
KomachiSion Jun 8, 2020
795005b
fix: where config publish could not trigger horizontal notification i…
chuntaojun Jun 8, 2020
5203ee3
Merge pull request #2990 from alibaba/hotfix_standalone_notify
yanlinly Jun 8, 2020
902d609
perf: optimize configuration change event publishing
chuntaojun Jun 8, 2020
769fe02
ci: modify travis.yml
chuntaojun Jun 8, 2020
38f33b4
Merge pull request #2984 from showkawa/develop
chuntaojun Jun 8, 2020
8f7fb0f
[#1815]remove no used package name from Factory Class and adjust test…
zongtanghu Jun 9, 2020
2efe317
FIX ISSUE #3007 : MaxHistory字段名称和Nacos默认的命名风格不统一
zhouhailin Jun 9, 2020
510ffb5
Merge pull request #2995 from alibaba/perf_config_notify
TsingLiang Jun 10, 2020
ecf65ee
Merge pull request #2849 from lin-mt/develop
KomachiSion Jun 10, 2020
e6c578f
Merge pull request #3008 from zhouhailin/develop
KomachiSion Jun 10, 2020
7f7ee0d
Merge pull request #1877 from ly641921791/issue_1865
KomachiSion Jun 10, 2020
f49eba3
Merge pull request #2287 from rushsky518/sync_content
KomachiSion Jun 10, 2020
d21bbf4
a power of two size for hashmap
jzdayz Jun 10, 2020
0a47bc7
Merge pull request #3021 from jzdayz/develop
KomachiSion Jun 10, 2020
6d24d37
修针对mysql5.6版本使用innodb存储引擎,permissions表resouce字段长度过长,无法建表问题
baolongcheng Jun 10, 2020
990a01b
Update application.properties
alloevil Jun 10, 2020
8d79eb6
Merge pull request #3025 from alloevil/patch-4
KomachiSion Jun 11, 2020
7ae7400
Merge pull request #3023 from baolongcheng/develop
KomachiSion Jun 11, 2020
fa6bf99
remove extra blank lines
Maijh97 Jun 11, 2020
eb39830
[#1815]remove lifeCycle, lifeCycleManager, and adjust some related co…
zongtanghu Jun 11, 2020
e6e3161
resolve the codes conflicts
zongtanghu Jun 11, 2020
9b87379
[#1815]fix ut.
zongtanghu Jun 11, 2020
d2b9806
[#1815]remove code comments.
zongtanghu Jun 11, 2020
e7796b3
[#1815]adjust codes for instance class attribute init.
zongtanghu Jun 11, 2020
4c38fe1
Merge pull request #2927 from zongtanghu/feature_lifecycle
yanlinly Jun 11, 2020
65c6c8c
Merge pull request #2781 from wangweizZZ/issue_2749
yanlinly Jun 11, 2020
95272fe
adjust some codes
Maijh97 Jun 11, 2020
315a6c3
1.update beatinfo when received instance modify info
horizonzy Jun 11, 2020
c6d9426
Merge pull request #3037 from horizonzy/fix-2800
KomachiSion Jun 12, 2020
2f2a329
Add issue robot
KomachiSion Jun 12, 2020
81f9eff
Merge pull request #2926 from Maijh97/develop
KomachiSion Jun 12, 2020
a13aec6
Merge pull request #3054 from KomachiSion/develop-issue-rot
TsingLiang Jun 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[alibaba#1815]adjust and optimize codes, reput the lifecycle to Confi…
…gService class level at the same time.
  • Loading branch information
zongtanghu committed Jun 2, 2020
commit 2ab274216a59cf3e1765de0a940c8ae86d316869
20 changes: 20 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/NacosFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,24 @@ public static NamingMaintainService createMaintainService(Properties properties)
return NamingMaintainFactory.createMaintainService(properties);
}

/**
* Destroy config service instance.
*
* @param configService
* @throws NacosException Exception.
*/
public static void destroyConfigService(ConfigService configService) throws NacosException{
ConfigFactory.destroyConfigService(configService);
}

/**
* Destroy naming service instance.
*
* @param namingService
* @throws NacosException Exception.
*/
public static void destroyNamingService(NamingService namingService) throws NacosException{
NamingFactory.destroyNamingService(namingService);
}

}
15 changes: 15 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,19 @@ public static ConfigService createConfigService(String serverAddr) throws NacosE
return createConfigService(properties);
}

/**
* Destroy Config Instance's Resources.
*
* @param configService
* @throws NacosException
*/
public static void destroyConfigService(ConfigService configService) throws NacosException{
try {
configService.shutDown();
configService = null;
}catch (Throwable e) {
throw new NacosException(NacosException.RESOURCE_DESTROY_FAILED, e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,9 @@ public interface ConfigService {
String getServerStatus();

/**
* Shutdown the resouces which are managed by config service object instance.
* Shutdown the resource service
*
* @throws NacosException exception.
*/
/**
* Close the resouces which are managed by config service object instance.
*
* @throws Exception Exception occours when executing close operation.
*/
void shutdown() throws Exception;

void shutDown() throws NacosException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,9 @@ public String toString() {

public static final int RESOURCE_NOT_FOUND = -404;

/**
* resource instance destroy failed.
*/
public static final int RESOURCE_DESTROY_FAILED = 410;

}
16 changes: 16 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/naming/NamingFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.lang.reflect.Constructor;
import java.util.Properties;

import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;

/**
Expand Down Expand Up @@ -48,4 +49,19 @@ public static NamingService createNamingService(Properties properties) throws Na
throw new NacosException(NacosException.CLIENT_INVALID_PARAM, e);
}
}

/**
* Destroy Config Instance's Resources.
*
* @param namingService
* @throws NacosException
*/
public static void destroyNamingService(NamingService namingService) throws NacosException{
try {
namingService.shutDown();
namingService = null;
}catch (Throwable e) {
throw new NacosException(NacosException.RESOURCE_DESTROY_FAILED, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,11 @@ public interface NamingService {
* @return is server healthy
*/
String getServerStatus();

/**
* Shutdown the resource service.
*
* @throws NacosException exception.
*/
void shutDown() throws NacosException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
import com.alibaba.nacos.client.utils.LogUtils;
import com.alibaba.nacos.client.utils.ParamUtil;
import com.alibaba.nacos.client.utils.ValidatorUtils;
import com.alibaba.nacos.common.lifecycle.AbstractLifeCycle;
import com.alibaba.nacos.common.lifecycle.LifeCycleState;
import com.alibaba.nacos.common.lifecycle.LifeCycle;
import com.alibaba.nacos.common.lifecycle.ResourceLifeCycleManager;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.rmi.server.ExportException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -54,7 +52,7 @@
* @author Nacos
*/
@SuppressWarnings("PMD.ServiceOrDaoClassShouldEndWithImplRule")
public class NacosConfigService extends AbstractLifeCycle implements ConfigService {
public class NacosConfigService implements ConfigService, LifeCycle {

private static final Logger LOGGER = LogUtils.logger(NacosConfigService.class);

Expand All @@ -72,9 +70,9 @@ public class NacosConfigService extends AbstractLifeCycle implements ConfigServi
private String encode;
private ConfigFilterChainManager configFilterChainManager = new ConfigFilterChainManager();

public NacosConfigService(Properties properties) throws NacosException {
super();
private static final ResourceLifeCycleManager RESOURCE_MANAGER = ResourceLifeCycleManager.getInstance();

public NacosConfigService(Properties properties) throws NacosException {
ValidatorUtils.checkInitParam(properties);
String encodeTmp = properties.getProperty(PropertyKeyConst.ENCODE);
if (StringUtils.isBlank(encodeTmp)) {
Expand All @@ -83,9 +81,11 @@ public NacosConfigService(Properties properties) throws NacosException {
encode = encodeTmp.trim();
}
initNamespace(properties);

agent = new MetricsHttpAgent(new ServerHttpAgent(properties));
agent.fetchServerIpList();
worker = new ClientWorker(agent, configFilterChainManager, properties);
RESOURCE_MANAGER.register(this);
}

private void initNamespace(Properties properties) {
Expand Down Expand Up @@ -288,16 +288,12 @@ public String getServerStatus() {
}

@Override
public void shutdown() throws Exception {
this.stop();
}

@Override
protected void doStart() throws Exception {
public void shutDown() throws NacosException{
destroy();
}

@Override
protected void doStop() throws Exception {
public void destroy() throws NacosException{
this.agent.shutdown();
this.worker.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* @author Nacos
*/
public class MetricsHttpAgent implements HttpAgent {

private HttpAgent httpAgent;

public MetricsHttpAgent(HttpAgent httpAgent) {
Expand All @@ -42,15 +43,15 @@ public MetricsHttpAgent(HttpAgent httpAgent) {

@Override
public void fetchServerIpList() throws NacosException {
httpAgent.fetchServerIpList();
this.httpAgent.fetchServerIpList();
}

@Override
public HttpResult httpGet(String path, List<String> headers, List<String> paramValues, String encoding, long readTimeoutMs) throws IOException {
Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor("GET", path, "NA");
HttpResult result;
try {
result = httpAgent.httpGet(path, headers, paramValues, encoding, readTimeoutMs);
result = this.httpAgent.httpGet(path, headers, paramValues, encoding, readTimeoutMs);
} catch (IOException e) {
throw e;
} finally {
Expand All @@ -66,7 +67,7 @@ public HttpResult httpPost(String path, List<String> headers, List<String> param
Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor("POST", path, "NA");
HttpResult result;
try {
result = httpAgent.httpPost(path, headers, paramValues, encoding, readTimeoutMs);
result = this.httpAgent.httpPost(path, headers, paramValues, encoding, readTimeoutMs);
} catch (IOException e) {
throw e;
} finally {
Expand All @@ -82,7 +83,7 @@ public HttpResult httpDelete(String path, List<String> headers, List<String> par
Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor("DELETE", path, "NA");
HttpResult result;
try {
result = httpAgent.httpDelete(path, headers, paramValues, encoding, readTimeoutMs);
result = this.httpAgent.httpDelete(path, headers, paramValues, encoding, readTimeoutMs);
} catch (IOException e) {

throw e;
Expand All @@ -96,32 +97,27 @@ public HttpResult httpDelete(String path, List<String> headers, List<String> par

@Override
public String getName() {
return httpAgent.getName();
return this.httpAgent.getName();
}

@Override
public String getNamespace() {
return httpAgent.getNamespace();
return this.httpAgent.getNamespace();
}

@Override
public String getTenant() {
return httpAgent.getTenant();
return this.httpAgent.getTenant();
}

@Override
public String getEncode() {
return httpAgent.getEncode();
}

@Override
public void close() throws IOException {

return this.httpAgent.getEncode();
}

@Override
public void shutdown() throws InterruptedException {
httpAgent.shutdown();
public void shutdown() throws NacosException{
this.httpAgent.shutdown();
}
}

Loading