@@ -188,9 +188,9 @@ static void cleanupNamespace(String namespace) {
188
188
}
189
189
190
190
private static void registerStatusUpdater (
191
- String ns , String domainUid , ScheduledFuture <?> future ) {
191
+ String ns , String domainUid , ScheduledFuture <?> future ) {
192
192
ScheduledFuture <?> existing =
193
- statusUpdaters .computeIfAbsent (ns , k -> new ConcurrentHashMap <>()).put (domainUid , future );
193
+ statusUpdaters .computeIfAbsent (ns , k -> new ConcurrentHashMap <>()).put (domainUid , future );
194
194
if (existing != null ) {
195
195
existing .cancel (false );
196
196
}
@@ -293,8 +293,8 @@ private static void processServerEvent(CoreV1Event event) {
293
293
}
294
294
295
295
Optional .ofNullable (domains .get (event .getMetadata ().getNamespace ()))
296
- .map (m -> m .get (domainUid ))
297
- .ifPresent (info -> info .updateLastKnownServerStatus (serverName , status ));
296
+ .map (m -> m .get (domainUid ))
297
+ .ifPresent (info -> info .updateLastKnownServerStatus (serverName , status ));
298
298
}
299
299
300
300
/**
@@ -337,9 +337,9 @@ private void onDeleteEvent(@Nonnull String kind, @Nonnull String name, CoreV1Eve
337
337
338
338
private static String getReadinessStatus (CoreV1Event event ) {
339
339
return Optional .ofNullable (event .getMessage ())
340
- .filter (m -> m .contains (WebLogicConstants .READINESS_PROBE_NOT_READY_STATE ))
341
- .map (m -> m .substring (m .lastIndexOf (':' ) + 1 ).trim ())
342
- .orElse (null );
340
+ .filter (m -> m .contains (WebLogicConstants .READINESS_PROBE_NOT_READY_STATE ))
341
+ .map (m -> m .substring (m .lastIndexOf (':' ) + 1 ).trim ())
342
+ .orElse (null );
343
343
}
344
344
345
345
// pre-conditions: DomainPresenceInfo SPI
@@ -379,10 +379,14 @@ private boolean shouldContinue(MakeRightDomainOperation operation, DomainPresenc
379
379
final DomainPresenceInfo cachedInfo = getExistingDomainPresenceInfo (liveInfo );
380
380
if (isNewDomain (cachedInfo )) {
381
381
return true ;
382
- } else if (liveInfo .isFromOutOfDateEvent (operation , cachedInfo )
383
- || liveInfo .isDomainProcessingHalted (cachedInfo )) {
382
+ } else if (liveInfo .isFromOutOfDateEvent (operation , cachedInfo )) {
383
+ return false ;
384
+ } else if (isDeleting (operation )) {
385
+ return true ;
386
+ } else if (liveInfo .isDomainProcessingHalted (cachedInfo )) {
384
387
return false ;
385
- } else if (operation .isExplicitRecheck () || liveInfo .isDomainGenerationChanged (cachedInfo )) {
388
+ } else if (isExplicitRecheckWithoutRetriableFailure (operation , liveInfo )
389
+ || liveInfo .isDomainGenerationChanged (cachedInfo )) {
386
390
return true ;
387
391
} else {
388
392
cachedInfo .setDomain (liveInfo .getDomain ());
@@ -392,7 +396,7 @@ private boolean shouldContinue(MakeRightDomainOperation operation, DomainPresenc
392
396
393
397
private boolean shouldContinue (MakeRightClusterOperation operation , ClusterPresenceInfo liveInfo ) {
394
398
final ClusterPresenceInfo cachedInfo = getExistingClusterPresenceInfo (liveInfo );
395
- if (hasDeletedClusterEventData (operation )) {
399
+ if (isDeleting (operation )) {
396
400
return findClusterPresenceInfo (liveInfo .getNamespace (), liveInfo .getResourceName ());
397
401
} else if (isNewCluster (cachedInfo )) {
398
402
return true ;
@@ -406,6 +410,15 @@ private boolean shouldContinue(MakeRightClusterOperation operation, ClusterPrese
406
410
}
407
411
}
408
412
413
+ private boolean isExplicitRecheckWithoutRetriableFailure (
414
+ MakeRightDomainOperation operation , DomainPresenceInfo info ) {
415
+ return operation .isExplicitRecheck () && !hasRetriableFailureNonRetryingOperation (operation , info );
416
+ }
417
+
418
+ private boolean hasRetriableFailureNonRetryingOperation (MakeRightDomainOperation operation , DomainPresenceInfo info ) {
419
+ return info .hasRetriableFailure () && !operation .isRetryOnFailure ();
420
+ }
421
+
409
422
private boolean isNewDomain (DomainPresenceInfo cachedInfo ) {
410
423
return Optional .ofNullable (cachedInfo ).map (DomainPresenceInfo ::getDomain ).orElse (null ) == null ;
411
424
}
@@ -418,11 +431,15 @@ private boolean findClusterPresenceInfo(String namespace, String clusterName) {
418
431
return Optional .ofNullable (clusters .get (namespace )).orElse (Collections .emptyMap ()).get (clusterName ) != null ;
419
432
}
420
433
421
- private boolean hasDeletedClusterEventData (MakeRightClusterOperation operation ) {
434
+ private boolean isDeleting (MakeRightClusterOperation operation ) {
422
435
return EventItem .CLUSTER_DELETED == getEventItem (operation );
423
436
}
424
437
425
- private EventItem getEventItem (MakeRightClusterOperation operation ) {
438
+ private boolean isDeleting (MakeRightDomainOperation operation ) {
439
+ return operation .isDeleting () || EventItem .DOMAIN_DELETED == getEventItem (operation );
440
+ }
441
+
442
+ private EventItem getEventItem (MakeRightOperation operation ) {
426
443
return Optional .ofNullable (operation .getEventData ()).map (EventData ::getItem ).orElse (null );
427
444
}
428
445
@@ -454,8 +471,8 @@ public void scheduleDomainStatusUpdates(DomainPresenceInfo info) {
454
471
@ Override
455
472
public void registerDomainPresenceInfo (DomainPresenceInfo info ) {
456
473
domains
457
- .computeIfAbsent (info .getNamespace (), k -> new ConcurrentHashMap <>())
458
- .put (info .getDomainUid (), info );
474
+ .computeIfAbsent (info .getNamespace (), k -> new ConcurrentHashMap <>())
475
+ .put (info .getDomainUid (), info );
459
476
}
460
477
461
478
@ Override
@@ -522,22 +539,22 @@ public void reportSuspendedFibers() {
522
539
if (LOGGER .isFineEnabled ()) {
523
540
BiConsumer <String , FiberGate > consumer =
524
541
(namespace , gate ) -> gate .getCurrentFibers ().forEach (
525
- (key , fiber ) -> Optional .ofNullable (fiber .getSuspendedStep ()).ifPresent (suspendedStep -> {
526
- try (ThreadLoggingContext ignored
527
- = setThreadContext ().namespace (namespace ).domainUid (getDomainUid (fiber ))) {
528
- LOGGER .fine ("Fiber is SUSPENDED at " + suspendedStep .getResourceName ());
529
- }
530
- }));
542
+ (key , fiber ) -> Optional .ofNullable (fiber .getSuspendedStep ()).ifPresent (suspendedStep -> {
543
+ try (ThreadLoggingContext ignored
544
+ = setThreadContext ().namespace (namespace ).domainUid (getDomainUid (fiber ))) {
545
+ LOGGER .fine ("Fiber is SUSPENDED at " + suspendedStep .getResourceName ());
546
+ }
547
+ }));
531
548
makeRightFiberGates .forEach (consumer );
532
549
statusFiberGates .forEach (consumer );
533
550
}
534
551
}
535
552
536
553
private String getDomainUid (Fiber fiber ) {
537
554
return Optional .ofNullable (fiber )
538
- .map (Fiber ::getPacket )
539
- .map (p -> p .getSpi (DomainPresenceInfo .class ))
540
- .map (DomainPresenceInfo ::getDomainUid ).orElse ("" );
555
+ .map (Fiber ::getPacket )
556
+ .map (p -> p .getSpi (DomainPresenceInfo .class ))
557
+ .map (DomainPresenceInfo ::getDomainUid ).orElse ("" );
541
558
}
542
559
543
560
/**
@@ -622,10 +639,9 @@ private void processIntrospectorJobPodWatch(@Nonnull V1Pod pod, String watchType
622
639
@ Override
623
640
public void updateDomainStatus (@ Nonnull V1Pod pod , DomainPresenceInfo info ) {
624
641
Optional .ofNullable (IntrospectionStatus .createStatusUpdateSteps (pod ))
625
- .ifPresent (steps -> delegate .runSteps (new Packet ().with (info ), steps , null ));
642
+ .ifPresent (steps -> delegate .runSteps (new Packet ().with (info ), steps , null ));
626
643
}
627
644
628
-
629
645
/* Recently, we've seen a number of intermittent bugs where K8s reports
630
646
* outdated watch events. There seem to be two main cases: 1) a DELETED
631
647
* event for a resource that was deleted, but has since been recreated, and 2)
@@ -677,7 +693,7 @@ public void dispatchPodDisruptionBudgetWatch(Watch.Response<V1PodDisruptionBudge
677
693
}
678
694
679
695
DomainPresenceInfo info =
680
- getExistingDomainPresenceInfo (getPDBNamespace (pdb ), domainUid );
696
+ getExistingDomainPresenceInfo (getPDBNamespace (pdb ), domainUid );
681
697
if (info == null ) {
682
698
return ;
683
699
}
@@ -718,7 +734,7 @@ public void dispatchConfigMapWatch(Watch.Response<V1ConfigMap> item) {
718
734
case DELETED :
719
735
delegate .runSteps (
720
736
ConfigMapHelper .createScriptConfigMapStep (
721
- c .getMetadata ().getNamespace (), productVersion ));
737
+ c .getMetadata ().getNamespace (), productVersion ));
722
738
break ;
723
739
724
740
case ERROR :
@@ -993,7 +1009,7 @@ private void reportFailure(Throwable throwable) {
993
1009
logThrowable (throwable );
994
1010
runFailureSteps (throwable );
995
1011
}
996
-
1012
+
997
1013
private void runFailureSteps (Throwable throwable ) {
998
1014
gate .startNewFiberIfCurrentFiberMatches (
999
1015
((DomainPresenceInfo )presenceInfo ).getDomainUid (),
@@ -1042,7 +1058,7 @@ private void scheduleRetry(@Nonnull DomainPresenceInfo domainPresenceInfo) {
1042
1058
final MakeRightDomainOperation retry = operation .createRetry (domainPresenceInfo );
1043
1059
gate .getExecutor ().schedule (retry ::execute , delayUntilNextRetry (domainPresenceInfo ), TimeUnit .SECONDS );
1044
1060
}
1045
-
1061
+
1046
1062
private long delayUntilNextRetry (@ Nonnull DomainPresenceInfo domainPresenceInfo ) {
1047
1063
final OffsetDateTime nextRetryTime = domainPresenceInfo .getDomain ().getNextRetryTime ();
1048
1064
final Duration interval = Duration .between (SystemClock .now (), nextRetryTime );
0 commit comments