CoderX
CoderX

Reputation: 1022

Alternatives to long polling?

I have an application in JAVA which checks from the ftp server, whether a given file is updated or not. If the file is updated, I download the file again.
I am using long polling to check, whether the file has been modified. So I ping the FTP server every 5 seconds and check whether the modified date of the file is changed or not. If the date is modified, I re-download the file again.
Is there a better way to perform this operation, other than long polling?

Upvotes: 0

Views: 1796

Answers (1)

yamenk
yamenk

Reputation: 51778

In general, there are two approaches for checking for updates.

The first is the one that you mentioned, and that is polling for changes periodically.

The second solution, is to register a "hook" which will be invoked once a specific action is occurs. For example, when pushing to a git repository, you can create a hook to automatically start a build of the source code.

In your case, option two is not applicable. There isn't an obvious way to make the FTP server ping you once the files change.

Upvotes: 1

Related Questions