[
https://issues.apache.org/jira/browse/SCB-782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16571053#comment-16571053
]
ASF GitHub Bot commented on SCB-782:
------------------------------------
liubao68 commented on a change in pull request #851: [SCB-782]support revision
check when use pull mode with config center
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/851#discussion_r208084785
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ParseConfigUtils.java
##########
@@ -37,35 +39,63 @@
private static final Logger LOGGER =
LoggerFactory.getLogger(ParseConfigUtils.class);
private static LinkedHashMap<String, Map<String, Object>>
multiDimensionItems = new LinkedHashMap<>();
+ //it's dangerous that makes flatItems public
+ private static final Map<String, Object> flatItems = new HashMap<>();
- public static final Map<String, Object> flatItems = new HashMap<>();
+ private static String currentVersionInfo = "default";
private UpdateHandler updateHandler;
+ private Lock configLock = new ReentrantLock();
+
public ParseConfigUtils(UpdateHandler updateHandler) {
this.updateHandler = updateHandler;
}
+ /*
+ as the data is returned, we can block the thread at a short time. consider
that if the multiple verticle is deployed
+ and if we use pull mode and push mode at the same time , we must share a
common lock with all methods which would
+ change the config setting
+ */
public void refreshConfigItems(Map<String, Map<String, Object>> remoteItems)
{
- multiDimensionItems.clear();
- multiDimensionItems.putAll(remoteItems);
- doRefreshItems();
- LOGGER.debug("refresh config success");
+ try {
+ configLock.lock();
Review comment:
This concurrent control may not work as expected. Because data holding in
this class is static, and lock is instance level.
Anyway, this class only have one instance in runtime in this module, it will
cause no problem. It's better we can modify this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [SCB-782]support revision check when use pull mode with config center
> ---------------------------------------------------------------------
>
> Key: SCB-782
> URL: https://issues.apache.org/jira/browse/SCB-782
> Project: Apache ServiceComb
> Issue Type: Improvement
> Components: Java-Chassis
> Reporter: 何一乐
> Assignee: 何一乐
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)