Skip to content

Commit fffb0a0

Browse files
committed
undo Google-Java formatting
1 parent 71d227f commit fffb0a0

File tree

4 files changed

+158
-153
lines changed

4 files changed

+158
-153
lines changed

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

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44

55
package oracle.kubernetes.operator;
66

7-
import static oracle.kubernetes.operator.helpers.LegalNames.toJobIntrospectorName;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
import java.util.Map;
10+
import java.util.Optional;
11+
import java.util.concurrent.ConcurrentHashMap;
12+
import java.util.concurrent.ConcurrentMap;
13+
import java.util.concurrent.ScheduledFuture;
14+
import java.util.concurrent.TimeUnit;
15+
import java.util.concurrent.atomic.AtomicInteger;
16+
import javax.annotation.Nullable;
817

918
import io.kubernetes.client.models.V1ConfigMap;
1019
import io.kubernetes.client.models.V1ContainerState;
@@ -17,16 +26,6 @@
1726
import io.kubernetes.client.models.V1Service;
1827
import io.kubernetes.client.models.V1ServiceList;
1928
import io.kubernetes.client.util.Watch;
20-
import java.util.ArrayList;
21-
import java.util.List;
22-
import java.util.Map;
23-
import java.util.Optional;
24-
import java.util.concurrent.ConcurrentHashMap;
25-
import java.util.concurrent.ConcurrentMap;
26-
import java.util.concurrent.ScheduledFuture;
27-
import java.util.concurrent.TimeUnit;
28-
import java.util.concurrent.atomic.AtomicInteger;
29-
import javax.annotation.Nullable;
3029
import oracle.kubernetes.operator.TuningParameters.MainTuning;
3130
import oracle.kubernetes.operator.calls.CallResponse;
3231
import oracle.kubernetes.operator.helpers.CallBuilder;
@@ -61,6 +60,8 @@
6160
import oracle.kubernetes.weblogic.domain.model.Domain;
6261
import oracle.kubernetes.weblogic.domain.model.DomainSpec;
6362

