@@ -159,7 +159,7 @@ private void addOperatorEventList(CoreV1EventList list) {
159
159
private void addPod (V1Pod pod ) {
160
160
String domainUid = PodHelper .getPodDomainUid (pod );
161
161
String serverName = PodHelper .getPodServerName (pod );
162
- DomainPresenceInfo info = getExistingDomainPresenceInfo (domainUid );
162
+ DomainPresenceInfo info = getOrComputeDomainPresenceInfo (domainUid );
163
163
Optional .ofNullable (info ).ifPresent (i -> i .addServerNameFromPodList (serverName ));
164
164
165
165
if (domainUid != null && serverName != null ) {
@@ -178,10 +178,6 @@ private DomainPresenceInfo getOrComputeDomainPresenceInfo(String domainUid) {
178
178
return getDomainPresenceInfoMap ().computeIfAbsent (domainUid , k -> new DomainPresenceInfo (namespace , domainUid ));
179
179
}
180
180
181
- private DomainPresenceInfo getExistingDomainPresenceInfo (String domainUid ) {
182
- return getDomainPresenceInfoMap ().get (domainUid );
183
- }
184
-
185
181
private Map <String , DomainPresenceInfo > getDomainPresenceInfoMap () {
186
182
return processor .getDomainPresenceInfoMap ().computeIfAbsent (namespace , k -> new ConcurrentHashMap <>());
187
183
}
@@ -197,7 +193,7 @@ private void addServiceList(V1ServiceList list) {
197
193
private void addService (V1Service service ) {
198
194
String domainUid = ServiceHelper .getServiceDomainUid (service );
199
195
if (domainUid != null ) {
200
- ServiceHelper .addToPresence (getExistingDomainPresenceInfo (domainUid ), service );
196
+ ServiceHelper .addToPresence (getOrComputeDomainPresenceInfo (domainUid ), service );
201
197
}
202
198
}
203
199
@@ -208,7 +204,7 @@ private void addPodDisruptionBudgetList(V1PodDisruptionBudgetList list) {
208
204
private void addPodDisruptionBudget (V1PodDisruptionBudget pdb ) {
209
205
String domainUid = PodDisruptionBudgetHelper .getDomainUid (pdb );
210
206
if (domainUid != null ) {
211
- PodDisruptionBudgetHelper .addToPresence (getExistingDomainPresenceInfo (domainUid ), pdb );
207
+ PodDisruptionBudgetHelper .addToPresence (getOrComputeDomainPresenceInfo (domainUid ), pdb );
212
208
}
213
209
}
214
210
@@ -236,7 +232,8 @@ private void addDomain(DomainResource domain) {
236
232
DomainPresenceInfo cachedInfo = getDomainPresenceInfoMap ().get (domain .getDomainUid ());
237
233
if (domain .getStatus () == null ) {
238
234
newDomainNames .add (domain .getDomainUid ());
239
- } else if (cachedInfo != null && domain .isGenerationChanged (cachedInfo .getDomain ())) {
235
+ } else if (cachedInfo != null && cachedInfo .getDomain () != null
236
+ && domain .isGenerationChanged (cachedInfo .getDomain ())) {
240
237
modifiedDomainNames .add (domain .getDomainUid ());
241
238
}
242
239
getOrComputeDomainPresenceInfo (domain .getDomainUid ()).setDomain (domain );
0 commit comments