Skip to content

Commit

Permalink
release 0.1.2 (#294)
Browse files Browse the repository at this point in the history
* Remove redundant semicolons and modify non-standard names

* remove duplicate RM init

* issue #86 length of applicationData should be int

* fix: fixed qualifier

* Modify method description of DemoCode

* Update ConfigurationKeys.java

* config instance obtained by the factory class

* fix typo of `retryable` as the annotation of Spring Retryable. add static code to init BranchStatus mapper to speed up get(int ordinal)

* add template

* add template

* add template

* fixes #117

* fixes #114

* fix issue #122

* update template

* fix file.RenameTo->Files.move

* #73 add travis config

* fix #121

* #73 add travis config

* fix #135 delete BranchSession main

* fix #137 param position err

* fix #142 delete defaultEventExecutorGroup

* fix #142 delete defaultEventExecutorGroup (#144)

* fix #139 netty heartbeat configurable

* fixes #139 heartbeat configurable (#146)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke (#140)

* fix: When local branch change nothing, the RC will rise an NullpointerException (#155)

* bugfix: when no record changed register localBranch will occur exception
in TC

* clean the environment

* enhancement: when no changes in local branch let RC not throw an
NullpointerException

* change tabs to spaces

* fix #150 use ServerBootstrap#childOption() to set SO_KEEPALIVE (#151)

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke

* Netty SO_KEEPALIVE option not works on ServerBootstrap#option(), should replace with ServerBootstrap#childOption()

* fix #149 (long)->Number.longValue

*  fix #149 (long)->Number.longValue (#156)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* remove mistake twitter icon (#165)

* Update README.md

* Update README.md

* issue #110 bug fix for RM channel management (#169)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* fix: Unify `undo_log` table name variable (#174)

* ShowSql might be better when debugging to execute the demo to observe the data. (#164)

issues #158

* revert OrderServiceImpl

* change version 0.1.2-SNAPSHOT (#179)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* Fix 3 problems of GlobalTransactionScanner class (#160)

* 1.Fix the problem of duplicate creating objectes
2.Remove the unnecessary type parameter

* Let the PROXYED_SET just contains that has method annotated by @GlobalTransactional

* Let not the first proxyed bean but the multiple proxyed bean can be added to PROXYED_SET

* fix #201 add sample module sql script (#202)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix #201 add sample module sql script

* fix #206 optimize sample log print location.

* Optimize slf4j logger output. (#203)

* sample OrderServiceImpl long->longValue() (#214)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix #201 add sample module sql script

* fix #206 optimize sample log print location.

* fix #213 sample OrderServiceImpl long->longValue()

* add sessionManager unit test (#222)

* 1.Add static final default FailureHandler to scanner and interceptor (#209)

2.Move static final field to the head of other fields

* fixs #227  (#229)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* issue #227 SQLVisitorFactory should recognize FOR UPDATE from normal SELECT SQL

* fixes #233 add package jvmSettings (#234)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix #201 add sample module sql script

* fix #206 optimize sample log print location.

* fix #213 sample OrderServiceImpl long->longValue()

* fix #233 add package jvmSettings

* add  unit test for session package (#237)

* add copyright and import testng framework

* add global&branch session unit test

* issue #244 Should support SQL with table alias (#247)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* issue #227 SQLVisitorFactory should recognize FOR UPDATE from normal SELECT SQL

* issue #24 Should support SQL with table alias

* remove useless import

* Add unit test 20190123 (#248)

* release 0.1.1 (#178)

* Remove redundant semicolons and modify non-standard names

* remove duplicate RM init

* issue #86 length of applicationData should be int

* fix: fixed qualifier

* Modify method description of DemoCode

* Update ConfigurationKeys.java

* config instance obtained by the factory class

* fix typo of `retryable` as the annotation of Spring Retryable. add static code to init BranchStatus mapper to speed up get(int ordinal)

* add template

* add template

* add template

* fixes #117

* fixes #114

* fix issue #122

* update template

* fix file.RenameTo->Files.move

* #73 add travis config

* fix #121

* #73 add travis config

* fix #135 delete BranchSession main

* fix #137 param position err

* fix #142 delete defaultEventExecutorGroup

* fix #142 delete defaultEventExecutorGroup (#144)

* fix #139 netty heartbeat configurable

* fixes #139 heartbeat configurable (#146)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke (#140)

* fix: When local branch change nothing, the RC will rise an NullpointerException (#155)

* bugfix: when no record changed register localBranch will occur exception
in TC

* clean the environment

* enhancement: when no changes in local branch let RC not throw an
NullpointerException

* change tabs to spaces

* fix #150 use ServerBootstrap#childOption() to set SO_KEEPALIVE (#151)

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke

* Netty SO_KEEPALIVE option not works on ServerBootstrap#option(), should replace with ServerBootstrap#childOption()

* fix #149 (long)->Number.longValue

*  fix #149 (long)->Number.longValue (#156)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* remove mistake twitter icon (#165)

* Update README.md

* Update README.md

* issue #110 bug fix for RM channel management (#169)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* fix: Unify `undo_log` table name variable (#174)

* ShowSql might be better when debugging to execute the demo to observe the data. (#164)

issues #158

* revert OrderServiceImpl

* add toString method

* fix

* add unit test

* extract jdbc config on demo project (#246)

* extract jdbc config on demo project

* independent db config for different service.

* fix #250 add support zk (#253)

* fix unit test case CodecTest (#261)

* release 0.1.1 (#178)

* Remove redundant semicolons and modify non-standard names

* remove duplicate RM init

* issue #86 length of applicationData should be int

* fix: fixed qualifier

* Modify method description of DemoCode

* Update ConfigurationKeys.java

* config instance obtained by the factory class

* fix typo of `retryable` as the annotation of Spring Retryable. add static code to init BranchStatus mapper to speed up get(int ordinal)

* add template

* add template

* add template

* fixes #117

* fixes #114

* fix issue #122

* update template

* fix file.RenameTo->Files.move

* #73 add travis config

* fix #121

* #73 add travis config

* fix #135 delete BranchSession main

* fix #137 param position err

* fix #142 delete defaultEventExecutorGroup

* fix #142 delete defaultEventExecutorGroup (#144)

* fix #139 netty heartbeat configurable

* fixes #139 heartbeat configurable (#146)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke (#140)

* fix: When local branch change nothing, the RC will rise an NullpointerException (#155)

* bugfix: when no record changed register localBranch will occur exception
in TC

* clean the environment

* enhancement: when no changes in local branch let RC not throw an
NullpointerException

* change tabs to spaces

* fix #150 use ServerBootstrap#childOption() to set SO_KEEPALIVE (#151)

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke

* Netty SO_KEEPALIVE option not works on ServerBootstrap#option(), should replace with ServerBootstrap#childOption()

* fix #149 (long)->Number.longValue

*  fix #149 (long)->Number.longValue (#156)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* remove mistake twitter icon (#165)

* Update README.md

* Update README.md

* issue #110 bug fix for RM channel management (#169)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* fix: Unify `undo_log` table name variable (#174)

* ShowSql might be better when debugging to execute the demo to observe the data. (#164)

issues #158

* revert OrderServiceImpl

* add toString method

* add toString method

* add toString method

* add toString method

* fix

* 小优化-类型转换

* 类型转换小优化

* fix unit test class CodecTest.java

* fix merge conflicts

* fixes #255 (#256)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* issue #227 SQLVisitorFactory should recognize FOR UPDATE from normal SELECT SQL

* issue #24 Should support SQL with table alias

* remove useless import

* issue #255 Should work with case-sensitive database

* remove unnecessary check and change some constants to capital letter (#269)

* spring rm distinct (#263)

* #266 deal exception scenes of retry rollback failure (#270)

* add unit test to core module (#276)

* release 0.1.1 (#178)

* Remove redundant semicolons and modify non-standard names

* remove duplicate RM init

* issue #86 length of applicationData should be int

* fix: fixed qualifier

* Modify method description of DemoCode

* Update ConfigurationKeys.java

* config instance obtained by the factory class

* fix typo of `retryable` as the annotation of Spring Retryable. add static code to init BranchStatus mapper to speed up get(int ordinal)

* add template

* add template

* add template

* fixes #117

* fixes #114

* fix issue #122

* update template

* fix file.RenameTo->Files.move

* #73 add travis config

* fix #121

* #73 add travis config

* fix #135 delete BranchSession main

* fix #137 param position err

* fix #142 delete defaultEventExecutorGroup

* fix #142 delete defaultEventExecutorGroup (#144)

* fix #139 netty heartbeat configurable

* fixes #139 heartbeat configurable (#146)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke (#140)

* fix: When local branch change nothing, the RC will rise an NullpointerException (#155)

* bugfix: when no record changed register localBranch will occur exception
in TC

* clean the environment

* enhancement: when no changes in local branch let RC not throw an
NullpointerException

* change tabs to spaces

* fix #150 use ServerBootstrap#childOption() to set SO_KEEPALIVE (#151)

* FileTransactionStoreManager#closeFile() method remove redundant fileChannel.close() invoke

* Netty SO_KEEPALIVE option not works on ServerBootstrap#option(), should replace with ServerBootstrap#childOption()

* fix #149 (long)->Number.longValue

*  fix #149 (long)->Number.longValue (#156)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* remove mistake twitter icon (#165)

* Update README.md

* Update README.md

* issue #110 bug fix for RM channel management (#169)

* issue #110 fix RM channel management

* fix merge mistake

* issue #110 enhance: if no channel found on my application set, try other application on the same resource.

* bug fix and enhance

* issue #110 enhance the original fix

* fix: Unify `undo_log` table name variable (#174)

* ShowSql might be better when debugging to execute the demo to observe the data. (#164)

issues #158

* revert OrderServiceImpl

* add toString method

* add toString method

* add toString method

* add toString method

* fix

* 小优化-类型转换

* 类型转换小优化

* add unit test to fescar/core/message package

* merge conflichts

* add lock manager test (#278)

* add lock manager test

* add store unit test

* add unit test for server package LockManager and DefaultCore (#262)

* add unit test for server lock and default core

* mysql_recognizer unit_test (#280)

* mysql_recognizer unit_test

* format code

* fixed branchRegister use branchType (#275)

* fix #271 add FileConfigurationTest, add addConfigListener removeConfigListener getConfigListeners impl, rm sample RmClientAT.init(),fix userDefined timeout not function (#272)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix #201 add sample module sql script

* fix #206 optimize sample log print location.

* fix #213 sample OrderServiceImpl long->longValue()

* fix #233 add package jvmSettings

* fix #271 add FileConfigurationTest,add addConfigListener removeConfigListener getConfigListeners impl,rm sample RmClientAT.init(),fix user defined timeout not function

* fix #271 add FileConfigurationTest,add addConfigListener removeConfigListener getConfigListeners impl,rm sample RmClientAT.init(),fix user defined timeout not function

* fix #257 when timeout should break (#283)

* add volatile (#273)

* fix #292 update pom package (#293)

* fix #142 delete defaultEventExecutorGroup

* fix #139 netty heartbeat configurable

* fix #149 (long)->Number.longValue

* revert OrderServiceImpl, change version 0.1.2-SNAPSHOT

* fix #201 add sample module sql script

* fix #206 optimize sample log print location.

* fix #213 sample OrderServiceImpl long->longValue()

* fix #233 add package jvmSettings

* fix #271 add FileConfigurationTest,add addConfigListener removeConfigListener getConfigListeners impl,rm sample RmClientAT.init(),fix user defined timeout not function

* fix #271 add FileConfigurationTest,add addConfigListener removeConfigListener getConfigListeners impl,rm sample RmClientAT.init(),fix user defined timeout not function

* update package pom
  • Loading branch information
slievrly authored and sharajava committed Jan 25, 2019
1 parent db61c3c commit 5b8c8b0
Show file tree
Hide file tree
Showing 86 changed files with 2,977 additions and 451 deletions.
5 changes: 5 additions & 0 deletions changeVersion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
echo "./changeVersion.sh oldVersion newVersion"
echo $1
echo $2
find ./ -name pom.xml | grep -v target | xargs perl -pi -e "s|$1|$2|g"
#find ./ -name Version.java | grep -v target | xargs perl -pi -e "s|$1|$2|g"
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>fescar-all</artifactId>
<groupId>com.alibaba.fescar</groupId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fescar-common</artifactId>
Expand Down
8 changes: 7 additions & 1 deletion config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>fescar-all</artifactId>
<groupId>com.alibaba.fescar</groupId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fescar-config</artifactId>
Expand Down Expand Up @@ -51,6 +51,12 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.alibaba.fescar.config;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;

/**
* The interface Config change listener.
Expand All @@ -34,7 +34,7 @@ public interface ConfigChangeListener {
*
* @return the executor
*/
Executor getExecutor();
ExecutorService getExecutor();

/**
* Receive config info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

package com.alibaba.fescar.config;

import java.util.List;

/**
* The interface Configuration.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar-all
* @Project: fescar -all
* @DateTime: 2018 /12/20 14:22
* @FileName: Configuration
* @Description:
Expand Down Expand Up @@ -215,4 +217,12 @@ public interface Configuration {
*/
void removeConfigListener(String dataId, ConfigChangeListener listener);

/**
* Gets config listeners.
*
* @param dataId the data id
* @return the config listeners
*/
List<ConfigChangeListener> getConfigListeners(String dataId);

}
133 changes: 127 additions & 6 deletions config/src/main/java/com/alibaba/fescar/config/FileConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

package com.alibaba.fescar.config;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
Expand All @@ -33,7 +38,7 @@
* The type FileConfiguration.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar-all
* @Project: fescar -all
* @DateTime: 2018 /9/10 11:34
* @FileName: FileConfiguration
* @Description:
Expand All @@ -46,19 +51,33 @@ public class FileConfiguration implements Configuration {

private ExecutorService configOperateExecutor;

private ExecutorService configChangeExecutor;

private static final int CORE_CONFIG_OPERATE_THREAD = 1;

private static final int CORE_CONFIG_CHANGE_THREAD = 1;

private static final int MAX_CONFIG_OPERATE_THREAD = 2;

private static final long DEFAULT_CONFIG_TIMEOUT = 5 * 1000;

private static final long LISTENER_CONFIG_INTERNAL = 1 * 1000;

private final ConcurrentMap<String, List<ConfigChangeListener>> configListenersMap = new ConcurrentHashMap<>();

private final ConcurrentMap<String, String> listenedConfigMap = new ConcurrentHashMap<>();

/**
* Instantiates a new File configuration.
*/
public FileConfiguration() {
configOperateExecutor = new ThreadPoolExecutor(CORE_CONFIG_OPERATE_THREAD, MAX_CONFIG_OPERATE_THREAD,
Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("configOperate", MAX_CONFIG_OPERATE_THREAD, true));
new NamedThreadFactory("configOperate", MAX_CONFIG_OPERATE_THREAD));
configChangeExecutor = new ThreadPoolExecutor(CORE_CONFIG_CHANGE_THREAD, CORE_CONFIG_CHANGE_THREAD,
Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("configChange", CORE_CONFIG_CHANGE_THREAD));
configChangeExecutor.submit(new ConfigChangeRunnable());
}

@Override
Expand Down Expand Up @@ -113,7 +132,7 @@ public boolean getBoolean(String dataId) {
public String getConfig(String dataId, String defaultValue, long timeoutMills) {
ConfigFuture configFuture = new ConfigFuture(dataId, defaultValue, ConfigOperation.GET, timeoutMills);
configOperateExecutor.submit(new ConfigOperateRunnable(configFuture));
return (String)configFuture.get();
return (String)configFuture.get(timeoutMills, TimeUnit.MILLISECONDS);
}

@Override
Expand Down Expand Up @@ -147,7 +166,7 @@ public boolean putConfig(String dataId, String content) {
public boolean putConfigIfAbsent(String dataId, String content, long timeoutMills) {
ConfigFuture configFuture = new ConfigFuture(dataId, content, ConfigOperation.PUTIFABSENT, timeoutMills);
configOperateExecutor.submit(new ConfigOperateRunnable(configFuture));
return (Boolean)configFuture.get();
return (Boolean)configFuture.get(timeoutMills, TimeUnit.MILLISECONDS);
}

@Override
Expand All @@ -159,7 +178,7 @@ public boolean putConfigIfAbsent(String dataId, String content) {
public boolean removeConfig(String dataId, long timeoutMills) {
ConfigFuture configFuture = new ConfigFuture(dataId, null, ConfigOperation.REMOVE, timeoutMills);
configOperateExecutor.submit(new ConfigOperateRunnable(configFuture));
return (Boolean)configFuture.get();
return (Boolean)configFuture.get(timeoutMills, TimeUnit.MILLISECONDS);
}

@Override
Expand All @@ -169,12 +188,36 @@ public boolean removeConfig(String dataId) {

@Override
public void addConfigListener(String dataId, ConfigChangeListener listener) {

configListenersMap.putIfAbsent(dataId, new ArrayList<ConfigChangeListener>());
configListenersMap.get(dataId).add(listener);
if (null != listener.getExecutor()) {
ConfigChangeRunnable configChangeTask = new ConfigChangeRunnable(dataId, listener);
listener.getExecutor().submit(configChangeTask);
}
}

@Override
public void removeConfigListener(String dataId, ConfigChangeListener listener) {
List<ConfigChangeListener> configChangeListeners = getConfigListeners(dataId);
if (configChangeListeners == null) {
return;
}
List<ConfigChangeListener> newChangeListenerList = new ArrayList<>();
for (ConfigChangeListener changeListener : configChangeListeners) {
if (!changeListener.equals(listener)) {
newChangeListenerList.add(changeListener);
}
}
configListenersMap.put(dataId, newChangeListenerList);
if (null != listener.getExecutor()) {
listener.getExecutor().shutdownNow();
}

}

@Override
public List<ConfigChangeListener> getConfigListeners(String dataId) {
return configListenersMap.get(dataId);
}

/**
Expand All @@ -198,6 +241,7 @@ public void run() {
if (null != configFuture) {
if (configFuture.isTimeout()) {
setFailResult(configFuture);
return;
}
if (configFuture.getOperation() == ConfigOperation.GET) {
String result = CONFIG.getString(configFuture.getDataId());
Expand Down Expand Up @@ -226,4 +270,81 @@ private void setFailResult(ConfigFuture configFuture) {

}

/**
* The type Config change runnable.
*/
class ConfigChangeRunnable implements Runnable {

private String dataId;
private ConfigChangeListener listener;

/**
* Instantiates a new Config change runnable.
*/
public ConfigChangeRunnable() {}

/**
* Instantiates a new Config change runnable.
*
* @param dataId the data id
* @param listener the listener
*/
public ConfigChangeRunnable(String dataId, ConfigChangeListener listener) {

if (null == listener.getExecutor()) {
throw new IllegalArgumentException("getExecutor is null.");
}
this.dataId = dataId;
this.listener = listener;
}

@Override
public void run() {
while (true) {
try {
Map<String, List<ConfigChangeListener>> configListenerMap;
if (null != dataId && null != listener) {
configListenerMap = new ConcurrentHashMap<>();
configListenerMap.put(dataId, new ArrayList<ConfigChangeListener>());
configListenerMap.get(dataId).add(listener);
} else {
configListenerMap = configListenersMap;
}
for (Map.Entry<String, List<ConfigChangeListener>> entry : configListenerMap.entrySet()) {
String configId = entry.getKey();
String currentConfig = getConfig(configId);
if (null != currentConfig && currentConfig.equals(listenedConfigMap.get(configId))) {
listenedConfigMap.put(configId, currentConfig);
notifyAllListener(configId, configListenerMap.get(configId));

} else if (null == currentConfig && null != listenedConfigMap.get(configId)) {
notifyAllListener(configId, configListenerMap.get(configId));
}
}
Thread.sleep(LISTENER_CONFIG_INTERNAL);
} catch (Exception exx) {
LOGGER.error(exx.getMessage());
}

}
}

private void notifyAllListener(String dataId, List<ConfigChangeListener> configChangeListeners) {
List<ConfigChangeListener> needNotifyListeners = new ArrayList<>();
if (null != dataId && null != listener) {
needNotifyListeners.addAll(configChangeListeners);
} else {
for (ConfigChangeListener configChangeListener : configChangeListeners) {
if (null == configChangeListener.getExecutor()) {
needNotifyListeners.add(configChangeListener);
}
}
}
for (ConfigChangeListener configChangeListener : needNotifyListeners) {
configChangeListener.receiveConfigInfo(listenedConfigMap.get(dataId));
}
}

}

}
Loading

0 comments on commit 5b8c8b0

Please sign in to comment.