Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main/java/oracle/kubernetes/operator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ public NextAction apply(Packet packet) {
WlsClusterConfig wlsClusterConfig = scan.getClusterConfig(clusterName);
if (wlsClusterConfig != null) {
for (WlsServerConfig wlsServerConfig : wlsClusterConfig.getServerConfigs()) {
// done with the current cluster
if (startedCount >= cs.getReplicas() && !startAll)
continue cluster;

String serverName = wlsServerConfig.getName();
if (!serverName.equals(asName) && !servers.contains(serverName)) {
// done with the current cluster
if (startedCount >= cs.getReplicas() && !startAll)
continue cluster;

List<V1EnvVar> env = cs.getEnv();
ServerStartup ssi = null;
ssl = spec.getServerStartup();
Expand Down Expand Up @@ -871,15 +871,15 @@ else if (StartupControlConstants.AUTO_STARTUPCONTROL.equals(sc)) {
int startedCount = 0;
WlsClusterConfig config = wlsClusterConfig.getValue();
for (WlsServerConfig wlsServerConfig : config.getServerConfigs()) {
if (startedCount >= spec.getReplicas())
break;
String serverName = wlsServerConfig.getName();
if (!serverName.equals(asName) && !servers.contains(serverName)) {
// start server
servers.add(serverName);
ssic.add(new ServerStartupInfo(wlsServerConfig, config, null, null));
startedCount++;
}
// outside the serverName check because these servers are already running
if (++startedCount >= spec.getReplicas())
break;
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/oracle/kubernetes/operator/work/FiberGate.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ public void onThrowable(Packet packet, Throwable throwable) {

private static class WaitForOldFiberStep extends Step {
private final AtomicReference<Fiber> old;
private WaitForOldFiberStep current;
private final AtomicReference<WaitForOldFiberStep> current;

public WaitForOldFiberStep(Fiber old, Step next) {
super(next);
this.old = new AtomicReference<>(old);
current = this;
current = new AtomicReference<>(this);
}

@Override
public NextAction apply(Packet packet) {
Fiber o = current != null ? current.old.getAndSet(null) : null;
WaitForOldFiberStep c = current.get();
Fiber o = c != null ? c.old.getAndSet(null) : null;
if (o == null) {
return doNext(packet);
}
Expand All @@ -74,13 +75,13 @@ public NextAction apply(Packet packet) {
boolean isWillCall = o.cancelAndExitCallback(true, new ExitCallback() {
@Override
public void onExit() {
current = o.getSPI(WaitForOldFiberStep.class);
current.set(o.getSPI(WaitForOldFiberStep.class));
fiber.resume(packet);
}
});

if (!isWillCall) {
current = o.getSPI(WaitForOldFiberStep.class);
current.set(o.getSPI(WaitForOldFiberStep.class));
fiber.resume(packet);
}
});
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/oracle/kubernetes/operator/work/Packet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@

import java.util.AbstractMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
* Context of a single processing flow. Acts as a map and as a registry of components.
*
*/
public class Packet extends AbstractMap<String, Object> implements ComponentRegistry, ComponentEx {
private final Map<String, Component> components = new HashMap<String, Component>();
private final Map<String, Object> delegate = new HashMap<String, Object>();
private final ConcurrentMap<String, Component> components = new ConcurrentHashMap<String, Component>();
private final ConcurrentMap<String, Object> delegate = new ConcurrentHashMap<String, Object>();

public Packet() {}

Expand All @@ -33,9 +34,6 @@ public Packet clone() {
}

public <S> S getSPI(Class<S> spiType) {
if (components == null) {
return null;
}
for (Component c : components.values()) {
S s = c.getSPI(spiType);
if (s != null) {
Expand Down Expand Up @@ -66,6 +64,6 @@ public Set<Entry<String, Object>> entrySet() {

@Override
public Object put(String key, Object value) {
return delegate.put(key, value);
return value != null ? delegate.put(key, value) : delegate.remove(key);
}
}