doleyzi commented on code in PR #10366:
URL: https://github.com/apache/inlong/pull/10366#discussion_r1629374995


##########
inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/util/RequestIdUtils.java:
##########
@@ -17,33 +17,22 @@
 
 package org.apache.inlong.audit.util;
 
-import java.net.InetSocketAddress;
+import java.util.concurrent.atomic.AtomicLong;
 
-public class SenderResult {
+public class RequestIdUtils {
 
-    public final InetSocketAddress addr;
-    public boolean result;
+    private static final Long MAX_REQUEST_ID = 1000000000L;
+    private static final AtomicLong requestIdSeq = new AtomicLong(0L);
 
     /**
-     * Constructor
-     *
-     * @param addr
-     * @param result
+     * Next request id
      */
-    public SenderResult(InetSocketAddress addr, boolean result) {
-        this.addr = addr;
-        this.result = result;
-    }
-
-    /**
-     * Constructor
-     *
-     * @param sendIp
-     * @param sendPort
-     * @param result
-     */
-    public SenderResult(String sendIp, int sendPort, boolean result) {
-        this.addr = new InetSocketAddress(sendIp, sendPort);
-        this.result = result;
+    public static Long nextRequestId() {

Review Comment:
   It doesn't matter, requestId is just used as a request ID. When the sending 
fails, the data that marks the SDK instance fails. In addition, only when it is 
0, does global duplication occur, but each SDK instance is obtained by a single 
thread, and duplication is impossible.
   1. Both agent and dataproxy are single instances and only operate with one 
thread.
   2. Sort uses multiple instances. Each instance is single-threaded. A single 
thread obtains the RequestId serially without duplication.



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to