Skip to content

Commit cd16a25

Browse files
committed
Avoid UUID.randomUUID() in startup code
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
1 parent 35444ab commit cd16a25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

vertx-core/src/main/java/io/vertx/core/file/impl/FileCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static File setupCacheDir(String fileCacheDir) {
4545

4646
// the cacheDir will be suffixed a unique id to avoid eavesdropping from other processes/users
4747
// also this ensures that if process A deletes cacheDir, it won't affect process B
48-
String cacheDirName = fileCacheDir + "-" + UUID.randomUUID();
48+
String cacheDirName = fileCacheDir + "-" + System.nanoTime();
4949
File cacheDir = new File(cacheDirName);
5050
// Create the cache directory
5151
try {

vertx-core/src/main/java/io/vertx/core/impl/deployment/DefaultDeploymentManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public DefaultDeploymentManager(VertxImpl vertx) {
3636
}
3737

3838
private String generateDeploymentID() {
39-
return UUID.randomUUID().toString();
39+
return Long.valueOf(System.nanoTime()).toString();
4040
}
4141

4242
public Future<Void> undeploy(String deploymentID) {

0 commit comments

Comments
 (0)