diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSychronizer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSychronizer.java index e8b28e2923..ea2c3c79cb 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSychronizer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSychronizer.java @@ -132,7 +132,7 @@ public abstract class AbstractInboundRemoteFileSystemSychronizer extends Abst /** * This is the callback where we need the implementation to do some specific work */ - protected abstract void syncRemoteToLocalFileSystem() throws Exception; + protected abstract void syncRemoteToLocalFileSystem(); /** diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSynchronizingMessageSource.java b/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSynchronizingMessageSource.java index 2ab8799cda..3e41d3564c 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSynchronizingMessageSource.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/synchronization/AbstractInboundRemoteFileSystemSynchronizingMessageSource.java @@ -148,8 +148,18 @@ public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource< } } - public Message receive() { - return this.fileSource.receive(); + /** + * Polls from the file source. If the result is not null, it will be returned. + * If the result is null, it attempts to sync up with the remote directory to populate the file source. + * Then, it polls the file source again and returns the result, whether or not it is null. + */ + public final Message receive() { + Message message = this.fileSource.receive(); + if (message == null) { + this.synchronizer.syncRemoteToLocalFileSystem(); + message = this.fileSource.receive(); + } + return message; } @SuppressWarnings("unchecked") diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizer.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizer.java index 60f4e98ad9..b22bf7a33b 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizer.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizer.java @@ -89,7 +89,7 @@ public class FtpInboundRemoteFileSystemSynchronizer extends AbstractInboundRemot throw (RuntimeException)th; } else { - throw new MessagingException("Failed to compy file", th); + throw new MessagingException("Failed to copy file", th); } } finally { diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizingMessageSource.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizingMessageSource.java index 7503ad1a2a..86169619b7 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizingMessageSource.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/inbound/FtpInboundRemoteFileSystemSynchronizingMessageSource.java @@ -49,12 +49,12 @@ public class FtpInboundRemoteFileSystemSynchronizingMessageSource @Override protected void doStart() { - this.synchronizer.start(); + //this.synchronizer.start(); } @Override protected void doStop() { - this.synchronizer.stop(); + //this.synchronizer.stop(); } } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundSynchronizingMessageSource.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundSynchronizingMessageSource.java index f2be0b3976..554bdd6cd3 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundSynchronizingMessageSource.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundSynchronizingMessageSource.java @@ -16,11 +16,9 @@ package org.springframework.integration.sftp.inbound; -import java.io.File; import java.io.FileNotFoundException; import java.util.regex.Pattern; -import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.file.FileReadingMessageSource; import org.springframework.integration.file.synchronization.AbstractInboundRemoteFileSystemSynchronizingMessageSource; @@ -49,20 +47,6 @@ public class SftpInboundSynchronizingMessageSource return "sftp:inbound-channel-adapter"; } - public Message receive() { - /* - * Poll from the file source. If the result is not null, return it. - * If the result is null, attempt to sync up with remote directory to populate the file source. - * Then, poll on the file source again and return the result, whether or not it is null. - */ - Message message = this.fileSource.receive(); - if (message == null) { - this.synchronizer.syncRemoteToLocalFileSystem(); - message = this.fileSource.receive(); - } - return message; - } - @Override protected void onInit() { try {