63+
import static oracle.kubernetes.operator.helpers.LegalNames.toJobIntrospectorName;
64+
6465
public class DomainProcessorImpl implements DomainProcessor {
6566

6667
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
@@ -69,9 +70,9 @@ public class DomainProcessorImpl implements DomainProcessor {
6970
private static final Map<String, FiberGate> statusFiberGates = new ConcurrentHashMap<>();
7071
// Map from namespace to map of domainUID to Domain
7172
private static final Map<String, Map<String, DomainPresenceInfo>> DOMAINS =
72-
new ConcurrentHashMap<>();
73+
new ConcurrentHashMap<>();
7374
private static final ConcurrentMap<String, ConcurrentMap<String, ScheduledFuture<?>>>
74-
statusUpdaters = new ConcurrentHashMap<>();
75+
statusUpdaters = new ConcurrentHashMap<>();
7576
private DomainProcessorDelegate delegate;
7677

7778
public DomainProcessorImpl(DomainProcessorDelegate delegate) {
@@ -84,8 +85,8 @@ private static DomainPresenceInfo getExistingDomainPresenceInfo(String ns, Strin
8485

8586
private static void registerDomainPresenceInfo(DomainPresenceInfo info) {
8687
DOMAINS
87-
.computeIfAbsent(info.getNamespace(), k -> new ConcurrentHashMap<>())
88-
.put(info.getDomainUid(), info);
88+
.computeIfAbsent(info.getNamespace(), k -> new ConcurrentHashMap<>())
89+
.put(info.getDomainUid(), info);
8990
}
9091

9192
private static void unregisterPresenceInfo(String ns, String domainUid) {
@@ -96,9 +97,9 @@ private static void unregisterPresenceInfo(String ns, String domainUid) {
9697
}
9798

9899
private static void registerStatusUpdater(
99-
String ns, String domainUid, ScheduledFuture<?> future) {
100+
String ns, String domainUid, ScheduledFuture<?> future) {
100101
ScheduledFuture<?> existing =
101-
statusUpdaters.computeIfAbsent(ns, k -> new ConcurrentHashMap<>()).put(domainUid, future);
102+
statusUpdaters.computeIfAbsent(ns, k -> new ConcurrentHashMap<>()).put(domainUid, future);
102103
if (existing != null) {
103104
existing.cancel(false);
104105
}
@@ -125,29 +126,29 @@ private static void onEvent(V1Event event) {
125126
if (status == null) return;
126127

127128
Optional.ofNullable(DOMAINS.get(event.getMetadata().getNamespace()))
128-
.map(m -> m.get(domainUid))
129-
.ifPresent(info -> info.updateLastKnownServerStatus(serverName, status));
129+
.map(m -> m.get(domainUid))
130+
.ifPresent(info -> info.updateLastKnownServerStatus(serverName, status));
130131
}
131132

132133
private static String getReadinessStatus(V1Event event) {
133134
return Optional.ofNullable(event.getMessage())
134-
.filter(m -> m.contains(WebLogicConstants.READINESS_PROBE_NOT_READY_STATE))
135-
.map(m -> m.substring(m.lastIndexOf(':') + 1).trim())
136-
.orElse(null);
135+
.filter(m -> m.contains(WebLogicConstants.READINESS_PROBE_NOT_READY_STATE))
136+
.map(m -> m.substring(m.lastIndexOf(':') + 1).trim())
137+
.orElse(null);
137138
}
138139

139140
private static Step readExistingPods(DomainPresenceInfo info) {
140141
return new CallBuilder()
141-
.withLabelSelectors(
142-
LabelConstants.forDomainUidSelector(info.getDomainUid()),
143-
LabelConstants.CREATEDBYOPERATOR_LABEL)
144-
.listPodAsync(info.getNamespace(), new PodListStep(info));
142+
.withLabelSelectors(
143+
LabelConstants.forDomainUidSelector(info.getDomainUid()),
144+
LabelConstants.CREATEDBYOPERATOR_LABEL)
145+
.listPodAsync(info.getNamespace(), new PodListStep(info));
145146
}
146147

147148
// pre-conditions: DomainPresenceInfo SPI
148149
// "principal"
149150
static Step bringAdminServerUp(
150-
DomainPresenceInfo info, PodAwaiterStepFactory podAwaiterStepFactory, Step next) {
151+
DomainPresenceInfo info, PodAwaiterStepFactory podAwaiterStepFactory, Step next) {
151152
return Step.chain(bringAdminServerUpSteps(info, podAwaiterStepFactory, next));
152153
}
153154

@@ -159,7 +160,7 @@ private static Step[] domainIntrospectionSteps(Step next) {
159160
}
160161

161162
private static Step[] bringAdminServerUpSteps(
162-
DomainPresenceInfo info, PodAwaiterStepFactory podAwaiterStepFactory, Step next) {
163+
DomainPresenceInfo info, PodAwaiterStepFactory podAwaiterStepFactory, Step next) {
163164
List<Step> resources = new ArrayList<>();
164165
resources.add(new BeforeAdminServiceStep(null));
165166
resources.add(PodHelper.createAdminPodStep(null));
@@ -625,8 +626,8 @@ private static class PodListStep extends ResponseStep<V1PodList> {
625626
@Override
626627
public NextAction onFailure(Packet packet, CallResponse<V1PodList> callResponse) {
627628
return callResponse.getStatusCode() == CallBuilder.NOT_FOUND
628-
? onSuccess(packet, callResponse)
629-
: super.onFailure(packet, callResponse);
629+
? onSuccess(packet, callResponse)
630+
: super.onFailure(packet, callResponse);
630631
}
631632

632633
@Override
@@ -682,8 +683,8 @@ private class ServiceListStep extends ResponseStep<V1ServiceList> {
682683
@Override
683684
public NextAction onFailure(Packet packet, CallResponse<V1ServiceList> callResponse) {
684685
return callResponse.getStatusCode() == CallBuilder.NOT_FOUND
685-
? onSuccess(packet, callResponse)
686-
: super.onFailure(packet, callResponse);
686+
? onSuccess(packet, callResponse)
687+
: super.onFailure(packet, callResponse);
687688
}
688689

689690
@Override
@@ -717,10 +718,10 @@ public NextAction apply(Packet packet) {
717718
PodAwaiterStepFactory pw = delegate.getPodAwaiterStepFactory(info.getNamespace());
718719
info.setDeleting(false);
719720
packet
720-
.getComponents()
721-
.put(
722-
ProcessingConstants.DOMAIN_COMPONENT_NAME,
723-
Component.createFor(info, delegate.getVersion(), PodAwaiterStepFactory.class, pw));
721+
.getComponents()
722+
.put(
723+
ProcessingConstants.DOMAIN_COMPONENT_NAME,
724+
Component.createFor(info, delegate.getVersion(), PodAwaiterStepFactory.class, pw));
724725
return doNext(packet);
725726
}
726727
}
@@ -760,10 +761,10 @@ public NextAction apply(Packet packet) {
760761
unregisterStatusUpdater(ns, info.getDomainUid());
761762
PodAwaiterStepFactory pw = delegate.getPodAwaiterStepFactory(ns);
762763
packet
763-
.getComponents()
764-
.put(
765-
ProcessingConstants.DOMAIN_COMPONENT_NAME,
766-
Component.createFor(info, delegate.getVersion(), PodAwaiterStepFactory.class, pw));
764+
.getComponents()
765+
.put(
766+
ProcessingConstants.DOMAIN_COMPONENT_NAME,
767+
Component.createFor(info, delegate.getVersion(), PodAwaiterStepFactory.class, pw));
767768
return doNext(packet);
768769
}
769770
}
@@ -781,8 +782,8 @@ private class DomainStatusUpdate {
781782

782783
public void invoke() {
783784
Optional.ofNullable(getMatchingContainerStatus(pod, domainUid).getState())
784-
.map(V1ContainerState::getWaiting)
785-
.ifPresent(waiting -> updateStatus(waiting.getReason(), waiting.getMessage()));
785+
.map(V1ContainerState::getWaiting)
786+
.ifPresent(waiting -> updateStatus(waiting.getReason(), waiting.getMessage()));
786787
}
787788

788789
private void updateStatus(String reason, String message) {
@@ -791,9 +792,9 @@ private void updateStatus(String reason, String message) {
791792

792793
private V1ContainerStatus getMatchingContainerStatus(V1Pod pod, String domainUid) {
793794
return pod.getStatus().getContainerStatuses().stream()
794-
.filter(s -> toJobIntrospectorName(domainUid).equals(s.getName()))
795-
.findFirst()
796-
.orElse(null);
795+
.filter(s -> toJobIntrospectorName(domainUid).equals(s.getName()))
796+
.findFirst()
797+
.orElse(null);
797798
}
798799
}
799800
}

operator/src/main/java/oracle/kubernetes/operator/helpers/JobHelper.java

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
package oracle.kubernetes.operator.helpers;
66

7+
import java.util.ArrayList;
8+
import java.util.List;
9+
710
import io.kubernetes.client.models.V1DeleteOptions;
811
import io.kubernetes.client.models.V1EnvVar;
912
import io.kubernetes.client.models.V1Job;
1013
import io.kubernetes.client.models.V1Pod;
1114
import io.kubernetes.client.models.V1PodList;
1215
import io.kubernetes.client.models.V1Volume;
1316
import io.kubernetes.client.models.V1VolumeMount;
14-
import java.util.ArrayList;
15-
import java.util.List;
1617
import oracle.kubernetes.operator.JobWatcher;
1718
import oracle.kubernetes.operator.LabelConstants;
1819
import oracle.kubernetes.operator.ProcessingConstants;
@@ -39,9 +40,10 @@ public class JobHelper {
3940
static final String START_TIME = "WlsRetriever-startTime";
4041
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
4142
static final String INTROSPECTOR_LOG_PREFIX = "Introspector Job Log: ";
42-
static final String EOL_PATTERN = "\\r?\\n";
43+
private static final String EOL_PATTERN = "\\r?\\n";
4344

44-
private JobHelper() {}
45+
private JobHelper() {
46+
}
4547

4648
static String createJobName(String domainUid) {
4749
return LegalNames.toJobIntrospectorName(domainUid);
@@ -92,15 +94,15 @@ static boolean creatingServers(DomainPresenceInfo info) {
9294
int replicaCount = dom.getReplicaCount(cluster.getClusterName());
9395
String clusterServerStartPolicy = cluster.getServerStartPolicy();
9496
LOGGER.fine(
95-
"Start Policy: "
96-
+ clusterServerStartPolicy
97-
+ ", replicaCount: "
98-
+ replicaCount
99-
+ " for cluster: "
100-
+ cluster);
97+
"Start Policy: "
98+
+ clusterServerStartPolicy
99+
+ ", replicaCount: "
100+
+ replicaCount
101+
+ " for cluster: "
102+
+ cluster);
101103
if ((clusterServerStartPolicy == null
102-
|| !clusterServerStartPolicy.equals(ConfigurationConstants.START_NEVER))
103-
&& replicaCount > 0) {
104+
|| !clusterServerStartPolicy.equals(ConfigurationConstants.START_NEVER))
105+
&& replicaCount > 0) {
104106
return true;
105107
}
106108
}
@@ -110,7 +112,7 @@ static boolean creatingServers(DomainPresenceInfo info) {
110112
// NOTE: domainServerStartPolicy == null indicates default policy
111113
String domainServerStartPolicy = dom.getSpec().getServerStartPolicy();
112114
if (domainServerStartPolicy == null
113-
|| !domainServerStartPolicy.equals(ConfigurationConstants.START_NEVER)) {
115+
|| !domainServerStartPolicy.equals(ConfigurationConstants.START_NEVER)) {
114116
return true;
115117
}
116118

@@ -119,7 +121,7 @@ static boolean creatingServers(DomainPresenceInfo info) {
119121
for (ManagedServer server : servers) {
120122
String serverStartPolicy = server.getServerStartPolicy();
121123
if (serverStartPolicy == null
122-
|| !serverStartPolicy.equals(ConfigurationConstants.START_NEVER)) {
124+
|| !serverStartPolicy.equals(ConfigurationConstants.START_NEVER)) {
123125
return true;
124126
}
125127
}
@@ -149,7 +151,7 @@ private static Step createWatchDomainIntrospectorJobReadyStep(Step next) {
149151
*/
150152
private static Step readDomainIntrospectorPodLogStep(Step next) {
151153
return createWatchDomainIntrospectorJobReadyStep(
152-
readDomainIntrospectorPodStep(readDomainIntrospectorPodLog(next)));
154+
readDomainIntrospectorPodStep(readDomainIntrospectorPodLog(next)));
153155
}
154156

155157
/**
@@ -211,7 +213,7 @@ protected List<V1VolumeMount> getAdditionalVolumeMounts() {
211213
List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
212214
// Pod for introspector job would use same environment variables as for admin server
213215
List<V1EnvVar> vars =
214-
PodHelper.createCopy(getDomain().getAdminServerSpec().getEnvironmentVariables());
216+
PodHelper.createCopy(getDomain().getAdminServerSpec().getEnvironmentVariables());
215217

216218
addEnvVar(vars, "NAMESPACE", getNamespace());
217219
addEnvVar(vars, "DOMAIN_UID", getDomainUid());
@@ -241,11 +243,11 @@ public NextAction apply(Packet packet) {
241243
packet.putIfAbsent(START_TIME, System.currentTimeMillis());
242244

243245
return doNext(
244-
context.createNewJob(
245-
readDomainIntrospectorPodLogStep(
246-
deleteDomainIntrospectorJobStep(
247-
ConfigMapHelper.createSitConfigMapStep(getNext())))),
248-
packet);
246+
context.createNewJob(
247+
readDomainIntrospectorPodLogStep(
248+
deleteDomainIntrospectorJobStep(
249+
ConfigMapHelper.createSitConfigMapStep(getNext())))),
250+
packet);
249251
}
250252

251253
return doNext(getNext(), packet);
@@ -278,11 +280,11 @@ private Step deleteJob(Packet packet, Step next) {
278280
String jobName = JobHelper.createJobName(domainUid);
279281
logJobDeleted(domainUid, namespace, jobName);
280282
return new CallBuilder()
281-
.deleteJobAsync(
282-
jobName,
283-
namespace,
284-
new V1DeleteOptions().propagationPolicy("Foreground"),
285-
new DefaultResponseStep<>(next));
283+
.deleteJobAsync(
284+
jobName,
285+
namespace,
286+
new V1DeleteOptions().propagationPolicy("Foreground"),
287+
new DefaultResponseStep<>(next));
286288
}
287289
}
288290

@@ -308,8 +310,8 @@ public NextAction apply(Packet packet) {
308310

309311
private Step readDomainIntrospectorPodLog(String jobPodName, String namespace, Step next) {
310312
return new CallBuilder()
311-
.readPodLogAsync(
312-
jobPodName, namespace, new ReadDomainIntrospectorPodLogResponseStep(next));
313+
.readPodLogAsync(
314+
jobPodName, namespace, new ReadDomainIntrospectorPodLogResponseStep(next));
313315
}
314316
}
315317

@@ -333,7 +335,7 @@ public NextAction onSuccess(Packet packet, CallResponse<String> callResponse) {
333335
}
334336

335337
V1Job domainIntrospectorJob =
336-
(V1Job) packet.remove(ProcessingConstants.DOMAIN_INTROSPECTOR_JOB);
338+
(V1Job) packet.remove(ProcessingConstants.DOMAIN_INTROSPECTOR_JOB);
337339
if (isNotComplete(domainIntrospectorJob)) return onFailure(packet, callResponse);
338340

339341
return doNext(packet);
@@ -405,7 +407,7 @@ private String getFirstLine(String logMsg) {
405407

406408
private void updateStatus(DomainPresenceInfo domainPresenceInfo) {
407409
KubernetesUtils.updateStatus(
408-
domainPresenceInfo.getDomain(), "ErrIntrospector", onSeparateLines(severeStatuses));
410+
domainPresenceInfo.getDomain(), "ErrIntrospector", onSeparateLines(severeStatuses));
409411
}
410412

411413
private String onSeparateLines(List<String> lines) {
@@ -430,8 +432,8 @@ public NextAction apply(Packet packet) {
430432

431433
private Step readDomainIntrospectorPod(String domainUid, String namespace, Step next) {
432434
return new CallBuilder()
433-
.withLabelSelectors(LabelConstants.JOBNAME_LABEL)
434-
.listPodAsync(namespace, new PodListStep(domainUid, next));
435+
.withLabelSelectors(LabelConstants.JOBNAME_LABEL)
436+
.listPodAsync(namespace, new PodListStep(domainUid, next));
435437
}
436438
}
437439

0 commit comments

Comments
 (0)