Commit 222d44bd8552e9ccd5158f601bc8c2b6728ba860
1 parent
0352ad2d
去除无效注解
修复获取sn错误的bug
Showing
2 changed files
with
4 additions
and
7 deletions
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
| @@ -7,11 +7,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | @@ -7,11 +7,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
| 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 8 | 8 | ||
| 9 | @SpringBootApplication | 9 | @SpringBootApplication |
| 10 | -//@EnableEurekaClient | ||
| 11 | -//@EnableTransactionManagement | ||
| 12 | -//@EnableFeignClients(basePackages = { "com.genersoft.iot.vmp", "org.integrain" }) | ||
| 13 | -//@ServletComponentScan("com.genersoft.iot.vmp") | ||
| 14 | -@EnableAutoConfiguration | ||
| 15 | public class VManageBootstrap extends LogManager { | 10 | public class VManageBootstrap extends LogManager { |
| 16 | public static void main(String[] args) { | 11 | public static void main(String[] args) { |
| 17 | SpringApplication.run(VManageBootstrap.class, args); | 12 | SpringApplication.run(VManageBootstrap.class, args); |
src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcUtil.java
| @@ -70,14 +70,16 @@ public class SsrcUtil { | @@ -70,14 +70,16 @@ public class SsrcUtil { | ||
| 70 | */ | 70 | */ |
| 71 | private static String getSN() { | 71 | private static String getSN() { |
| 72 | String sn = null; | 72 | String sn = null; |
| 73 | + int index = 0; | ||
| 73 | if (notUsed.size() == 0) { | 74 | if (notUsed.size() == 0) { |
| 74 | throw new RuntimeException("ssrc已经用完"); | 75 | throw new RuntimeException("ssrc已经用完"); |
| 75 | } else if (notUsed.size() == 1) { | 76 | } else if (notUsed.size() == 1) { |
| 76 | sn = notUsed.get(0); | 77 | sn = notUsed.get(0); |
| 77 | } else { | 78 | } else { |
| 78 | - sn = notUsed.get(new Random().nextInt(notUsed.size() - 1)); | 79 | + index = new Random().nextInt(notUsed.size() - 1); |
| 80 | + sn = notUsed.get(index); | ||
| 79 | } | 81 | } |
| 80 | - notUsed.remove(0); | 82 | + notUsed.remove(index); |
| 81 | isUsed.add(sn); | 83 | isUsed.add(sn); |
| 82 | return sn; | 84 | return sn; |
| 83 | } | 85 | } |