@@ -60,14 +60,14 @@ public class DefaultDestinationTopicResolver implements DestinationTopicResolver
60
60
61
61
private final ApplicationContext applicationContext ;
62
62
63
- private boolean containerClosed ;
63
+ private boolean contextRefreshed ;
64
64
65
65
public DefaultDestinationTopicResolver (Clock clock , ApplicationContext applicationContext ) {
66
66
this .applicationContext = applicationContext ;
67
67
this .clock = clock ;
68
68
this .sourceDestinationsHolderMap = new HashMap <>();
69
69
this .destinationsTopicMap = new HashMap <>();
70
- this .containerClosed = false ;
70
+ this .contextRefreshed = false ;
71
71
}
72
72
73
73
@ Override
@@ -127,7 +127,7 @@ private DestinationTopic getDestinationFor(String topic) {
127
127
}
128
128
129
129
private DestinationTopicHolder getDestinationHolderFor (String topic ) {
130
- return this .containerClosed
130
+ return this .contextRefreshed
131
131
? doGetDestinationFor (topic )
132
132
: getDestinationTopicSynchronized (topic );
133
133
}
@@ -145,9 +145,9 @@ private DestinationTopicHolder doGetDestinationFor(String topic) {
145
145
146
146
@ Override
147
147
public void addDestinationTopics (List <DestinationTopic > destinationsToAdd ) {
148
- if (this .containerClosed ) {
148
+ if (this .contextRefreshed ) {
149
149
throw new IllegalStateException ("Cannot add new destinations, "
150
- + DefaultDestinationTopicResolver .class .getSimpleName () + " is already closed ." );
150
+ + DefaultDestinationTopicResolver .class .getSimpleName () + " is already refreshed ." );
151
151
}
152
152
synchronized (this .sourceDestinationsHolderMap ) {
153
153
this .destinationsTopicMap .putAll (destinationsToAdd
@@ -175,13 +175,18 @@ private DestinationTopic getNextDestinationTopic(List<DestinationTopic> destinat
175
175
176
176
@ Override
177
177
public void onApplicationEvent (ContextRefreshedEvent event ) {
178
- if (Objects .equals (event .getApplicationContext (). getId () , this .applicationContext . getId () )) {
179
- this .containerClosed = true ;
178
+ if (Objects .equals (event .getApplicationContext (), this .applicationContext )) {
179
+ this .contextRefreshed = true ;
180
180
}
181
181
}
182
182
183
- public boolean isContainerClosed () {
184
- return this .containerClosed ;
183
+ /**
184
+ * Return true if the application context is refreshed.
185
+ * @return true if refreshed.
186
+ * @since 2.7.8
187
+ */
188
+ public boolean isContextRefreshed () {
189
+ return this .contextRefreshed ;
185
190
}
186
191
187
192
public static class DestinationTopicHolder {
0 commit comments