|
36 | 36 | import oracle.kubernetes.operator.logging.MessageKeys;
|
37 | 37 | import oracle.kubernetes.operator.steps.DefaultResponseStep;
|
38 | 38 | import oracle.kubernetes.operator.wlsconfig.WlsDomainConfig;
|
39 |
| -import oracle.kubernetes.operator.work.Fiber; |
40 |
| -import oracle.kubernetes.operator.work.Fiber.CompletionCallback; |
41 | 39 | import oracle.kubernetes.operator.work.NextAction;
|
42 | 40 | import oracle.kubernetes.operator.work.Packet;
|
43 | 41 | import oracle.kubernetes.operator.work.Step;
|
@@ -265,47 +263,15 @@ private Collection<String> getServerNames() {
|
265 | 263 | * @return Step
|
266 | 264 | */
|
267 | 265 | public static Step createProgressingStep(String reason, boolean isPreserveAvailable, Step next) {
|
268 |
| - return new ProgressingHookStep(reason, isPreserveAvailable, next); |
269 |
| - } |
270 |
| - |
271 |
| - private static class ProgressingHookStep extends Step { |
272 |
| - private final String reason; |
273 |
| - private final boolean isPreserveAvailable; |
274 |
| - |
275 |
| - private ProgressingHookStep(String reason, boolean isPreserveAvailable, Step next) { |
276 |
| - super(next); |
277 |
| - this.reason = reason; |
278 |
| - this.isPreserveAvailable = isPreserveAvailable; |
279 |
| - } |
280 |
| - |
281 |
| - @Override |
282 |
| - public NextAction apply(Packet packet) { |
283 |
| - Fiber f = Fiber.current().createChildFiber(); |
284 |
| - Packet p = new Packet(); |
285 |
| - p.getComponents().putAll(packet.getComponents()); |
286 |
| - f.start( |
287 |
| - new ProgressingStep(reason, isPreserveAvailable), |
288 |
| - p, |
289 |
| - new CompletionCallback() { |
290 |
| - @Override |
291 |
| - public void onCompletion(Packet packet) {} |
292 |
| - |
293 |
| - @Override |
294 |
| - public void onThrowable(Packet packet, Throwable throwable) { |
295 |
| - LOGGER.severe(MessageKeys.EXCEPTION, throwable); |
296 |
| - } |
297 |
| - }); |
298 |
| - |
299 |
| - return doNext(packet); |
300 |
| - } |
| 266 | + return new ProgressingStep(reason, isPreserveAvailable, next); |
301 | 267 | }
|
302 | 268 |
|
303 | 269 | private static class ProgressingStep extends Step {
|
304 | 270 | private final String reason;
|
305 | 271 | private final boolean isPreserveAvailable;
|
306 | 272 |
|
307 |
| - private ProgressingStep(String reason, boolean isPreserveAvailable) { |
308 |
| - super(null); |
| 273 | + private ProgressingStep(String reason, boolean isPreserveAvailable, Step next) { |
| 274 | + super(next); |
309 | 275 | this.reason = reason;
|
310 | 276 | this.isPreserveAvailable = isPreserveAvailable;
|
311 | 277 | }
|
@@ -376,44 +342,14 @@ public NextAction apply(Packet packet) {
|
376 | 342 | * @return Step
|
377 | 343 | */
|
378 | 344 | public static Step createAvailableStep(String reason, Step next) {
|
379 |
| - return new AvailableHookStep(reason, next); |
380 |
| - } |
381 |
| - |
382 |
| - private static class AvailableHookStep extends Step { |
383 |
| - private final String reason; |
384 |
| - |
385 |
| - private AvailableHookStep(String reason, Step next) { |
386 |
| - super(next); |
387 |
| - this.reason = reason; |
388 |
| - } |
389 |
| - |
390 |
| - @Override |
391 |
| - public NextAction apply(Packet packet) { |
392 |
| - Fiber f = Fiber.current().createChildFiber(); |
393 |
| - Packet p = new Packet(); |
394 |
| - p.getComponents().putAll(packet.getComponents()); |
395 |
| - f.start( |
396 |
| - new AvailableStep(reason), |
397 |
| - p, |
398 |
| - new CompletionCallback() { |
399 |
| - @Override |
400 |
| - public void onCompletion(Packet packet) {} |
401 |
| - |
402 |
| - @Override |
403 |
| - public void onThrowable(Packet packet, Throwable throwable) { |
404 |
| - LOGGER.severe(MessageKeys.EXCEPTION, throwable); |
405 |
| - } |
406 |
| - }); |
407 |
| - |
408 |
| - return doNext(packet); |
409 |
| - } |
| 345 | + return new AvailableStep(reason, next); |
410 | 346 | }
|
411 | 347 |
|
412 | 348 | private static class AvailableStep extends Step {
|
413 | 349 | private final String reason;
|
414 | 350 |
|
415 |
| - private AvailableStep(String reason) { |
416 |
| - super(null); |
| 351 | + private AvailableStep(String reason, Step next) { |
| 352 | + super(next); |
417 | 353 | this.reason = reason;
|
418 | 354 | }
|
419 | 355 |
|
@@ -499,44 +435,14 @@ public NextAction onSuccess(Packet packet, CallResponse<Domain> callResponse) {
|
499 | 435 | * @return Step
|
500 | 436 | */
|
501 | 437 | static Step createFailedStep(Throwable throwable, Step next) {
|
502 |
| - return new FailedHookStep(throwable, next); |
503 |
| - } |
504 |
| - |
505 |
| - private static class FailedHookStep extends Step { |
506 |
| - private final Throwable throwable; |
507 |
| - |
508 |
| - private FailedHookStep(Throwable throwable, Step next) { |
509 |
| - super(next); |
510 |
| - this.throwable = throwable; |
511 |
| - } |
512 |
| - |
513 |
| - @Override |
514 |
| - public NextAction apply(Packet packet) { |
515 |
| - Fiber f = Fiber.current().createChildFiber(); |
516 |
| - Packet p = new Packet(); |
517 |
| - p.getComponents().putAll(packet.getComponents()); |
518 |
| - f.start( |
519 |
| - new FailedStep(throwable), |
520 |
| - p, |
521 |
| - new CompletionCallback() { |
522 |
| - @Override |
523 |
| - public void onCompletion(Packet packet) {} |
524 |
| - |
525 |
| - @Override |
526 |
| - public void onThrowable(Packet packet, Throwable throwable) { |
527 |
| - LOGGER.severe(MessageKeys.EXCEPTION, throwable); |
528 |
| - } |
529 |
| - }); |
530 |
| - |
531 |
| - return doNext(packet); |
532 |
| - } |
| 438 | + return new FailedStep(throwable, next); |
533 | 439 | }
|
534 | 440 |
|
535 | 441 | private static class FailedStep extends Step {
|
536 | 442 | private final Throwable throwable;
|
537 | 443 |
|
538 |
| - private FailedStep(Throwable throwable) { |
539 |
| - super(null); |
| 444 | + private FailedStep(Throwable throwable, Step next) { |
| 445 | + super(next); |
540 | 446 | this.throwable = throwable;
|
541 | 447 | }
|
542 | 448 |
|
|
0 commit comments