mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
ACS-6168: Add 5 retries when retrieving the temp directory to deal with clashes when high load is applied immediatelly at startup
This commit is contained in:
parent
19feada1a6
commit
ab7058870d
@ -271,12 +271,16 @@ public class FileManager
|
|||||||
|
|
||||||
final File systemTempDir = new File(systemTempDirPath);
|
final File systemTempDir = new File(systemTempDirPath);
|
||||||
final File tempDir = new File(systemTempDir, dirName);
|
final File tempDir = new File(systemTempDir, dirName);
|
||||||
if (!tempDir.exists() && !tempDir.mkdirs() && !tempDir.exists())
|
|
||||||
{
|
int retrieveTempDirAttemptLimit = 5;
|
||||||
throw new RuntimeException("Failed to create temp directory: " + tempDir);
|
for (int i = 0; i < retrieveTempDirAttemptLimit; i++) {
|
||||||
|
if (tempDir.exists() || tempDir.mkdirs())
|
||||||
|
{
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempDir;
|
throw new RuntimeException("Failed to create temp directory: " + tempDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,12 +230,16 @@ public class FileManager
|
|||||||
|
|
||||||
final File systemTempDir = new File(systemTempDirPath);
|
final File systemTempDir = new File(systemTempDirPath);
|
||||||
final File tempDir = new File(systemTempDir, dirName);
|
final File tempDir = new File(systemTempDir, dirName);
|
||||||
if (!tempDir.exists() && !tempDir.mkdirs())
|
|
||||||
{
|
int retrieveTempDirAttemptLimit = 5;
|
||||||
throw new RuntimeException("Failed to create temp directory: " + tempDir);
|
for (int i = 0; i < retrieveTempDirAttemptLimit; i++) {
|
||||||
|
if (tempDir.exists() || tempDir.mkdirs())
|
||||||
|
{
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempDir;
|
throw new RuntimeException("Failed to create temp directory: " + tempDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user