|
67 | 67 | * a known suffix), composed with the default {@link AcceptOnceFileListFilter}
|
68 | 68 | * would allow for this.
|
69 | 69 | * <p>
|
| 70 | + * If a external {@link DirectoryScanner} is used, then the {@link FileLocker} |
| 71 | + * and {@link FileListFilter} objects should be set on the external |
| 72 | + * {@link DirectoryScanner}, not the instance of FileReadingMessageSource. An |
| 73 | + * {@link IllegalStateException} will result otherwise. |
| 74 | + * <p> |
70 | 75 | * A {@link Comparator} can be used to ensure internal ordering of the Files in
|
71 | 76 | * a {@link PriorityBlockingQueue}. This does not provide the same guarantees as
|
72 | 77 | * a {@link ResequencingMessageGroupProcessor}, but in cases where writing files
|
|
80 | 85 | * @author Oleg Zhurakousky
|
81 | 86 | * @author Gary Russell
|
82 | 87 | * @author Artem Bilan
|
| 88 | + * @author Steven Pearce |
83 | 89 | */
|
84 | 90 | public class FileReadingMessageSource extends AbstractMessageSource<File>
|
85 | 91 | implements Lifecycle {
|
@@ -334,8 +340,10 @@ protected void onInit() {
|
334 | 340 | this.scanner = new WatchServiceDirectoryScanner();
|
335 | 341 | }
|
336 | 342 |
|
| 343 | + // Check that the filter and locker options are _NOT_ set if an external scanner has been set. |
| 344 | + // The external scanner is responsible for the filter and locker options in that case. |
337 | 345 | Assert.state(!(this.scannerExplicitlySet && (this.filter != null || this.locker != null)),
|
338 |
| - "The 'filter' and 'locker' options must be present on the provided external 'scanner': " |
| 346 | + "When using an external scanner the 'filter' and 'locker' options should not be used. Instead, set these options on the external DirectoryScanner: " |
339 | 347 | + this.scanner);
|
340 | 348 | if (this.filter != null) {
|
341 | 349 | this.scanner.setFilter(this.filter);
|
|
0 commit comments