apache-ignite

Форк
0
/
control.bat 
228 строк · 6.9 Кб
1
::
2
:: Licensed to the Apache Software Foundation (ASF) under one or more
3
:: contributor license agreements.  See the NOTICE file distributed with
4
:: this work for additional information regarding copyright ownership.
5
:: The ASF licenses this file to You under the Apache License, Version 2.0
6
:: (the "License"); you may not use this file except in compliance with
7
:: the License.  You may obtain a copy of the License at
8
::
9
::      http://www.apache.org/licenses/LICENSE-2.0
10
::
11
:: Unless required by applicable law or agreed to in writing, software
12
:: distributed under the License is distributed on an "AS IS" BASIS,
13
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
:: See the License for the specific language governing permissions and
15
:: limitations under the License.
16
::
17

18
::
19
:: Grid command line loader.
20
::
21

22
@echo off
23
Setlocal EnableDelayedExpansion
24

25
if "%OS%" == "Windows_NT"  setlocal
26

27
:: Check JAVA_HOME.
28
if defined JAVA_HOME  goto checkJdk
29
    echo %0, ERROR:
30
    echo JAVA_HOME environment variable is not found.
31
    echo Please point JAVA_HOME variable to location of JDK 1.8 or later.
32
    echo You can also download latest JDK at http://java.com/download.
33
goto error_finish
34

35
:checkJdk
36
:: Check that JDK is where it should be.
37
if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
38
    echo %0, ERROR:
39
    echo JAVA is not found in JAVA_HOME=%JAVA_HOME%.
40
    echo Please point JAVA_HOME variable to installation of JDK 1.8 or later.
41
    echo You can also download latest JDK at http://java.com/download.
42
goto error_finish
43

44
:checkJdkVersion
45
set cmd="%JAVA_HOME%\bin\java.exe"
46
for /f "tokens=* USEBACKQ" %%f in (`%cmd% -version 2^>^&1`) do (
47
    set var=%%f
48
    goto :LoopEscape
49
)
50
:LoopEscape
51

52
for /f "tokens=1-3  delims= " %%a in ("%var%") do set JAVA_VER_STR=%%c
53
set JAVA_VER_STR=%JAVA_VER_STR:"=%
54

55
for /f "tokens=1,2 delims=." %%a in ("%JAVA_VER_STR%.x") do set MAJOR_JAVA_VER=%%a& set MINOR_JAVA_VER=%%b
56
if %MAJOR_JAVA_VER% == 1 set MAJOR_JAVA_VER=%MINOR_JAVA_VER%
57

58
if %MAJOR_JAVA_VER% LSS 8 (
59
    echo %0, ERROR:
60
    echo The version of JAVA installed in %JAVA_HOME% is incorrect.
61
    echo Please point JAVA_HOME variable to installation of JDK 1.8 or later.
62
    echo You can also download latest JDK at http://java.com/download.
63
    goto error_finish
64
)
65

66
:: Check IGNITE_HOME.
67
:checkIgniteHome1
68
if defined IGNITE_HOME goto checkIgniteHome2
69
    pushd "%~dp0"/..
70
    set IGNITE_HOME=%CD%
71
    popd
72

73
:checkIgniteHome2
74
:: Strip double quotes from IGNITE_HOME
75
set IGNITE_HOME=%IGNITE_HOME:"=%
76

77
:: remove all trailing slashes from IGNITE_HOME.
78
if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
79
if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
80
goto checkIgniteHome3
81

82
:removeTrailingSlash
83
set IGNITE_HOME=%IGNITE_HOME:~0,-1%
84
goto checkIgniteHome2
85

86
:checkIgniteHome3
87
if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
88
    echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
89
    echo Please create IGNITE_HOME environment variable pointing to location of
90
    echo Ignite installation folder.
91
    goto error_finish
92

93
:checkIgniteHome4
94

95
::
96
:: Set SCRIPTS_HOME - base path to scripts.
97
::
98
set SCRIPTS_HOME=%IGNITE_HOME%\bin
99

100
:: Remove trailing spaces
101
for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
102

103
if /i "%SCRIPTS_HOME%\" == "%~dp0" goto setProgName
104
    echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
105

106
:setProgName
107
::
108
:: Set program name.
109
::
110
set PROG_NAME=ignite.bat
111
if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
112

113
:run
114

115
::
116
:: Set IGNITE_LIBS
117
::
118
call "%SCRIPTS_HOME%\include\setenv.bat"
119
call "%SCRIPTS_HOME%\include\build-classpath.bat"
120
set CP=%IGNITE_LIBS%;%IGNITE_HOME%\libs\optional\ignite-zookeeper\*
121

122
::
123
:: Process 'restart'.
124
::
125
set RANDOM_NUMBER_COMMAND="!JAVA_HOME!\bin\java.exe" -cp %CP% org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator
126
for /f "usebackq tokens=*" %%i in (`!RANDOM_NUMBER_COMMAND!`) do set RANDOM_NUMBER=%%i
127

