@@ -188,9 +188,9 @@ static void cleanupNamespace(String namespace) {
188188 }
189189
190190 private static void registerStatusUpdater (
191- String ns , String domainUid , ScheduledFuture <?> future ) {
191+ String ns , String domainUid , ScheduledFuture <?> future ) {
192192 ScheduledFuture <?> existing =
193- statusUpdaters .computeIfAbsent (ns , k -> new ConcurrentHashMap <>()).put (domainUid , future );
193+ statusUpdaters .computeIfAbsent (ns , k -> new ConcurrentHashMap <>()).put (domainUid , future );
194194 if (existing != null ) {
195195 existing .cancel (false );
196196 }
@@ -293,8 +293,8 @@ private static void processServerEvent(CoreV1Event event) {
293293 }
294294
295295 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 ));
298298 }
299299
300300 /**
@@ -337,9 +337,9 @@ private void onDeleteEvent(@Nonnull String kind, @Nonnull String name, CoreV1Eve
337337
338338 private static String getReadinessStatus (CoreV1Event event ) {
339339 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 );
343343 }
344344
345345 // pre-conditions: DomainPresenceInfo SPI
@@ -379,10 +379,14 @@ private boolean shouldContinue(MakeRightDomainOperation operation, DomainPresenc
379379 final DomainPresenceInfo cachedInfo = getExistingDomainPresenceInfo (liveInfo );
380380 if (isNewDomain (cachedInfo )) {
381381 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 )) {
384387 return false ;
385- } else if (operation .isExplicitRecheck () || liveInfo .isDomainGenerationChanged (cachedInfo )) {
388+ } else if (isExplicitRecheckWithoutRetriableFailure (operation , liveInfo )
389+ || liveInfo .isDomainGenerationChanged (cachedInfo )) {
386390 return true ;
387391 } else {
388392 cachedInfo .setDomain (liveInfo .getDomain ());
@@ -392,7 +396,7 @@ private boolean shouldContinue(MakeRightDomainOperation operation, DomainPresenc
392396
393397 private boolean shouldContinue (MakeRightClusterOperation operation , ClusterPresenceInfo liveInfo ) {
394398 final ClusterPresenceInfo cachedInfo = getExistingClusterPresenceInfo (liveInfo );
395- if (hasDeletedClusterEventData (operation )) {
399+ if (isDeleting (operation )) {
396400 return findClusterPresenceInfo (liveInfo .getNamespace (), liveInfo .getResourceName ());
397401 } else if (isNewCluster (cachedInfo )) {
398402 return true ;
@@ -406,6 +410,15 @@ private boolean shouldContinue(MakeRightClusterOperation operation, ClusterPrese
406410 }
407411 }
408412
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+
409422 private boolean isNewDomain (DomainPresenceInfo cachedInfo ) {
410423 return Optional .ofNullable (cachedInfo ).map (DomainPresenceInfo ::getDomain ).orElse (null ) == null ;
411424 }
@@ -418,11 +431,15 @@ private boolean findClusterPresenceInfo(String namespace, String clusterName) {
418431 return Optional .ofNullable (clusters .get (namespace )).orElse (Collections .emptyMap ()).get (clusterName ) != null ;
419432 }
420433
421- private boolean hasDeletedClusterEventData (MakeRightClusterOperation operation ) {
434+ private boolean isDeleting (MakeRightClusterOperation operation ) {
422435 return EventItem .CLUSTER_DELETED == getEventItem (operation );
423436 }
424437
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 ) {
426443 return Optional .ofNullable (operation .getEventData ()).map (EventData ::getItem ).orElse (null );
427444 }
428445
@@ -454,8 +471,8 @@ public void scheduleDomainStatusUpdates(DomainPresenceInfo info) {
454471 @ Override
455472 public void registerDomainPresenceInfo (DomainPresenceInfo info ) {
456473 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 );
459476 }
460477
461478 @ Override
@@ -522,22 +539,22 @@ public void reportSuspendedFibers() {
522539 if (LOGGER .isFineEnabled ()) {
523540 BiConsumer <String , FiberGate > consumer =
524541 (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+ }));
531548 makeRightFiberGates .forEach (consumer );
532549 statusFiberGates .forEach (consumer );
533550 }
534551 }
535552
536553 private String getDomainUid (Fiber fiber ) {
537554 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 ("" );
541558 }
542559
543560 /**
@@ -622,10 +639,9 @@ private void processIntrospectorJobPodWatch(@Nonnull V1Pod pod, String watchType
622639 @ Override
623640 public void updateDomainStatus (@ Nonnull V1Pod pod , DomainPresenceInfo info ) {
624641 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 ));
626643 }
627644
628-
629645 /* Recently, we've seen a number of intermittent bugs where K8s reports
630646 * outdated watch events. There seem to be two main cases: 1) a DELETED
631647 * event for a resource that was deleted, but has since been recreated, and 2)
@@ -677,7 +693,7 @@ public void dispatchPodDisruptionBudgetWatch(Watch.Response<V1PodDisruptionBudge
677693 }
678694
679695 DomainPresenceInfo info =
680- getExistingDomainPresenceInfo (getPDBNamespace (pdb ), domainUid );
696+ getExistingDomainPresenceInfo (getPDBNamespace (pdb ), domainUid );
681697 if (info == null ) {
682698 return ;
683699 }
@@ -718,7 +734,7 @@ public void dispatchConfigMapWatch(Watch.Response<V1ConfigMap> item) {
718734 case DELETED :
719735 delegate .runSteps (
720736 ConfigMapHelper .createScriptConfigMapStep (
721- c .getMetadata ().getNamespace (), productVersion ));
737+ c .getMetadata ().getNamespace (), productVersion ));
722738 break ;
723739
724740 case ERROR :
@@ -993,7 +1009,7 @@ private void reportFailure(Throwable throwable) {
9931009 logThrowable (throwable );
9941010 runFailureSteps (throwable );
9951011 }
996-
1012+
9971013 private void runFailureSteps (Throwable throwable ) {
9981014 gate .startNewFiberIfCurrentFiberMatches (
9991015 ((DomainPresenceInfo )presenceInfo ).getDomainUid (),
@@ -1042,7 +1058,7 @@ private void scheduleRetry(@Nonnull DomainPresenceInfo domainPresenceInfo) {
10421058 final MakeRightDomainOperation retry = operation .createRetry (domainPresenceInfo );
10431059 gate .getExecutor ().schedule (retry ::execute , delayUntilNextRetry (domainPresenceInfo ), TimeUnit .SECONDS );
10441060 }
1045-
1061+
10461062 private long delayUntilNextRetry (@ Nonnull DomainPresenceInfo domainPresenceInfo ) {
10471063 final OffsetDateTime nextRetryTime = domainPresenceInfo .getDomain ().getNextRetryTime ();
10481064 final Duration interval = Duration .between (SystemClock .now (), nextRetryTime );
0 commit comments