2 Replies Latest reply on Apr 29, 2008 12:15 PM by Mathieu Pasture

    Double processing of FTP files

    Mathieu Pasture Newbie


      I have a problem with the FTP gateway running in a cluster environment. On some specific circumstances my ftp files are processed twice. If I upload several files together and two schedulers are running in a short period of time, here is what I see:

      Node 1 : retrieves the list of file to process -> [F1, F2]
      Node 1 : renames F1 to F1.esbWorking and starts processing
      Node 2 : retrieves the list of file to process -> [F2]
      Node 2 : renames F2 to F2.esbWorking and starts processing
      Node 1 : tries to rename F1 and fail but the file F1.esbWorking exists therefor is able to download it and process it.

      it looks like the erroneous code is from AbstractFileGateway.java:

      private File setFileWorking(File file) {
      File workingFile = getWorkFileName(file, _workingSuffix);

      try {
      if (!renameFile(file, workingFile)) {
      return null;
      } catch (GatewayException e) {
      _logger.error("Problems renaming file " + file + " to " + workingFile);

      return workingFile;

      I guess the easy fix would be to return null in the catch