From 52147b7e51c1cf83a487f1906bd412497a64807c Mon Sep 17 00:00:00 2001 From: mstrankowski Date: Thu, 26 Oct 2023 13:51:17 +0200 Subject: [PATCH] Revert "ACS-6168: Add 5 retries when retrieving the temp directory to deal with clashes when high load is applied immediatelly at startup" This reverts commit ab7058870d2da3a8a10300c4ddba22b5c16fe9a5. --- .../org/alfresco/transformer/fs/FileManager.java | 12 ++++-------- .../org/alfresco/transform/base/fs/FileManager.java | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java index c964276a3..dbc9c50ea 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java @@ -271,16 +271,12 @@ private static File getTempDir() final File systemTempDir = new File(systemTempDirPath); final File tempDir = new File(systemTempDir, dirName); - - int retrieveTempDirAttemptLimit = 5; - for (int i = 0; i < retrieveTempDirAttemptLimit; i++) { - if (tempDir.exists() || tempDir.mkdirs()) - { - return tempDir; - } + if (!tempDir.exists() && !tempDir.mkdirs() && !tempDir.exists()) + { + throw new RuntimeException("Failed to create temp directory: " + tempDir); } - throw new RuntimeException("Failed to create temp directory: " + tempDir); + return tempDir; } } } diff --git a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java index e525ab05e..b5cf4f37b 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java @@ -230,16 +230,12 @@ private static File getTempDir() final File systemTempDir = new File(systemTempDirPath); final File tempDir = new File(systemTempDir, dirName); - - int retrieveTempDirAttemptLimit = 5; - for (int i = 0; i < retrieveTempDirAttemptLimit; i++) { - if (tempDir.exists() || tempDir.mkdirs()) - { - return tempDir; - } + if (!tempDir.exists() && !tempDir.mkdirs()) + { + throw new RuntimeException("Failed to create temp directory: " + tempDir); } - throw new RuntimeException("Failed to create temp directory: " + tempDir); + return tempDir; } } }