From a63ae08f5d8e54855468c24d79a2d7e1c524244c Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 18 十二月 2020 09:25:41 +0800 Subject: [PATCH] Merge pull request #15 from lawrencehj/wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) 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 b0fb561..d6b75f8 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 @@ */ 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; } -- Gitblit v1.8.0