Skip to content

Commit

Permalink
Synchronize RemoteFileUtils.makeDirectories()
Browse files Browse the repository at this point in the history
https://stackoverflow.com/questions/55918648

Avoid the race with concurrent threads.

**cherry-pick to 5.x.x, 4.3.x**

(cherry picked from commit 130e1bb)
  • Loading branch information
garyrussell authored and artembilan committed Apr 30, 2019
1 parent e465a9b commit bcf5929
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
*/
public final class RemoteFileUtils {

private RemoteFileUtils() { }
private RemoteFileUtils() {
super();
}

/**
* Recursively create remote directories.
Expand All @@ -43,8 +45,8 @@ private RemoteFileUtils() { }
* @param logger The logger.
* @throws IOException Any IOException.
*/
public static <F> void makeDirectories(String path, Session<F> session, String remoteFileSeparator, Log logger)
throws IOException {
public static synchronized <F> void makeDirectories(String path, Session<F> session, String remoteFileSeparator,
Log logger) throws IOException {

if (!session.exists(path)) {

Expand Down

0 comments on commit bcf5929

Please sign in to comment.