File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1818
1919import org .apache .dubbo .common .utils .StringUtils ;
2020
21+ import java .security .SecureRandom ;
2122import java .util .concurrent .ThreadLocalRandom ;
2223import java .util .concurrent .atomic .AtomicLong ;
2324
2829 */
2930public class Request {
3031
31- private static final AtomicLong INVOKE_ID = new AtomicLong ( ThreadLocalRandom . current (). nextLong ()) ;
32+ private static final AtomicLong INVOKE_ID ;
3233
3334 private final long mId ;
3435
@@ -50,6 +51,16 @@ public Request(long id) {
5051 mId = id ;
5152 }
5253
54+ static {
55+ long startID = ThreadLocalRandom .current ().nextLong ();
56+ try {
57+ SecureRandom rand = new SecureRandom (SecureRandom .getSeed (20 ));
58+ startID = rand .nextLong ();
59+ } catch (Throwable ignore ) {
60+ }
61+ INVOKE_ID = new AtomicLong (startID );
62+ }
63+
5364 private static long newId () {
5465 // getAndIncrement() When it grows to MAX_VALUE, it will grow to MIN_VALUE, and the negative can be used as ID
5566 return INVOKE_ID .getAndIncrement ();
You can’t perform that action at this time.
0 commit comments