Skip to content

Commit b88d136

Browse files
johnathanarnorth
andauthored
Randomize naming for createVolumeDirectory method (#4195)
Also marks createVolumeDirectory method as deprecated Co-authored-by: Richard North <[email protected]>
1 parent 4dd0872 commit b88d136

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/testcontainers/containers/GenericContainer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
import java.util.Objects;
8989
import java.util.Optional;
9090
import java.util.Set;
91+
import java.util.UUID;
9192
import java.util.concurrent.ExecutionException;
9293
import java.util.concurrent.Future;
9394
import java.util.concurrent.TimeUnit;
@@ -647,8 +648,9 @@ protected Logger logger() {
647648
* @param temporary is the volume directory temporary? If true, the directory will be deleted on JVM shutdown.
648649
* @return path to the volume directory
649650
*/
651+
@Deprecated
650652
protected Path createVolumeDirectory(boolean temporary) {
651-
Path directory = new File(".tmp-volume-" + System.currentTimeMillis()).toPath();
653+
Path directory = new File(".tmp-volume-" + UUID.randomUUID()).toPath();
652654
PathUtils.mkdirp(directory);
653655

654656
if (temporary) Runtime.getRuntime().addShutdownHook(new Thread(DockerClientFactory.TESTCONTAINERS_THREAD_GROUP, () -> {

0 commit comments

Comments
 (0)