Oliverwqcwrw commented on code in PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#discussion_r944326209


##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +221,35 @@ public void persist() {
         }
     }
 
+    public void persistBrokerConf(Properties from) {
+        FileReader reader = null;
+        try {
+            readWriteLock.readLock().lockInterruptibly();
+            String fileName = this.getStorePath();
+            File file = new File(fileName);
+            if (!file.exists()) {
+                file.createNewFile();
+            }
+            Properties properties = new Properties();
+            reader = new FileReader(fileName);
+            properties.load(reader);
+            merge(from, properties);
+            final String str = MixAll.properties2String(properties);
+            MixAll.string2File(str, fileName);
+        } catch (Exception e) {
+            log.error("persist brokerConf error", e);
+        } finally {
+            readWriteLock.readLock().unlock();
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    log.error("Close FileReader occur error", e);

Review Comment:
   Thanks for your review, I have solved it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to