Skip to content

Commit 216f4bf

Browse files
committed
Remove unnecessary logging
1 parent f78d143 commit 216f4bf

File tree

6 files changed

+170
-23
lines changed

6 files changed

+170
-23
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -12,7 +12,6 @@
1212
import oracle.kubernetes.operator.builders.WatchBuilder;
1313
import oracle.kubernetes.operator.builders.WatchI;
1414
import oracle.kubernetes.operator.watcher.WatchListener;
15-
import org.joda.time.DateTime;
1615

1716
/**
1817
* This class handles ConfigMap watching. It receives config map change events and sends them into
@@ -46,10 +45,6 @@ private ConfigMapWatcher(
4645

4746
@Override
4847
public WatchI<V1ConfigMap> initiateWatch(WatchBuilder watchBuilder) throws ApiException {
49-
// TEST
50-
System.out.println(
51-
"****3: ConfigMapWatcher.initiateWatch, ns=" + ns + ", time=" + DateTime.now());
52-
5348
return watchBuilder
5449
.withLabelSelector(LabelConstants.CREATEDBYOPERATOR_LABEL)
5550
.createConfigMapWatch(ns);

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

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -7,6 +7,9 @@
77
import java.io.IOException;
88
import java.util.Map;
99
import java.util.concurrent.ScheduledExecutorService;
10+
import org.apache.commons.lang3.builder.EqualsBuilder;
11+
import org.apache.commons.lang3.builder.HashCodeBuilder;
12+
import org.apache.commons.lang3.builder.ToStringBuilder;
1013

1114
public interface TuningParameters extends Map<String, String> {
1215

@@ -47,6 +50,55 @@ public MainTuning(
4750
this.initialShortDelay = initialShortDelay;
4851
this.eventualLongDelay = eventualLongDelay;
4952
}
53+
54+
@Override
55+
public String toString() {
56+
return new ToStringBuilder(this)
57+
.append("domainPresenceFailureRetrySeconds", domainPresenceFailureRetrySeconds)
58+
.append("domainPresenceFailureRetryMaxCount", domainPresenceFailureRetryMaxCount)
59+
.append("domainPresenceRecheckIntervalSeconds", domainPresenceRecheckIntervalSeconds)
60+
.append("targetNamespaceRecheckIntervalSeconds", targetNamespaceRecheckIntervalSeconds)
61+
.append("statusUpdateTimeoutSeconds", statusUpdateTimeoutSeconds)
62+
.append("unchangedCountToDelayStatusRecheck", unchangedCountToDelayStatusRecheck)
63+
.append("initialShortDelay", initialShortDelay)
64+
.append("eventualLongDelay", eventualLongDelay)
65+
.toString();
66+
}
67+
68+
@Override
69+
public int hashCode() {
70+
return new HashCodeBuilder()
71+
.append(domainPresenceFailureRetrySeconds)
72+
.append(domainPresenceFailureRetryMaxCount)
73+
.append(domainPresenceRecheckIntervalSeconds)
74+
.append(targetNamespaceRecheckIntervalSeconds)
75+
.append(statusUpdateTimeoutSeconds)
76+
.append(unchangedCountToDelayStatusRecheck)
77+
.append(initialShortDelay)
78+
.append(eventualLongDelay)
79+
.toHashCode();
80+
}
81+
82+
@Override
83+
public boolean equals(Object o) {
84+
if (o == null) {
85+
return false;
86+
}
87+
if (!(o instanceof MainTuning)) {
88+
return false;
89+
}
90+
MainTuning mt = (MainTuning) o;
91+
return new EqualsBuilder()
92+
.append(domainPresenceFailureRetrySeconds, mt.domainPresenceFailureRetrySeconds)
93+
.append(domainPresenceFailureRetryMaxCount, mt.domainPresenceFailureRetryMaxCount)
94+
.append(domainPresenceRecheckIntervalSeconds, mt.domainPresenceRecheckIntervalSeconds)
95+
.append(targetNamespaceRecheckIntervalSeconds, mt.targetNamespaceRecheckIntervalSeconds)
96+
.append(statusUpdateTimeoutSeconds, mt.statusUpdateTimeoutSeconds)
97+
.append(unchangedCountToDelayStatusRecheck, mt.unchangedCountToDelayStatusRecheck)
98+
.append(initialShortDelay, mt.initialShortDelay)
99+
.append(eventualLongDelay, mt.eventualLongDelay)
100+
.isEquals();
101+
}
50102
}
51103

52104
public static class CallBuilderTuning {
@@ -59,6 +111,40 @@ public CallBuilderTuning(int callRequestLimit, int callMaxRetryCount, int callTi
59111
this.callMaxRetryCount = callMaxRetryCount;
60112
this.callTimeoutSeconds = callTimeoutSeconds;
61113
}
114+
115+
@Override
116+
public String toString() {
117+
return new ToStringBuilder(this)
118+
.append("callRequestLimit", callRequestLimit)
119+
.append("callMaxRetryCount", callMaxRetryCount)
120+
.append("callTimeoutSeconds", callTimeoutSeconds)
121+
.toString();
122+
}
123+
124+
@Override
125+
public int hashCode() {
126+
return new HashCodeBuilder()
127+
.append(callRequestLimit)
128+
.append(callMaxRetryCount)
129+
.append(callTimeoutSeconds)
130+
.toHashCode();
131+
}
132+
133+
@Override
134+
public boolean equals(Object o) {
135+
if (o == null) {
136+
return false;
137+
}
138+
if (!(o instanceof CallBuilderTuning)) {
139+
return false;
140+
}
141+
CallBuilderTuning cbt = (CallBuilderTuning) o;
142+
return new EqualsBuilder()
143+
.append(callRequestLimit, cbt.callRequestLimit)
144+
.append(callMaxRetryCount, cbt.callMaxRetryCount)
145+
.append(callTimeoutSeconds, cbt.callTimeoutSeconds)
146+
.isEquals();
147+
}
62148
}
63149

64150
public static class WatchTuning {
@@ -69,6 +155,34 @@ public WatchTuning(int watchLifetime, int watchMinimumDelay) {
69155
this.watchLifetime = watchLifetime;
70156
this.watchMinimumDelay = watchMinimumDelay;
71157
}
158+
159+
@Override
160+
public String toString() {
161+
return new ToStringBuilder(this)
162+
.append("watchLifetime", watchLifetime)
163+
.append("watchMinimumDelay", watchMinimumDelay)
164+
.toString();
165+
}
166+
167+
@Override
168+
public int hashCode() {
169+
return new HashCodeBuilder().append(watchLifetime).append(watchMinimumDelay).toHashCode();
170+
}
171+
172+
@Override
173+
public boolean equals(Object o) {
174+
if (o == null) {
175+
return false;
176+
}
177+
if (!(o instanceof WatchTuning)) {
178+
return false;
179+
}
180+
WatchTuning wt = (WatchTuning) o;
181+
return new EqualsBuilder()
182+
.append(watchLifetime, wt.watchLifetime)
183+
.append(watchMinimumDelay, wt.watchMinimumDelay)
184+
.isEquals();
185+
}
72186
}
73187

74188
public static class PodTuning {
@@ -93,6 +207,49 @@ public PodTuning(
93207
this.livenessProbeTimeoutSeconds = livenessProbeTimeoutSeconds;
94208
this.livenessProbePeriodSeconds = livenessProbePeriodSeconds;
95209
}
210+
211+
@Override
212+
public String toString() {
213+
return new ToStringBuilder(this)
214+
.append("readinessProbeInitialDelaySeconds", readinessProbeInitialDelaySeconds)
215+
.append("readinessProbeTimeoutSeconds", readinessProbeTimeoutSeconds)
216+
.append("readinessProbePeriodSeconds", readinessProbePeriodSeconds)
217+
.append("livenessProbeInitialDelaySeconds", livenessProbeInitialDelaySeconds)
218+
.append("livenessProbeTimeoutSeconds", livenessProbeTimeoutSeconds)
219+
.append("livenessProbePeriodSeconds", livenessProbePeriodSeconds)
220+
.toString();
221+
}
222+
223+
@Override
224+
public int hashCode() {
225+
return new HashCodeBuilder()
226+
.append(readinessProbeInitialDelaySeconds)
227+
.append(readinessProbeTimeoutSeconds)
228+
.append(readinessProbePeriodSeconds)
229+
.append(livenessProbeInitialDelaySeconds)
230+
.append(livenessProbeTimeoutSeconds)
231+
.append(livenessProbePeriodSeconds)
232+
.toHashCode();
233+
}
234+
235+
@Override
236+
public boolean equals(Object o) {
237+
if (o == null) {
238+
return false;
239+
}
240+
if (!(o instanceof PodTuning)) {
241+
return false;
242+
}
243+
PodTuning pt = (PodTuning) o;
244+
return new EqualsBuilder()
245+
.append(readinessProbeInitialDelaySeconds, pt.readinessProbeInitialDelaySeconds)
246+
.append(readinessProbeTimeoutSeconds, pt.readinessProbeTimeoutSeconds)
247+
.append(readinessProbePeriodSeconds, pt.readinessProbePeriodSeconds)
248+
.append(livenessProbeInitialDelaySeconds, pt.livenessProbeInitialDelaySeconds)
249+
.append(livenessProbeTimeoutSeconds, pt.livenessProbeTimeoutSeconds)
250+
.append(livenessProbePeriodSeconds, pt.livenessProbePeriodSeconds)
251+
.isEquals();
252+
}
96253
}
97254

98255
public MainTuning getMainTuning();

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -47,8 +47,6 @@ private static void updateTuningParameters() {
4747
}
4848

4949
private void update() {
50-
LOGGER.info(MessageKeys.TUNING_PARAMETERS);
51-
5250
MainTuning main =
5351
new MainTuning(
5452
(int) readTuningParameter("domainPresenceFailureRetrySeconds", 10),
@@ -82,6 +80,12 @@ private void update() {
8280

8381
lock.writeLock().lock();
8482
try {
83+
if (!main.equals(this.main)
84+
|| !callBuilder.equals(this.callBuilder)
85+
|| !watch.equals(this.watch)
86+
|| !pod.equals(this.pod)) {
87+
LOGGER.info(MessageKeys.TUNING_PARAMETERS);
88+
}
8589
this.main = main;
8690
this.callBuilder = callBuilder;
8791
this.watch = watch;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -96,7 +96,7 @@ private V1ObjectMeta createMetadata() {
9696

9797
private synchronized Map<String, String> loadScriptsFromClasspath() {
9898
Map<String, String> scripts = scriptReader.loadFilesFromClasspath();
99-
LOGGER.info(MessageKeys.SCRIPT_LOADED, this.domainNamespace);
99+
LOGGER.fine(MessageKeys.SCRIPT_LOADED, this.domainNamespace);
100100
return scripts;
101101
}
102102

operator/src/main/java/oracle/kubernetes/operator/steps/ConfigMapAfterStep.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -16,7 +16,6 @@
1616
import oracle.kubernetes.operator.work.NextAction;
1717
import oracle.kubernetes.operator.work.Packet;
1818
import oracle.kubernetes.operator.work.Step;
19-
import org.joda.time.DateTime;
2019

2120
public class ConfigMapAfterStep extends Step {
2221
private final String ns;
@@ -41,15 +40,7 @@ public ConfigMapAfterStep(
4140
@Override
4241
public NextAction apply(Packet packet) {
4342
V1ConfigMap result = (V1ConfigMap) packet.get(ProcessingConstants.SCRIPT_CONFIG_MAP);
44-
45-
// TEST
46-
System.out.println("****1: ConfigMapAfterStep.apply, ns=" + ns + ", time=" + DateTime.now());
47-
4843
if (!configMapWatchers.containsKey(ns)) {
49-
50-
// TEST
51-
System.out.println("****2: ConfigMapAfterStep.apply, ns=" + ns + ", time=" + DateTime.now());
52-
5344
configMapWatchers.put(
5445
ns,
5546
createConfigMapWatcher(

operator/src/test/java/oracle/kubernetes/operator/WatcherTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

0 commit comments

Comments
 (0)