Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3089

IGNORE mode outbound-channel-adapter should also check for '.writing' files

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.2.5, 3.0 M3
    • Component/s: File Support
    • Labels:
    • Environment:
      Linux

      Description

      I have configured the following outbound-channel-adapter:

      <int-file:outbound-channel-adapter auto-create-directory="false" directory="${stagingDirectory}" id="stagingFileId" mode="IGNORE"/>
      

      We always run two instances of the same application at the same time for failover purposes. It can happen that both processes try to write a file with the same name at the same time (cron expression) to the same directory. I've added the "IGNORE" flag so that basicially the first one to do the write wins. I've been noticing lately that we are getting some weird exceptions that I can't explain (see forum for logfile).

      I took a look at the code for the outbound-channel-adapter (FileWritingMessageHandler) and saw the following code to determine if it should ignore a file or not when writing:

      final boolean ignore = FileExistsMode.IGNORE.equals(this.fileExistsMode) && resultFile.exists();
      

      but..I had expected the following (that it also checks for the temp '.writing' version of this file):

      final boolean ignore = FileExistsMode.IGNORE.equals(this.fileExistsMode) && ( resultFile.exists() || tempFile.exists());
      

      Issue?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                grussell Gary Russell
                Reporter:
                noeloshea Noel O'Shea
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: