From 222d44bd8552e9ccd5158f601bc8c2b6728ba860 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 13 Nov 2020 09:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=97=A0=E6=95=88=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96sn=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java | 5 ----- .../com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java index 664b0d21..a102fe56 100644 --- a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java +++ b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java @@ -7,11 +7,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -//@EnableEurekaClient -//@EnableTransactionManagement -//@EnableFeignClients(basePackages = { "com.genersoft.iot.vmp", "org.integrain" }) -//@ServletComponentScan("com.genersoft.iot.vmp") -@EnableAutoConfiguration public class VManageBootstrap extends LogManager { public static void main(String[] args) { SpringApplication.run(VManageBootstrap.class, args); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java index b0fb5616..d6b75f85 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java @@ -70,14 +70,16 @@ public class SsrcUtil { */ private static String getSN() { String sn = null; + int index = 0; if (notUsed.size() == 0) { throw new RuntimeException("ssrc已经用完"); } else if (notUsed.size() == 1) { sn = notUsed.get(0); } else { - sn = notUsed.get(new Random().nextInt(notUsed.size() - 1)); + index = new Random().nextInt(notUsed.size() - 1); + sn = notUsed.get(index); } - notUsed.remove(0); + notUsed.remove(index); isUsed.add(sn); return sn; }