Author: jacopoc
Date: Mon Jul 16 09:54:27 2012
New Revision: 1361955
URL:
http://svn.apache.org/viewvc?rev=1361955&view=revLog:
Minor change to use the Runtime class to get the number of processors rather than MxBeans.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=1361955&r1=1361954&r2=1361955&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java Mon Jul 16 09:54:27 2012
@@ -18,7 +18,7 @@
*******************************************************************************/
package org.ofbiz.base.concurrent;
-import java.lang.management.ManagementFactory;
+import java.lang.Runtime;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -78,7 +78,7 @@ public final class ExecutionPool {
if (threadCount == 0) {
threadCount = 1;
} else if (threadCount < 0) {
- int numCpus = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
+ int numCpus = Runtime.getRuntime().availableProcessors();
threadCount = Math.abs(threadCount) * numCpus;
}
ThreadFactory threadFactory = createThreadFactory(group, namePrefix);
@@ -134,7 +134,7 @@ public final class ExecutionPool {
static {
ExecutionPoolPulseWorker worker = new ExecutionPoolPulseWorker();
- int processorCount = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
+ int processorCount = Runtime.getRuntime().availableProcessors();
for (int i = 0; i < processorCount; i++) {
Thread t = new Thread(worker);
t.setDaemon(true);
Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java?rev=1361955&r1=1361954&r2=1361955&view=diff==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java Mon Jul 16 09:54:27 2012
@@ -26,7 +26,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.lang.management.ManagementFactory;
+import java.lang.Runtime;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.List;
@@ -73,7 +73,7 @@ public final class InstrumenterWorker {
} catch (ClassNotFoundException e) {
return srcPaths;
}
- ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors());
+ ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors());
try {
File instrumenterFile = new File(instrumenterFileName);
instrumenterFile.delete();