@@ -71,20 +71,17 @@ public int compareTo(SystemMetrics that) {
71
71
* @return score
72
72
*/
73
73
public int calculateScore () {
74
-
75
- if (score > 0 ) {
76
- return score ;
77
- }
78
-
79
- // Memory is vital to TaskTracker, so we set the multiplier factor as 2.
80
- double memScore = (jvmMaxMemory - jvmUsedMemory ) * 2 ;
81
- // Calculate the remaining load of CPU. Multiplier is set as 1.
82
- double cpuScore = cpuProcessors - cpuLoad ;
83
- // Windows can not fetch CPU load, set cpuScore as 1.
84
- if (cpuScore > cpuProcessors ) {
85
- cpuScore = 1 ;
74
+ if (score > 0 ) {
75
+ return score ;
76
+ }
77
+ // Memory is vital to TaskTracker, so we set the multiplier factor as 2.
78
+ double memScore = (jvmMaxMemory - jvmUsedMemory ) * 2 ;
79
+ // Calculate the remaining load of CPU. Multiplier is set as 1.
80
+ double cpuScore = cpuProcessors - cpuLoad ;
81
+ // Windows can not fetch CPU load, set cpuScore as 1.
82
+ if (cpuScore > cpuProcessors ) {
83
+ cpuScore = 1 ;
86
84
}
87
-
88
85
score = (int ) (memScore + cpuScore );
89
86
return score ;
90
87
}
@@ -93,8 +90,8 @@ public int calculateScore() {
93
90
* Judge if the machine is available.
94
91
*
95
92
* @param minCPUCores Minimum available CPU cores.
96
- * @param minMemorySpace 判断标准之最低可用内存
97
- * @param minDiskSpace Minimum disk space 判断标准之最低可用磁盘空间
93
+ * @param minMemorySpace Minimum available memory size
94
+ * @param minDiskSpace Minimum disk space
98
95
* @return {@code boolean} whether the machine is available.
99
96
*/
100
97
public boolean available (double minCPUCores , double minMemorySpace , double minDiskSpace ) {
@@ -106,8 +103,8 @@ public boolean available(double minCPUCores, double minMemorySpace, double minDi
106
103
return false ;
107
104
}
108
105
109
- // Negative number means being unable to fetch CPU info, return true.
110
106
// 0 indicates the CPU is free, which is the optimal condition.
107
+ // Negative number means being unable to fetch CPU info, return true.
111
108
if (cpuLoad <= 0 || minCPUCores <= 0 ) {
112
109
return true ;
113
110
}
0 commit comments