chickenlj commented on code in PR #10040:
URL: https://github.com/apache/dubbo/pull/10040#discussion_r894191406


##########
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/AccessLogFilter.java:
##########
@@ -148,23 +149,24 @@ private void writeLogSetToFile(String accessLog, 
Set<AccessLogData> logSet) {
 
     private void writeLogToFile() {
         if (!logEntries.isEmpty()) {
-            for (Map.Entry<String, Set<AccessLogData>> entry : 
logEntries.entrySet()) {
+            for (Map.Entry<String, Queue<AccessLogData>> entry : 
logEntries.entrySet()) {
                 String accessLog = entry.getKey();
-                Set<AccessLogData> logSet = entry.getValue();
+                Queue<AccessLogData> logSet = entry.getValue();
                 writeLogSetToFile(accessLog, logSet);
             }
         }
     }
 
-    private void processWithAccessKeyLogger(Set<AccessLogData> logSet, File 
file) throws IOException {
-        try (FileWriter writer = new FileWriter(file, true)) {
-            for (Iterator<AccessLogData> iterator = logSet.iterator();
-                 iterator.hasNext();
-                 iterator.remove()) {
-                writer.write(iterator.next().getLogMessage());
-                writer.write(System.getProperty("line.separator"));
+    private void processWithAccessKeyLogger(Queue<AccessLogData> logQueue, 
File file) throws IOException {
+        FileWriter writer = new FileWriter(file, true);
+        try {
+            while (!logQueue.isEmpty()) {
+                writer.write(logQueue.poll().getLogMessage());
+                writer.write(System.getProperty(LINE_SEPARATOR));

Review Comment:
   It's fine for this task will be scheduled in a separate thread.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to