-Dsigar.ptql.native=true to enable testing native port
This commit is contained in:
parent
fe2125d9af
commit
537863b3c3
@ -23,10 +23,16 @@ import java.util.Comparator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.hyperic.sigar.Sigar;
|
||||||
|
import org.hyperic.sigar.SigarException;
|
||||||
import org.hyperic.sigar.util.ReferenceMap;
|
import org.hyperic.sigar.util.ReferenceMap;
|
||||||
|
|
||||||
public class ProcessQueryFactory implements Comparator {
|
public class ProcessQueryFactory implements Comparator {
|
||||||
|
|
||||||
|
//for testing until native port is completed
|
||||||
|
private static final boolean useNative =
|
||||||
|
"true".equals(System.getProperty("sigar.ptql.native"));
|
||||||
|
|
||||||
private static Map cache =
|
private static Map cache =
|
||||||
ReferenceMap.synchronizedMap();
|
ReferenceMap.synchronizedMap();
|
||||||
|
|
||||||
@ -152,6 +158,17 @@ public class ProcessQueryFactory implements Comparator {
|
|||||||
return pQuery;
|
return pQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useNative) {
|
||||||
|
pQuery = new SigarProcessQuery();
|
||||||
|
try {
|
||||||
|
((SigarProcessQuery)pQuery).create(query);
|
||||||
|
} catch (SigarException e) {
|
||||||
|
throw new MalformedQueryException(e.getMessage());
|
||||||
|
}
|
||||||
|
cache.put(query, pQuery);
|
||||||
|
return pQuery;
|
||||||
|
}
|
||||||
|
|
||||||
if (query.startsWith("Pid.PidFile.") ||
|
if (query.startsWith("Pid.PidFile.") ||
|
||||||
query.startsWith("Pid.Service."))
|
query.startsWith("Pid.Service."))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user