Commit 25102229f6ac19d9376309e7917f0da7cd2c8d56

Authored by 648540858
1 parent e6ee7fe7

接收所有notify请求,即使没有订阅

bootstrap.sh 0 → 100755
  1 +#!/bin/bash
  2 +
  3 +######################################################
  4 +# Copyright 2019 Pham Ngoc Hoai
  5 +#
  6 +# Licensed under the Apache License, Version 2.0 (the "License");
  7 +# you may not use this file except in compliance with the License.
  8 +# You may obtain a copy of the License at
  9 +#
  10 +# http://www.apache.org/licenses/LICENSE-2.0
  11 +#
  12 +# Unless required by applicable law or agreed to in writing, software
  13 +# distributed under the License is distributed on an "AS IS" BASIS,
  14 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +# See the License for the specific language governing permissions and
  16 +# limitations under the License.
  17 +#
  18 +# Repo: https://github.com/tyrion9/spring-boot-startup-script
  19 +#
  20 +######### PARAM ######################################
  21 +
  22 +JAVA_OPT=-Xmx1024m
  23 +JARFILE=`ls -1r *.jar 2>/dev/null | head -n 1`
  24 +PID_FILE=pid.file
  25 +RUNNING=N
  26 +PWD=`pwd`
  27 +
  28 +######### DO NOT MODIFY ########
  29 +
  30 +if [ -f $PID_FILE ]; then
  31 + PID=`cat $PID_FILE`
  32 + if [ ! -z "$PID" ] && kill -0 $PID 2>/dev/null; then
  33 + RUNNING=Y
  34 + fi
  35 +fi
  36 +
  37 +start()
  38 +{
  39 + if [ $RUNNING == "Y" ]; then
  40 + echo "Application already started"
  41 + else
  42 + if [ -z "$JARFILE" ]
  43 + then
  44 + echo "ERROR: jar file not found"
  45 + else
  46 + nohup java $JAVA_OPT -Djava.security.egd=file:/dev/./urandom -jar $PWD/$JARFILE > nohup.out 2>&1 &
  47 + echo $! > $PID_FILE
  48 + echo "Application $JARFILE starting..."
  49 + tail -f nohup.out
  50 + fi
  51 + fi
  52 +}
  53 +
  54 +stop()
  55 +{
  56 + if [ $RUNNING == "Y" ]; then
  57 + kill -9 $PID
  58 + rm -f $PID_FILE
  59 + echo "Application stopped"
  60 + else
  61 + echo "Application not running"
  62 + fi
  63 +}
  64 +
  65 +restart()
  66 +{
  67 + stop
  68 + start
  69 +}
  70 +
  71 +case "$1" in
  72 +
  73 + 'start')
  74 + start
  75 + ;;
  76 +
  77 + 'stop')
  78 + stop
  79 + ;;
  80 +
  81 + 'restart')
  82 + restart
  83 + ;;
  84 +
  85 + *)
  86 + echo "Usage: $0 { start | stop | restart }"
  87 + exit 1
  88 + ;;
  89 +esac
  90 +exit 0
  91 +
... ...
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
... ... @@ -76,7 +76,6 @@ public class DynamicTask {
76 76 */
77 77 public void startDelay(String key, Runnable task, int delay) {
78 78 stop(key);
79   - System.out.println("定时任务开始了");
80 79 Date starTime = new Date(System.currentTimeMillis() + delay);
81 80  
82 81 ScheduledFuture future = futureMap.get(key);
... ... @@ -100,7 +99,6 @@ public class DynamicTask {
100 99 }
101 100  
102 101 public void stop(String key) {
103   - System.out.println("定时任务结束了");
104 102 if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) {
105 103 futureMap.get(key).cancel(true);
106 104 Runnable runnable = runnableMap.get(key);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
... ... @@ -48,6 +48,7 @@ public class SipLayer{
48 48 properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP");
49 49 properties.setProperty("javax.sip.IP_ADDRESS", sipConfig.getMonitorIp());
50 50 properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true");
  51 + properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); // 接收所有notify请求,即使没有订阅
51 52 /**
52 53 * sip_server_log.log 和 sip_debug_log.log public static final int TRACE_NONE =
53 54 * 0; public static final int TRACE_MESSAGES = 16; public static final int
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java
... ... @@ -42,7 +42,6 @@ public class MobilePositionSubscribeHandlerTask implements ISubscribeTask {
42 42 @Override
43 43 public void run() {
44 44  
45   - logger.info("执行MobilePositionSubscribeHandlerTask");
46 45 if (platform == null) return;
47 46 SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId());
48 47 if (subscribe != null) {
... ... @@ -71,7 +70,6 @@ public class MobilePositionSubscribeHandlerTask implements ISubscribeTask {
71 70 }
72 71 }
73 72 }
74   - logger.info("结束执行MobilePositionSubscribeHandlerTask");
75 73 }
76 74  
77 75 @Override
... ...