Skip to content

Commit 6266293

Browse files
authored
Merge pull request #574 from oracle/develop-feature-mock-wls-shutdown-performance
Speed up mock server pod shutdown
2 parents bc51e08 + 5ea682a commit 6266293

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

operator/src/main/resources/scripts/startServer.sh

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,32 @@ function mockWLS() {
9494
echo "RUNNING:Y:N" > $STATEFILE
9595
}
9696

97+
function waitUntilShutdown() {
98+
#
99+
# Wait forever. Kubernetes will monitor this pod via liveness and readyness probes.
100+
#
101+
if [ "${SERVER_OUT_IN_POD_LOG}" == 'true' ] ; then
102+
trace "Showing the server out file from ${SERVER_OUT_FILE}"
103+
tail -F -n +0 ${SERVER_OUT_FILE} || exitOrLoop
104+
else
105+
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
106+
while true; do sleep 60; done
107+
fi
108+
}
109+
110+
function mockWaitUntilShutdown() {
111+
#
112+
# Wait forever. Kubernetes will monitor this pod via liveness and readyness probes.
113+
#
114+
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
115+
while true; do
116+
if [ -e /u01/doShutdown ] ; then
117+
exit 0
118+
fi
119+
sleep 5
120+
done
121+
}
122+
97123
# Define helper fn to copy sit cfg xml files from one dir to another
98124
# $src_dir files are assumed to start with $fil_prefix and end with .xml
99125
# Copied $tgt_dir files are stripped of their $fil_prefix
@@ -180,19 +206,8 @@ copySitCfg /weblogic-operator/introspector ${DOMAIN_HOME}/optconfig/wldf 'Sit-C
180206

181207
if [ "${MOCK_WLS}" == 'true' ]; then
182208
mockWLS
209+
mockWaitUntilShutdown
183210
else
184211
startWLS
212+
waitUntilShutdown
185213
fi
186-
187-
#
188-
# Wait forever. Kubernetes will monitor this pod via liveness and readyness probes.
189-
#
190-
191-
if [ "${MOCK_WLS}" != 'true' ] && [ "${SERVER_OUT_IN_POD_LOG}" == 'true' ] ; then
192-
trace "Showing the server out file from ${SERVER_OUT_FILE}"
193-
tail -F -n +0 ${SERVER_OUT_FILE} || exitOrLoop
194-
else
195-
trace "Wait indefinitely so that the Kubernetes pod does not exit and try to restart"
196-
while true; do sleep 60; done
197-
fi
198-

operator/src/main/resources/scripts/stopServer.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ trace "Stop server ${SERVER_NAME}"
1818
checkEnv SERVER_NAME || exit 1
1919

2020
if [ "${MOCK_WLS}" == 'true' ]; then
21+
touch /u01/doShutdown
2122
exit 0
2223
fi
2324

0 commit comments

Comments
 (0)