128
set RESTART_SUCCESS_FILE="%IGNITE_HOME%\work\ignite_success_%RANDOM_NUMBER%"
129
set RESTART_SUCCESS_OPT=-DIGNITE_SUCCESS_FILE=%RESTART_SUCCESS_FILE%
130

131
::
132
:: JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
133
::
134
:: ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
135
::
136
"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[7]\." > nul
137
if %ERRORLEVEL% equ 0 (
138
    if "%CONTROL_JVM_OPTS%" == "" set CONTROL_JVM_OPTS=-Xms256m -Xmx1g
139
) else (
140
    if "%CONTROL_JVM_OPTS%" == "" set CONTROL_JVM_OPTS=-Xms256m -Xmx1g
141
)
142

143
::
144
:: Uncomment to enable experimental commands [--wal]
145
::
146
:: set CONTROL_JVM_OPTS=%CONTROL_JVM_OPTS% -DIGNITE_ENABLE_EXPERIMENTAL_COMMAND=true
147

148
::
149
:: Uncomment the following GC settings if you see spikes in your throughput due to Garbage Collection.
150
::
151
:: set CONTROL_JVM_OPTS=%CONTROL_JVM_OPTS% -XX:+UseG1GC
152

153
::
154
:: Uncomment if you get StackOverflowError.
155
:: On 64 bit systems this value can be larger, e.g. -Xss16m
156
::
157
:: set CONTROL_JVM_OPTS=%CONTROL_JVM_OPTS% -Xss4m
158

159
::
160
:: Uncomment to set preference to IPv4 stack.
161
::
162
:: set CONTROL_JVM_OPTS=%CONTROL_JVM_OPTS% -Djava.net.preferIPv4Stack=true
163

164
::
165
:: Assertions are disabled by default since version 3.5.
166
:: If you want to enable them - set 'ENABLE_ASSERTIONS' flag to '1'.
167
::
168
set ENABLE_ASSERTIONS=1
169

170
::
171
:: Set '-ea' options if assertions are enabled.
172
::
173
if %ENABLE_ASSERTIONS% == 1 set CONTROL_JVM_OPTS=%CONTROL_JVM_OPTS% -ea
174

175
:run_java
176

177
::
178
:: Set main class to start service (grid node by default).
179
::
180

181
if "%MAIN_CLASS%" == "" set MAIN_CLASS=org.apache.ignite.internal.commandline.CommandHandler
182

183
::
184
:: Remote debugging (JPDA).
185
:: Uncomment and change if remote debugging is required.
186
:: set CONTROL_JVM_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 %CONTROL_JVM_OPTS%
187
::
188

189
::
190
:: Final CONTROL_JVM_OPTS for Java 9+ compatibility
191
::
192
call "%SCRIPTS_HOME%\include\jvmdefaults.bat" %MAJOR_JAVA_VER% "%CONTROL_JVM_OPTS%" CONTROL_JVM_OPTS
193

194
if defined JVM_OPTS (
195
    echo JVM_OPTS environment variable is set, but will not be used. To pass JVM options use CONTROL_JVM_OPTS
196
    echo JVM_OPTS=%JVM_OPTS%
197
)
198

199
if "%INTERACTIVE%" == "1" (
200
    "%JAVA_HOME%\bin\java.exe" %CONTROL_JVM_OPTS% %QUIET% %RESTART_SUCCESS_OPT% ^
201
    -DIGNITE_UPDATE_NOTIFIER=false -DIGNITE_HOME="%IGNITE_HOME%" -DIGNITE_PROG_NAME="%PROG_NAME%" %JVM_XOPTS% ^
202
    -cp "%CP%" %MAIN_CLASS% %*
203
) else (
204
    "%JAVA_HOME%\bin\java.exe" %CONTROL_JVM_OPTS% %QUIET% %RESTART_SUCCESS_OPT% ^
205
    -DIGNITE_UPDATE_NOTIFIER=false -DIGNITE_HOME="%IGNITE_HOME%" -DIGNITE_PROG_NAME="%PROG_NAME%" %JVM_XOPTS% ^
206
    -cp "%CP%" %MAIN_CLASS% %*
207
)
208

209
set JAVA_ERRORLEVEL=%ERRORLEVEL%
210

211
:: errorlevel 130 if aborted with Ctrl+c
212
if %JAVA_ERRORLEVEL%==130 goto finish
213

214
:: Exit if first run unsuccessful (Loader must create file).
215
if not exist %RESTART_SUCCESS_FILE% goto error_finish
216
del %RESTART_SUCCESS_FILE%
217

218
goto run_java
219

220
:finish
221
if not exist %RESTART_SUCCESS_FILE% goto error_finish
222
del %RESTART_SUCCESS_FILE%
223

224
:error_finish
225

226
if not "%NO_PAUSE%" == "1" pause
227

228
goto :eof
229

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.