Fix race condition for FluxMessageChannelTests
The logic in the `FluxMessageChannelTests.testFluxMessageChannelCleanUp()` relies on the `finishLatch.countDown()` which happens before we release the lock for a group in the aggregator. So, when we call a `destroy()` as the next statement, we interrupt the lock instead of unlocking. This cause a race condition in the Reactor's `Sink` to terminate properly * Expose `CorrelationHandlerSpec.releaseLockBeforeSend()` and set it to `true` in the test to properly unlock before we call `finishLatch.countDown()` * Deprecate a couple introduced before options in favor of their variants with `set` prefix * Fix new Sonar smells
This commit is contained in:
@@ -100,14 +100,11 @@ public class CompositeFileListFilter<F>
|
||||
}
|
||||
|
||||
/**
|
||||
* Not thread safe. Only a single thread may add filters at a time.
|
||||
* <p>
|
||||
* Add the new filters to this CompositeFileListFilter while maintaining the existing filters.
|
||||
*
|
||||
* @param filtersToAdd a list of filters to add
|
||||
* @return this CompositeFileListFilter instance with the added filters
|
||||
*/
|
||||
public CompositeFileListFilter<F> addFilters(Collection<? extends FileListFilter<F>> filtersToAdd) {
|
||||
public synchronized CompositeFileListFilter<F> addFilters(Collection<? extends FileListFilter<F>> filtersToAdd) {
|
||||
for (FileListFilter<F> elf : filtersToAdd) {
|
||||
if (elf instanceof DiscardAwareFileListFilter) {
|
||||
((DiscardAwareFileListFilter<F>) elf).addDiscardCallback(this.discardCallback);
|
||||
@@ -120,7 +117,7 @@ public class CompositeFileListFilter<F>
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
this.allSupportAccept &= elf.supportsSingleFileFiltering();
|
||||
this.allSupportAccept = this.allSupportAccept && elf.supportsSingleFileFiltering();
|
||||
this.oneIsForRecursion |= elf.isForRecursion();
|
||||
}
|
||||
this.fileFilters.addAll(filtersToAdd);
|
||||
|
||||
@@ -1005,10 +1005,8 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
if (recursion && StringUtils.hasText(subDirectory)) {
|
||||
fileToAdd = enhanceNameWithSubDirectory(file, subDirectory);
|
||||
}
|
||||
if (this.filterAfterEnhancement) {
|
||||
if (!this.filter.accept(fileToAdd)) {
|
||||
return;
|
||||
}
|
||||
if (this.filterAfterEnhancement && !this.filter.accept(fileToAdd)) {
|
||||
return;
|
||||
}
|
||||
String fileName = getFilename(fileToAdd);
|
||||
final boolean isDirectory = isDirectory(file);
|
||||
@@ -1020,8 +1018,8 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
}
|
||||
|
||||
if (recursion && isDirectory && !isDots) {
|
||||
lsFiles.addAll(listFilesInRemoteDir(session, directory, fileName +
|
||||
this.remoteFileTemplate.getRemoteFileSeparator()));
|
||||
lsFiles.addAll(listFilesInRemoteDir(session, directory,
|
||||
fileName + this.remoteFileTemplate.getRemoteFileSeparator()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user