Skip to content

Commit 8cf4e5a

Browse files
committed
Merge branch 'develop' into owls-73691
2 parents 824913b + faec58f commit 8cf4e5a

File tree

23 files changed

+423
-163
lines changed

23 files changed

+423
-163
lines changed

docs/domains/Domain.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
"type": "object",
408408
"properties": {
409409
"overallHealth": {
410-
"description": "Server health of this WebLogic server.",
410+
"description": "Server health of this WebLogic server. If the value is \"Not available\", the operator has failed to read the health. If the value is \"Not available (possibly overloaded)\", the operator has failed to read the health of the server possibly due to the server is in overloaded state",
411411
"type": "string"
412412
},
413413
"activationTime": {

docs/domains/Domain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Shutdown describes the configuration for shutting down a server instance.
173173
| Name | Type | Description |
174174
| --- | --- | --- |
175175
| `activationTime` | DateTime | RFC 3339 date and time at which the server started. |
176-
| `overallHealth` | string | Server health of this WebLogic server. |
176+
| `overallHealth` | string | Server health of this WebLogic server. If the value is "Not available", the operator has failed to read the health. If the value is "Not available (possibly overloaded)", the operator has failed to read the health of the server possibly due to the server is in overloaded state |
177177
| `subsystems` | array of [Subsystem Health](#subsystem-health) | Status of unhealthy subsystems, if any. |
178178

179179
### Channel

docs/domains/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@
13271327
"type": "object",
13281328
"properties": {
13291329
"overallHealth": {
1330-
"description": "Server health of this WebLogic server.",
1330+
"description": "Server health of this WebLogic server. If the value is \"Not available\", the operator has failed to read the health. If the value is \"Not available (possibly overloaded)\", the operator has failed to read the health of the server possibly due to the server is in overloaded state",
13311331
"type": "string"
13321332
},
13331333
"activationTime": {

model/src/main/java/oracle/kubernetes/weblogic/domain/model/ServerHealth.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public class ServerHealth {
2323
@Expose
2424
private DateTime activationTime;
2525

26-
@Description("Server health of this WebLogic server.")
26+
@Description(
27+
"Server health of this WebLogic server. If the value is \"Not available\", the operator has "
28+
+ "failed to read the health. If the value is \"Not available (possibly overloaded)\", the "
29+
+ "operator has failed to read the health of the server possibly due to the server is "
30+
+ "in overloaded state")
2731
@SerializedName("overallHealth")
2832
@Expose
2933
private String overallHealth;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.concurrent.ConcurrentMap;
2222
import java.util.concurrent.ScheduledFuture;
2323
import java.util.concurrent.TimeUnit;
24+
import java.util.concurrent.atomic.AtomicInteger;
2425
import javax.annotation.Nullable;
2526
import oracle.kubernetes.operator.TuningParameters.MainTuning;
2627
import oracle.kubernetes.operator.calls.CallResponse;
@@ -314,7 +315,9 @@ public void run() {
314315
new CompletionCallback() {
315316
@Override
316317
public void onCompletion(Packet packet) {
317-
if (Boolean.TRUE.equals(packet.get(ProcessingConstants.SERVER_HEALTH_READ))) {
318+
AtomicInteger serverHealthRead =
319+
packet.getValue(ProcessingConstants.REMAINING_SERVERS_HEALTH_TO_READ);
320+
if (serverHealthRead == null || serverHealthRead.get() == 0) {
318321
loggingFilter.setFiltering(false).resetLogHistory();
319322
} else {
320323
loggingFilter.setFiltering(true);

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import io.kubernetes.client.models.V1ObjectMeta;
99
import io.kubernetes.client.models.V1Pod;
1010
import io.kubernetes.client.util.Watch;
11+
import java.util.ArrayList;
12+
import java.util.Collection;
13+
import java.util.HashMap;
1114
import java.util.List;
1215
import java.util.Map;
13-
import java.util.concurrent.ConcurrentHashMap;
14-
import java.util.concurrent.ConcurrentMap;
1516
import java.util.concurrent.ThreadFactory;
1617
import java.util.concurrent.atomic.AtomicBoolean;
1718
import oracle.kubernetes.operator.TuningParameters.WatchTuning;
@@ -39,8 +40,24 @@ public class PodWatcher extends Watcher<V1Pod>
3940
private final WatchListener<V1Pod> listener;
4041

4142
// Map of Pod name to OnReady
42-
private final ConcurrentMap<String, OnReady> readyCallbackRegistrations =
43-
new ConcurrentHashMap<>();
43+
private final Map<String, Collection<OnReady>> readyCallbackRegistrations = new HashMap<>();
44+
45+
private void registerOnReady(String podName, OnReady onReady) {
46+
synchronized (readyCallbackRegistrations) {
47+
Collection<OnReady> col = readyCallbackRegistrations.get(podName);
48+
if (col == null) {
49+
col = new ArrayList<>();
50+
readyCallbackRegistrations.put(podName, col);
51+
}
52+
col.add(onReady);
53+
}
54+
}
55+
56+
private Collection<OnReady> retrieveOnReady(String podName) {
57+
synchronized (readyCallbackRegistrations) {
58+
return readyCallbackRegistrations.remove(podName);
59+
}
60+
}
4461

4562
/**
4663
* Factory for PodWatcher.
@@ -96,9 +113,11 @@ public void receivedResponse(Watch.Response<V1Pod> item) {
96113
Boolean isReady = !PodHelper.isDeleting(pod) && PodHelper.isReady(pod);
97114
String podName = pod.getMetadata().getName();
98115
if (isReady) {
99-
OnReady ready = readyCallbackRegistrations.remove(podName);
100-
if (ready != null) {
101-
ready.onReady();
116+
Collection<OnReady> col = retrieveOnReady(podName);
117+
if (col != null) {
118+
for (OnReady ready : col) {
119+
ready.onReady();
120+
}
102121
}
103122
}
104123
break;
@@ -148,7 +167,7 @@ public NextAction apply(Packet packet) {
148167
fiber.resume(packet);
149168
}
150169
};
151-
readyCallbackRegistrations.put(metadata.getName(), ready);
170+
registerOnReady(metadata.getName(), ready);
152171

153172
// Timing window -- pod may have come ready before registration for callback
154173
CallBuilderFactory factory =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ public interface ProcessingConstants {
3232
public static final String DOMAIN_INTROSPECTOR_LOG_RESULT = "domainIntrospectorLogResult";
3333
public static final String SIT_CONFIG_MAP = "sitConfigMap";
3434

35-
public static final String SERVER_HEALTH_READ = "serverHealthRead";
35+
public static final String REMAINING_SERVERS_HEALTH_TO_READ = "serverHealthRead";
3636
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.concurrent.ConcurrentHashMap;
2222
import java.util.concurrent.ConcurrentMap;
2323
import java.util.concurrent.TimeUnit;
24+
import java.util.concurrent.atomic.AtomicInteger;
2425
import java.util.function.Function;
2526
import java.util.stream.Collectors;
2627
import oracle.kubernetes.operator.helpers.ClientPool;
@@ -68,6 +69,9 @@ public NextAction apply(Packet packet) {
6869
packet.put(SERVER_STATE_MAP, new ConcurrentHashMap<String, String>());
6970
packet.put(SERVER_HEALTH_MAP, new ConcurrentHashMap<String, ServerHealth>());
7071

72+
AtomicInteger remainingServerHealthToRead = new AtomicInteger();
73+
packet.put(ProcessingConstants.REMAINING_SERVERS_HEALTH_TO_READ, remainingServerHealthToRead);
74+
7175
Collection<StepAndPacket> startDetails =
7276
info.getServerPods()
7377
.map(pod -> createStatusReaderStep(packet, pod))
@@ -76,6 +80,7 @@ public NextAction apply(Packet packet) {
7680
if (startDetails.isEmpty()) {
7781
return doNext(packet);
7882
} else {
83+
remainingServerHealthToRead.set(startDetails.size());
7984
return doForkJoin(getNext(), packet, startDetails);
8085
}
8186
}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private void watchForEvents() {
143143
new WatchBuilder()
144144
.withResourceVersion(resourceVersion.toString())
145145
.withTimeoutSeconds(tuning.watchLifetime))) {
146-
while (watch.hasNext()) {
146+
while (hasNext(watch)) {
147147
Watch.Response<T> item = watch.next();
148148

149149
if (isStopping()) {
@@ -164,6 +164,15 @@ private void watchForEvents() {
164164
}
165165
}
166166

167+
private boolean hasNext(WatchI<T> watch) {
168+
try {
169+
return watch.hasNext();
170+
} catch (Throwable ex) {
171+
// no-op on exception during hasNext
172+
}
173+
return false;
174+
}
175+
167176
/**
168177
* Initiates a watch by using the watch builder to request any updates for the specified watcher.
169178
*

operator/src/main/java/oracle/kubernetes/operator/calls/AsyncRequestStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void onSuccess(
190190
try {
191191
cc.cancel();
192192
} finally {
193-
LOGGER.info(
193+
LOGGER.fine(
194194
MessageKeys.ASYNC_TIMEOUT,
195195
requestParams.call,
196196
requestParams.namespace,

0 commit comments

Comments
 (0)