Skip to content

Commit

Permalink
Randomize naming for createVolumeDirectory method (#4195)
Browse files Browse the repository at this point in the history
Also marks createVolumeDirectory method as deprecated


Co-authored-by: Richard North <[email protected]>
  • Loading branch information
johnathana and rnorth authored Sep 23, 2021
1 parent 4dd0872 commit b88d136
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -647,8 +648,9 @@ protected Logger logger() {
* @param temporary is the volume directory temporary? If true, the directory will be deleted on JVM shutdown.
* @return path to the volume directory
*/
@Deprecated
protected Path createVolumeDirectory(boolean temporary) {
Path directory = new File(".tmp-volume-" + System.currentTimeMillis()).toPath();
Path directory = new File(".tmp-volume-" + UUID.randomUUID()).toPath();
PathUtils.mkdirp(directory);

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

0 comments on commit b88d136

Please sign in to comment.