@@ -84,8 +84,6 @@ public class Main {
84
84
private static final String RUNNING_STATE = "RUNNING" ;
85
85
private static final String ADMIN_STATE = "ADMIN" ;
86
86
87
- private static final String PODWATCHER_COMPONENT_NAME = "podWatcher" ;
88
-
89
87
private static final Container container = new Container ();
90
88
private static final Engine engine = new Engine ("operator" , container );
91
89
@@ -481,6 +479,10 @@ private static void scheduleDomainStatusUpdating(DomainPresenceInfo info) {
481
479
AtomicReference <ScheduledFuture <?>> statusUpdater = info .getStatusUpdater ();
482
480
Runnable command = new Runnable () {
483
481
public void run () {
482
+
483
+ // TEST
484
+ System .out .println ("**** 2 **** domainUID: " + info .getDomain ().getSpec ().getDomainUID ());
485
+
484
486
Runnable r = this ; // resolve visibility
485
487
Packet packet = new Packet ();
486
488
packet .getComponents ().put (ProcessingConstants .DOMAIN_COMPONENT_NAME ,
@@ -526,10 +528,22 @@ public void onThrowable(Packet packet, Throwable throwable) {
526
528
});
527
529
}
528
530
};
531
+
532
+ // TEST
533
+ System .out .println ("**** 3 **** domainUID: " + info .getDomain ().getSpec ().getDomainUID ());
534
+
529
535
MainTuning main = tuningAndConfig .getMainTuning ();
530
536
ScheduledFuture <?> existing = statusUpdater .getAndSet (
531
537
engine .getExecutor ().scheduleWithFixedDelay (command , main .initialShortDelay , main .initialShortDelay , TimeUnit .SECONDS ));
538
+
539
+ // TEST
540
+ System .out .println ("**** 4 **** domainUID: " + info .getDomain ().getSpec ().getDomainUID ());
541
+
532
542
if (existing != null ) {
543
+
544
+ // TEST
545
+ System .out .println ("**** 5 **** domainUID: " + info .getDomain ().getSpec ().getDomainUID ());
546
+
533
547
existing .cancel (false );
534
548
}
535
549
}
@@ -580,23 +594,26 @@ private static void doCheckAndCreateDomainPresence(
580
594
info .setDomain (dom );
581
595
}
582
596
583
- LOGGER .info (MessageKeys .PROCESSING_DOMAIN , domainUID );
584
-
585
- Step managedServerStrategy = bringManagedServersUp (
586
- DomainStatusUpdater .createEndProgressingStep (null ));
587
- Step adminServerStrategy = bringAdminServerUp (
588
- connectToAdminAndInspectDomain (
589
- managedServerStrategy ));
590
-
591
- Step strategy = DomainStatusUpdater .createProgressingStep (
592
- DomainStatusUpdater .INSPECTING_DOMAIN_PROGRESS_REASON ,
593
- true ,
594
- new DomainPrescenceStep (adminServerStrategy , managedServerStrategy ));
595
-
596
- Packet p = new Packet ();
597
-
598
597
String ns = dom .getMetadata ().getNamespace ();
599
- if (initialized .getOrDefault (ns , Boolean .FALSE )) {
598
+ if (initialized .getOrDefault (ns , Boolean .FALSE ) && !stopping .get ()) {
599
+ LOGGER .info (MessageKeys .PROCESSING_DOMAIN , domainUID );
600
+
601
+ // TEST
602
+ System .out .println ("**** 0 **** domainUID: " + domainUID );
603
+
604
+ Step managedServerStrategy = bringManagedServersUp (
605
+ DomainStatusUpdater .createEndProgressingStep (null ));
606
+ Step adminServerStrategy = bringAdminServerUp (
607
+ connectToAdminAndInspectDomain (
608
+ managedServerStrategy ));
609
+
610
+ Step strategy = DomainStatusUpdater .createProgressingStep (
611
+ DomainStatusUpdater .INSPECTING_DOMAIN_PROGRESS_REASON ,
612
+ true ,
613
+ new DomainPrescenceStep (adminServerStrategy , managedServerStrategy ));
614
+
615
+ Packet p = new Packet ();
616
+
600
617
PodWatcher pw = podWatchers .get (ns );
601
618
p .getComponents ().put (ProcessingConstants .DOMAIN_COMPONENT_NAME ,
602
619
Component .createFor (info , version , pw ));
@@ -618,43 +635,45 @@ private static void doCheckAndCreateDomainPresence(
618
635
LOGGER .info (MessageKeys .ROLLING_CLUSTERS_STARTING , domainUID , explicitRestartClusters );
619
636
}
620
637
621
- if (!stopping .get ()) {
622
- domainUpdaters .startFiber (domainUID , strategy , p , new CompletionCallback () {
623
- @ Override
624
- public void onCompletion (Packet packet ) {
625
- if (explicitRestartAdmin ) {
626
- LOGGER .info (MessageKeys .RESTART_ADMIN_COMPLETE , domainUID );
627
- }
628
- if (explicitRestartServers != null ) {
629
- LOGGER .info (MessageKeys .RESTART_SERVERS_COMPLETE , domainUID , explicitRestartServers );
630
- }
631
- if (explicitRestartClusters != null ) {
632
- LOGGER .info (MessageKeys .ROLLING_CLUSTERS_COMPLETE , domainUID , explicitRestartClusters );
633
- }
638
+ domainUpdaters .startFiber (domainUID , strategy , p , new CompletionCallback () {
639
+ @ Override
640
+ public void onCompletion (Packet packet ) {
641
+ if (explicitRestartAdmin ) {
642
+ LOGGER .info (MessageKeys .RESTART_ADMIN_COMPLETE , domainUID );
634
643
}
635
-
636
- @ Override
637
- public void onThrowable (Packet packet , Throwable throwable ) {
638
- LOGGER .severe (MessageKeys .EXCEPTION , throwable );
639
-
640
- domainUpdaters .startFiberIfLastFiberMatches (domainUID , Fiber .getCurrentIfSet (), DomainStatusUpdater .createFailedStep (throwable , null ), p , new CompletionCallback () {
641
- @ Override
642
- public void onCompletion (Packet packet ) {
643
- // no-op
644
- }
645
-
646
- @ Override
647
- public void onThrowable (Packet packet , Throwable throwable ) {
648
- LOGGER .severe (MessageKeys .EXCEPTION , throwable );
649
- }
650
- });
651
-
652
- // TODO: consider retrying domain update after a delay
644
+ if (explicitRestartServers != null ) {
645
+ LOGGER .info (MessageKeys .RESTART_SERVERS_COMPLETE , domainUID , explicitRestartServers );
653
646
}
654
- });
655
-
656
- scheduleDomainStatusUpdating (info );
657
- }
647
+ if (explicitRestartClusters != null ) {
648
+ LOGGER .info (MessageKeys .ROLLING_CLUSTERS_COMPLETE , domainUID , explicitRestartClusters );
649
+ }
650
+ }
651
+
652
+ @ Override
653
+ public void onThrowable (Packet packet , Throwable throwable ) {
654
+ LOGGER .severe (MessageKeys .EXCEPTION , throwable );
655
+
656
+ domainUpdaters .startFiberIfLastFiberMatches (domainUID , Fiber .getCurrentIfSet (),
657
+ DomainStatusUpdater .createFailedStep (throwable , null ), p , new CompletionCallback () {
658
+ @ Override
659
+ public void onCompletion (Packet packet ) {
660
+ // no-op
661
+ }
662
+
663
+ @ Override
664
+ public void onThrowable (Packet packet , Throwable throwable ) {
665
+ LOGGER .severe (MessageKeys .EXCEPTION , throwable );
666
+ }
667
+ });
668
+
669
+ // TODO: consider retrying domain update after a delay
670
+ }
671
+ });
672
+
673
+ // TEST
674
+ System .out .println ("**** 1 **** domainUID: " + domainUID );
675
+
676
+ scheduleDomainStatusUpdating (info );
658
677
}
659
678
LOGGER .exiting ();
660
679
}
@@ -779,7 +798,7 @@ public NextAction apply(Packet packet) {
779
798
V1Pod adminPod = info .getAdmin ().getPod ().get ();
780
799
781
800
PodWatcher pw = podWatchers .get (adminPod .getMetadata ().getNamespace ());
782
- packet .getComponents ().put (PODWATCHER_COMPONENT_NAME , Component .createFor (pw ));
801
+ packet .getComponents ().put (ProcessingConstants . PODWATCHER_COMPONENT_NAME , Component .createFor (pw ));
783
802
784
803
return doNext (pw .waitForReady (adminPod , next ), packet );
785
804
}
0 commit comments