GH-177: Create SMB files only in the SHARE_READ

Fixes spring-projects/spring-integration-extensions#177

* To avoid partial read, when other process may open the file and start
to write, it would be better to open SMB files in the `FILE_SHARE_READ`
mode.
This way only one process can write the file, when all of them can read
it
This commit is contained in:
Artem Bilan
2018-04-26 11:07:28 -04:00
parent 84b8c516b5
commit d9381460b2

View File

@@ -458,7 +458,7 @@ public class SmbSession implements Session<SmbFile> {
return this.smbShare;
}
SmbFile smbFile = new SmbFile(this.smbShare, cleanedPath);
SmbFile smbFile = new SmbFile(this.smbShare, cleanedPath, SmbFile.FILE_SHARE_READ);
boolean appendFileSeparator = !cleanedPath.endsWith(SMB_FILE_SEPARATOR);
if (appendFileSeparator) {