Class SyncManager

  • All Implemented Interfaces:
    ChangeHandler

    public class SyncManager
    extends Object
    implements ChangeHandler
    The SyncManager is responsible to watch for new entries in the ChangedList and make sure those changes are pushed to the SyncEndpoint.
    • Constructor Detail

      • SyncManager

        public SyncManager​(List<File> watchDirs,
                           SyncEndpoint endpoint,
                           int threads,
                           long frequency)
        Creates a SyncManager which, when started, will watch for updates to the ChangedList and kick off SyncWorkers to handle any changed files.
        Parameters:
        endpoint -
        threads -
        frequency -
    • Method Detail

      • beginSync

        public void beginSync()
        Allows the SyncManager to begin watching for updates to the ChangedList
      • endSync

        public void endSync()
        Stops the sync, no further changed files will be handled after those which are in progress have completed.
      • terminateSync

        public void terminateSync()
      • handleChangedFile

        public boolean handleChangedFile​(ChangedFile changedFile)
        Notifies the SyncManager that a file has changed
        Specified by:
        handleChangedFile in interface ChangeHandler
        Parameters:
        changedFile - the changed file
      • getWatchDir

        protected File getWatchDir​(File changedFile)