12
12
import io .kubernetes .client .models .V1Volume ;
13
13
import io .kubernetes .client .models .V1VolumeMount ;
14
14
import java .util .List ;
15
- import java .util .Map ;
16
- import java .util .concurrent .atomic .AtomicBoolean ;
17
- import javax .validation .constraints .NotNull ;
18
15
import oracle .kubernetes .operator .JobWatcher ;
19
16
import oracle .kubernetes .operator .LabelConstants ;
20
17
import oracle .kubernetes .operator .ProcessingConstants ;
21
18
import oracle .kubernetes .operator .TuningParameters ;
22
- import oracle .kubernetes .operator .TuningParameters .WatchTuning ;
23
19
import oracle .kubernetes .operator .calls .CallResponse ;
24
20
import oracle .kubernetes .operator .logging .LoggingFacade ;
25
21
import oracle .kubernetes .operator .logging .LoggingFactory ;
@@ -115,32 +111,18 @@ List<V1EnvVar> getConfiguredEnvVars(TuningParameters tuningParameters) {
115
111
/**
116
112
* Factory for {@link Step} that creates WebLogic domain introspector job.
117
113
*
118
- * @param tuning Watch tuning parameters
119
114
* @param next Next processing step
120
- * @param jws Map of JobWatcher objects, keyed by the string value of the name of a namespace
121
- * @param isStopping Stop signal
122
115
* @return Step for creating job
123
116
*/
124
- public static Step createDomainIntrospectorJobStep (
125
- WatchTuning tuning ,
126
- Step next ,
127
- @ NotNull Map <String , JobWatcher > jws ,
128
- @ NotNull AtomicBoolean isStopping ) {
117
+ public static Step createDomainIntrospectorJobStep (Step next ) {
129
118
130
- return new DomainIntrospectorJobStep (tuning , next , jws , isStopping );
119
+ return new DomainIntrospectorJobStep (next );
131
120
}
132
121
133
122
static class DomainIntrospectorJobStep extends Step {
134
- private final WatchTuning tuning ;
135
- private final Map <String , JobWatcher > jws ;
136
- private final AtomicBoolean isStopping ;
137
123
138
- DomainIntrospectorJobStep (
139
- WatchTuning tuning , Step next , Map <String , JobWatcher > jws , AtomicBoolean isStopping ) {
124
+ DomainIntrospectorJobStep (Step next ) {
140
125
super (next );
141
- this .tuning = tuning ;
142
- this .jws = jws ;
143
- this .isStopping = isStopping ;
144
126
}
145
127
146
128
@ Override
@@ -149,12 +131,12 @@ public NextAction apply(Packet packet) {
149
131
if (runIntrospector (packet , info )) {
150
132
JobStepContext context = new DomainIntrospectorJobStepContext (info , packet );
151
133
152
- packet .putIfAbsent (START_TIME , Long . valueOf ( System .currentTimeMillis () ));
134
+ packet .putIfAbsent (START_TIME , System .currentTimeMillis ());
153
135
154
136
return doNext (
155
137
context .createNewJob (
156
138
readDomainIntrospectorPodLogStep (
157
- tuning , ConfigMapHelper .createSitConfigMapStep (getNext ()), jws , isStopping )),
139
+ ConfigMapHelper .createSitConfigMapStep (getNext ()))),
158
140
packet );
159
141
}
160
142
@@ -167,10 +149,7 @@ private static boolean runIntrospector(Packet packet, DomainPresenceInfo info) {
167
149
LOGGER .fine ("runIntrospector topology: " + config );
168
150
LOGGER .fine ("runningServersCount: " + runningServersCount (info ));
169
151
LOGGER .fine ("creatingServers: " + creatingServers (info ));
170
- if (config == null || (runningServersCount (info ) == 0 && creatingServers (info ))) {
171
- return true ;
172
- }
173
- return false ;
152
+ return config == null || (runningServersCount (info ) == 0 && creatingServers (info ));
174
153
}
175
154
176
155
private static int runningServersCount (DomainPresenceInfo info ) {
@@ -180,7 +159,7 @@ private static int runningServersCount(DomainPresenceInfo info) {
180
159
/**
181
160
* TODO: Enhance determination of when we believe we're creating WLS managed server pods.
182
161
*
183
- * @param info
162
+ * @param info the domain presence info
184
163
* @return True, if creating servers
185
164
*/
186
165
static boolean creatingServers (DomainPresenceInfo info ) {
@@ -262,43 +241,35 @@ String getJobDeletedMessageKey() {
262
241
return MessageKeys .JOB_DELETED ;
263
242
}
264
243
265
- protected void logJobDeleted (String domainUID , String namespace , String jobName ) {
244
+ void logJobDeleted (String domainUID , String namespace , String jobName ) {
266
245
LOGGER .info (getJobDeletedMessageKey (), domainUID , namespace , jobName );
267
246
}
268
247
269
248
private Step deleteJob (Step next ) {
270
249
String jobName = JobHelper .createJobName (this .domainUID );
271
250
logJobDeleted (this .domainUID , namespace , jobName );
272
- Step step =
273
- new CallBuilder ()
274
- .deleteJobAsync (
275
- jobName ,
276
- this .namespace ,
277
- new V1DeleteOptions ().propagationPolicy ("Foreground" ),
278
- new DefaultResponseStep <>(next ));
279
- return step ;
251
+ return new CallBuilder ()
252
+ .deleteJobAsync (
253
+ jobName ,
254
+ this .namespace ,
255
+ new V1DeleteOptions ().propagationPolicy ("Foreground" ),
256
+ new DefaultResponseStep <>(next ));
280
257
}
281
258
}
282
259
283
- private static Step createWatchDomainIntrospectorJobReadyStep (
284
- WatchTuning tuning , Step next , Map <String , JobWatcher > jws , AtomicBoolean isStopping ) {
285
- return new WatchDomainIntrospectorJobReadyStep (tuning , next , jws , isStopping );
260
+ private static Step createWatchDomainIntrospectorJobReadyStep (Step next ) {
261
+ return new WatchDomainIntrospectorJobReadyStep (next );
286
262
}
287
263
288
264
/**
289
265
* Factory for {@link Step} that reads WebLogic domain introspector job results from pod's log.
290
266
*
291
- * @param tuning Watch tuning parameters
292
267
* @param next Next processing step
293
268
* @return Step for reading WebLogic domain introspector pod log
294
269
*/
295
- static Step readDomainIntrospectorPodLogStep (
296
- WatchTuning tuning , Step next , Map <String , JobWatcher > jws , AtomicBoolean isStopping ) {
270
+ private static Step readDomainIntrospectorPodLogStep (Step next ) {
297
271
return createWatchDomainIntrospectorJobReadyStep (
298
- tuning ,
299
- readDomainIntrospectorPodStep (new ReadDomainIntrospectorPodLogStep (next )),
300
- jws ,
301
- isStopping );
272
+ readDomainIntrospectorPodStep (new ReadDomainIntrospectorPodLogStep (next )));
302
273
}
303
274
304
275
private static class ReadDomainIntrospectorPodLogStep extends Step {
@@ -318,16 +289,14 @@ public NextAction apply(Packet packet) {
318
289
}
319
290
320
291
private Step readDomainIntrospectorPodLog (String jobPodName , String namespace , Step next ) {
321
- Step step =
322
- new CallBuilder ()
323
- .readPodLogAsync (
324
- jobPodName , namespace , new ReadDomainIntrospectorPodLogResponseStep (next ));
325
- return step ;
292
+ return new CallBuilder ()
293
+ .readPodLogAsync (
294
+ jobPodName , namespace , new ReadDomainIntrospectorPodLogResponseStep (next ));
326
295
}
327
296
}
328
297
329
298
private static class ReadDomainIntrospectorPodLogResponseStep extends ResponseStep <String > {
330
- public ReadDomainIntrospectorPodLogResponseStep (Step nextStep ) {
299
+ ReadDomainIntrospectorPodLogResponseStep (Step nextStep ) {
331
300
super (nextStep );
332
301
}
333
302
@@ -376,7 +345,7 @@ private void cleanupJobArtifacts(Packet packet) {
376
345
* @param next Next processing step
377
346
* @return Step for reading WebLogic domain introspector pod
378
347
*/
379
- public static Step readDomainIntrospectorPodStep (Step next ) {
348
+ private static Step readDomainIntrospectorPodStep (Step next ) {
380
349
return new ReadDomainIntrospectorPodStep (next );
381
350
}
382
351
@@ -396,24 +365,18 @@ public NextAction apply(Packet packet) {
396
365
}
397
366
398
367
private Step readDomainIntrospectorPod (String domainUID , String namespace , Step next ) {
399
-
400
- Step step =
401
- new CallBuilder ()
402
- .withLabelSelectors (LabelConstants .JOBNAME_LABEL )
403
- .listPodAsync (namespace , new PodListStep (domainUID , namespace , next ));
404
-
405
- return step ;
368
+ return new CallBuilder ()
369
+ .withLabelSelectors (LabelConstants .JOBNAME_LABEL )
370
+ .listPodAsync (namespace , new PodListStep (domainUID , namespace , next ));
406
371
}
407
372
}
408
373
409
374
private static class PodListStep extends ResponseStep <V1PodList > {
410
- private final String ns ;
411
375
private final String domainUID ;
412
376
413
377
PodListStep (String domainUID , String ns , Step next ) {
414
378
super (next );
415
379
this .domainUID = domainUID ;
416
- this .ns = ns ;
417
380
}
418
381
419
382
@ Override
0 commit comments