Skip to content

Commit 96a8fde

Browse files
committed
Better handling of unknown state
1 parent 33c2c66 commit 96a8fde

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

operator/src/main/java/oracle/kubernetes/operator/ServerStatusReader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public NextAction apply(Packet packet) {
126126
TuningParameters.MainTuning main = TuningParameters.getInstance().getMainTuning();
127127
LastKnownStatus lastKnownStatus = info.getLastKnownServerStatus(serverName);
128128
if (lastKnownStatus != null
129+
&& !WebLogicConstants.UNKNOWN_STATE.equals(lastKnownStatus.getStatus())
129130
&& lastKnownStatus.getUnchangedCount() >= main.unchangedCountToDelayStatusRecheck) {
130131
if (DateTime.now()
131132
.isBefore(lastKnownStatus.getTime().plusSeconds((int) main.eventualLongDelay))) {
@@ -162,10 +163,13 @@ public NextAction apply(Packet packet) {
162163

163164
InputStream in = proc.getInputStream();
164165
if (proc.waitFor(timeoutSeconds, TimeUnit.SECONDS)) {
165-
if (proc.exitValue() == 0) {
166+
int exitValue = proc.exitValue();
167+
if (exitValue == 0) {
166168
try (final Reader reader = new InputStreamReader(in, Charsets.UTF_8)) {
167169
state = CharStreams.toString(reader);
168170
}
171+
} else if (exitValue == 1) {
172+
state = WebLogicConstants.SHUTDOWN_STATE;
169173
} else {
170174
state = WebLogicConstants.UNKNOWN_STATE;
171175
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ STATEFILE=/${DH}/servers/${SN}/data/nodemanager/${SN}.state
2222

2323
if [ `jps -v | grep -c " -Dweblogic.Name=${SERVER_NAME} "` -eq 0 ]; then
2424
trace "WebLogic server process not found"
25-
echo SHUTDOWN
26-
exit 0
25+
exit 1
2726
fi
2827

2928
if [ ! -f ${STATEFILE} ]; then
3029
trace "Error: WebLogic Server state file not found."
31-
exit 1
30+
exit 2
3231
fi
3332

3433
cat ${STATEFILE} | cut -f 1 -d ':'

0 commit comments

Comments
 (0)