diff options
author | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-10-11 10:10:16 +0000 |
---|---|---|
committer | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-10-11 10:10:16 +0000 |
commit | 2320bb14977245aaf165bc8b3a62b04390fd9c5f (patch) | |
tree | c46ebb74533f157f4e3ffd90bc25a17380937128 /Tools/Java/Source/FrameworkTasks | |
parent | 5f480cb5e8d562cd44d5d87472d0100b8842ba5e (diff) | |
download | edk2-platforms-2320bb14977245aaf165bc8b3a62b04390fd9c5f.tar.xz |
Added "synchronized" method to create random number in case of multi-thread issue
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1722 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source/FrameworkTasks')
-rw-r--r-- | Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java index fbf69e288d..761a0efab0 100644 --- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java +++ b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java @@ -148,7 +148,7 @@ public class Tool implements EfiDefine, Section { }
try {
- this.outputFileName = "Temp" + ran.nextInt();
+ this.outputFileName = "Temp" + getRand();
argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
+ tempInputFile.toString(" ")+ " -o " + outputFileName;
EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
@@ -164,7 +164,8 @@ public class Tool implements EfiDefine, Section { file.delete();
}
}
- } catch (Exception e) {
EdkLog.log(e.getMessage());
+ } catch (Exception e) {
+ EdkLog.log(e.getMessage());
throw new BuildException("Execution of externalTool task failed!\n");
}
}
@@ -236,7 +237,16 @@ public class Tool implements EfiDefine, Section { public void addGenSection(GenSectionTask genSect){
this.gensectList.add(genSect);
- }
+ }
+
+ /**
+ Get random number.
+
+ @returns The random integer.
+ **/
+ public synchronized int getRand() {
+ return ran.nextInt();
+ }
}
|