diff options
author | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-03-20 06:02:06 +0000 |
---|---|---|
committer | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-03-20 06:02:06 +0000 |
commit | 231f8bfb92f8c9bfcbeae2890511dae28936a9b4 (patch) | |
tree | 90ca09fa2b0a7f4dad044a03a1bd4b14f70bdc0f /Tools/Java/Source | |
parent | 55c30c85e0b0f1c7aedf97a024fe9cff20aa7c69 (diff) | |
download | edk2-231f8bfb92f8c9bfcbeae2890511dae28936a9b4.zip edk2-231f8bfb92f8c9bfcbeae2890511dae28936a9b4.tar.gz edk2-231f8bfb92f8c9bfcbeae2890511dae28936a9b4.tar.bz2 |
Create more threads to synchronize pcd data for FrameworkModules in a platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2489 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source')
2 files changed, 71 insertions, 28 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 4bca7fe..c5f854a 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -494,7 +494,7 @@ public class FpdFileContents { return dataModified;
}
- private void maintainDynPcdMap(String pcdKey, String moduleInfo) {
+ private synchronized void maintainDynPcdMap(String pcdKey, String moduleInfo) {
ArrayList<String> al = dynPcdMap.get(pcdKey);
if (al == null) {
@@ -1318,7 +1318,7 @@ public class FpdFileContents { return choosedType;
}
- private void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal,
+ private synchronized void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal,
ModuleSADocument.ModuleSA moduleSa, PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd)
throws PcdItemTypeConflictException, PcdValueMalFormed{
if (moduleSa.getPcdBuildDefinition() == null){
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 902c12a..b8eb8c6 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -59,6 +59,8 @@ public class FpdFrameworkModules extends IInternalFrame { private static final int timeToWait = 2000;
+ private static final int pcdSyncThreadNumber = 10;
+
private long savedMs = 0;
String searchField = "";
@@ -838,9 +840,11 @@ public class FpdFrameworkModules extends IInternalFrame { private class PcdSyncTask extends Thread {
+ boolean pcdSynced = false;
public void run () {
Vector<String> vExceptions = new Vector<String>();
- if (pcdSync(vExceptions)) {
+ pcdSync(vExceptions);
+ if (pcdSynced) {
JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files.");
docConsole.setSaved(false);
}
@@ -852,6 +856,70 @@ public class FpdFrameworkModules extends IInternalFrame { JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);
}
}
+
+ private void pcdSync(Vector<String> v) {
+
+ Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();
+ int moduleCount = jTableFpdModules.getRowCount();
+ int start = 0;
+ for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
+ int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber;
+ if (end > moduleCount) {
+ end = moduleCount;
+ }
+ vThreads.add(new PcdSyncSubTask (start, end, v));
+ start = end;
+ }
+
+ for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
+ vThreads.get(i).start();
+ }
+
+ try {
+ for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
+ vThreads.get(i).join();
+ }
+ }
+ catch (InterruptedException e) {
+
+ }
+
+ }
+
+ private class PcdSyncSubTask extends Thread {
+
+ private int startModule = 0;
+ private int endModulePlusOne = 1;
+ private Vector<String> v = null;
+
+ PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {
+ startModule = start;
+ endModulePlusOne = endPlusOne;
+ v = vErr;
+ }
+
+ public void run () {
+ String[] sa = new String[5];
+ for (int i = startModule; i < endModulePlusOne; ++i) {
+ try {
+ ffc.getFrameworkModuleInfo(i, sa);
+ String mg = sa[ffcModGuid];
+ String mv = sa[ffcModVer];
+ String pg = sa[ffcPkgGuid];
+ String pv = sa[ffcPkgVer];
+ String arch = sa[ffcModArch];
+ String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;
+ if (ffc.adjustPcd(key, v)) {
+ pcdSynced = true;
+ }
+ }
+ catch (Exception exp) {
+// JOptionPane.showMessageDialog(frame, exp.getMessage());
+ continue;
+ }
+ }
+ }
+ }
}
/**
@@ -937,31 +1005,6 @@ public class FpdFrameworkModules extends IInternalFrame { }
- private boolean pcdSync(Vector<String> v) {
- boolean synced = false;
- String[] sa = new String[5];
- for (int i = 0; i < jTableFpdModules.getRowCount(); ++i) {
- try {
- ffc.getFrameworkModuleInfo(i, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (ffc.adjustPcd(key, v)) {
- synced = true;
- }
- }
- catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
- continue;
- }
- }
- return synced;
-
- }
-
private void showAllModules() {
if (miList == null) {
|