Skip to content

Commit

Permalink
Avoid UUID.randomUUID() in startup code
Browse files Browse the repository at this point in the history
This is done because bootstrapping the plumbing
needed by the JDK to produce a UUID value
is expensive, it thus doesn't make sense to
pay this cost when the property isn't actually
needed
  • Loading branch information
geoand committed Jan 16, 2025
1 parent 35444ab commit cd16a25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static File setupCacheDir(String fileCacheDir) {

// the cacheDir will be suffixed a unique id to avoid eavesdropping from other processes/users
// also this ensures that if process A deletes cacheDir, it won't affect process B
String cacheDirName = fileCacheDir + "-" + UUID.randomUUID();
String cacheDirName = fileCacheDir + "-" + System.nanoTime();
File cacheDir = new File(cacheDirName);
// Create the cache directory
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public DefaultDeploymentManager(VertxImpl vertx) {
}

private String generateDeploymentID() {
return UUID.randomUUID().toString();
return Long.valueOf(System.nanoTime()).toString();
}

public Future<Void> undeploy(String deploymentID) {
Expand Down

0 comments on commit cd16a25

Please sign in to comment.