Initial code import
[msb/apigateway.git] / apiroute / apiroute-standalone / src / assembly / resource / apiroute / run.bat
1 @REM
2 @REM Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
3 @REM
4 @REM Licensed under the Apache License, Version 2.0 (the "License");
5 @REM you may not use this file except in compliance with the License.
6 @REM You may obtain a copy of the License at
7 @REM
8 @REM         http://www.apache.org/licenses/LICENSE-2.0
9 @REM
10 @REM Unless required by applicable law or agreed to in writing, software
11 @REM distributed under the License is distributed on an "AS IS" BASIS,
12 @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 @REM See the License for the specific language governing permissions and
14 @REM limitations under the License.
15 @REM
16 @echo off
17 title apiroute-service
18
19 set RUNHOME=%~dp0
20 echo ### RUNHOME: %RUNHOME%
21
22 echo ### Starting apiroute-service
23 rem cd /d %RUNHOME%
24
25 rem set JAVA_HOME=D:\JDK1.7\jdk\jdk\windows
26 set JAVA="%JAVA_HOME%\bin\java.exe"
27 set port=8777
28
29 setlocal enabledelayedexpansion
30 set index=1
31 FOR /F "tokens=3 delims= " %%a in ('"%JAVA% -version 2>&1"')do (
32   if !index! equ 1 set JAVA_VERSION=%%a
33   set /a index=index+1
34 )
35 set JAVA_VERSION=%JAVA_VERSION:~1,3%
36 if "%JAVA_VERSION%"=="1.8" (
37    set jvm_opts=-Xms16m -Xmx128m -XX:+UseSerialGC -XX:MaxMetaspaceSize=64m  -XX:NewRatio=2 
38 ) else (
39    set jvm_opts=-Xms16m -Xmx128m -XX:+UseSerialGC  -XX:MaxPermSize=64m -XX:NewRatio=2
40 )
41
42 set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n
43 set class_path=%RUNHOME%;%RUNHOME%apiroute-service.jar
44 echo ### jvm_opts: %jvm_opts%
45 echo ### class_path: %class_path%
46
47 %JAVA% -classpath %class_path% %jvm_opts% org.openo.msb.ApiRouteApp  server %RUNHOME%conf/apiroute.yml
48
49 IF ERRORLEVEL 1 goto showerror
50 exit
51 :showerror
52 echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check!
53 echo After checking, press any key to close 
54 pause
55 exit