File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
topic/src/main/java/tech/ydb/topic/impl Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11package tech .ydb .topic .impl ;
22
3- import java .util .UUID ;
3+ import java .util .Random ;
44import java .util .concurrent .CompletableFuture ;
55import java .util .concurrent .RejectedExecutionException ;
66import java .util .concurrent .ScheduledExecutorService ;
@@ -22,6 +22,9 @@ public abstract class GrpcStreamRetrier {
2222 private static final int EXP_BACKOFF_BASE_MS = 256 ;
2323 private static final int EXP_BACKOFF_CEILING_MS = 40000 ; // 40 sec (max delays would be 40-80 sec)
2424 private static final int EXP_BACKOFF_MAX_POWER = 7 ;
25+ private static final int ID_LENGTH = 50 ;
26+ private static final char [] ID_ALPHABET = "abcdefghijklmnopqrstuvwxyzABSDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
27+ .toCharArray ();
2528
2629 protected final String id ;
2730 protected final AtomicBoolean isReconnecting = new AtomicBoolean (false );
@@ -31,7 +34,11 @@ public abstract class GrpcStreamRetrier {
3134
3235 protected GrpcStreamRetrier (ScheduledExecutorService scheduler ) {
3336 this .scheduler = scheduler ;
34- this .id = UUID .randomUUID ().toString ();
37+ this .id = new Random ().ints (0 , ID_ALPHABET .length )
38+ .limit (ID_LENGTH )
39+ .map (charId -> ID_ALPHABET [charId ])
40+ .collect (StringBuilder ::new , StringBuilder ::appendCodePoint , StringBuilder ::append )
41+ .toString ();
3542 }
3643
3744 protected abstract Logger getLogger ();
You can’t perform that action at this time.
0 commit comments