Skip to content

Commit c2dc92c

Browse files
ehennumehennum
authored andcommitted
correction to test for forest difference #999
1 parent 6a6eb89 commit c2dc92c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/HostAvailabilityListener.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,17 @@ private boolean processGatewayException(Batcher batcher, Throwable throwable, St
237237
if ( isRetryException == true ) {
238238
ForestConfiguration existingForestConfig = batcher.getForestConfig();
239239
Forest[] existingForests = existingForestConfig.listForests();
240-
Set<String> existingNames =
241-
Arrays.stream(existingForests).map(Forest::getForestName).collect(Collectors.toSet());
242240
ForestConfiguration updatedForestConfig = moveMgr.readForestConfig();
243241
Forest[] updatedForests = updatedForestConfig.listForests();
244-
boolean changedForests =
245-
Arrays.stream(updatedForests).anyMatch(forest -> existingNames.contains(forest.getForestName()));
246-
if (changedForests) {
242+
boolean forestsChanged = (existingForests.length != updatedForests.length);
243+
if (!forestsChanged) {
244+
Set<String> existingNames = Arrays.stream(existingForests)
245+
.map(Forest::getForestName)
246+
.collect(Collectors.toSet());
247+
forestsChanged = Arrays.stream(updatedForests)
248+
.anyMatch(forest -> !existingNames.contains(forest.getForestName()));
249+
}
250+
if (forestsChanged) {
247251
batcher.withForestConfig(updatedForestConfig);
248252
shouldWeRetry = true;
249253
} else {

0 commit comments

Comments
 (0)