File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
polaris-sync-commons/src/main/java/cn/polarismesh/polaris/sync/common/rest
polaris-sync-registry-core/src/main/java/cn/polarismesh/polaris/sync/registry/tasks Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 2020import java .time .Duration ;
2121import java .util .List ;
2222import java .util .Random ;
23+ import java .util .concurrent .ThreadLocalRandom ;
2324import org .springframework .boot .web .client .RestTemplateBuilder ;
2425import org .springframework .http .HttpEntity ;
2526import org .springframework .http .HttpMethod ;
@@ -46,8 +47,7 @@ public static String pickAddress(List<String> addresses) {
4647 if (addresses .size () == 1 ) {
4748 return addresses .get (0 );
4849 }
49- Random random = new Random ();
50- int i = random .nextInt (addresses .size ());
50+ int i = ThreadLocalRandom .current ().nextInt (addresses .size ());
5151 if (i >= addresses .size ()) {
5252 i = 0 ;
5353 }
Original file line number Diff line number Diff line change 2626import cn .polarismesh .polaris .sync .registry .utils .ConfigUtils ;
2727import com .tencent .polaris .client .pb .ResponseProto .DiscoverResponse ;
2828import com .tencent .polaris .client .pb .ServiceProto .Instance ;
29+ import java .io .ByteArrayInputStream ;
2930import java .util .Collection ;
3031import java .util .HashMap ;
3132import java .util .List ;
@@ -86,6 +87,7 @@ public void run() {
8687 }
8788 }
8889 } catch (Throwable e ) {
90+ ByteArrayInputStream in = new ByteArrayInputStream ()
8991 e .printStackTrace ();
9092 LOG .error ("[Core] pull task(source {}) encounter exception {}" , source .getName (), e );
9193 }
You can’t perform that action at this time.
0 commit comments