Browse Source

重复10次20

TitanWong 1 year ago
parent
commit
c0dbc49429

+ 5 - 1
src/main/java/com/zhili/stationcontrol/tts/service/impl/MusicServiceImpl.java

@@ -67,6 +67,7 @@ public class MusicServiceImpl implements MusicService, Runnable {
                     log.info("startCmd:{},endCmd:{},repeat:{},cmd:{}", startCmd, endCmd, repeat, cmd);
                     log.info("p:{},p.isAlive:{}", p, p == null ? null : p.isAlive());
                     if (startCmd) {
+                        log.info("start");
                         startCmd = false;
                         if (p != null) {
                             p.destroyForcibly();
@@ -76,6 +77,7 @@ public class MusicServiceImpl implements MusicService, Runnable {
                         p = Runtime.getRuntime().exec(cmd);
                     }
                     if (endCmd) {
+                        log.info("end");
                         endCmd = false;
                         if (p != null) {
                             p.destroyForcibly();
@@ -87,12 +89,14 @@ public class MusicServiceImpl implements MusicService, Runnable {
                         if (p != null) {
                             boolean exit = p.waitFor(500, TimeUnit.MILLISECONDS);
                             if (exit) {
-                                log.info("repeat");
+                                log.info("p exit repeat");
                                 p = Runtime.getRuntime().exec(cmd);
                             } else {
+                                log.info("p not exit");
                                 break;
                             }
                         } else {
+                            log.info("p is not null");
                             p = Runtime.getRuntime().exec(cmd);
                         }
                     }