change SynchronizedSigarProxyCache.getInstance to construct the Sigar instance itself
This commit is contained in:
parent
dffe0da855
commit
bca4203db1
|
@ -8,12 +8,12 @@ public class SynchronizedSigarProxyCache
|
||||||
private static Object lock = new Object();
|
private static Object lock = new Object();
|
||||||
private static SigarProxy instance = null;
|
private static SigarProxy instance = null;
|
||||||
|
|
||||||
public static SigarProxy getInstance(Sigar sigar)
|
public static SigarProxy getInstance()
|
||||||
throws SigarException {
|
throws SigarException {
|
||||||
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = SigarProxyCache.newInstance(sigar);
|
instance = SigarProxyCache.newInstance(new Sigar());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,7 @@ public class TestPTQL extends SigarTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
Sigar sigar = new Sigar();
|
SigarProxy proxy = SynchronizedSigarProxyCache.getInstance();
|
||||||
|
|
||||||
SigarProxy proxy =
|
|
||||||
SynchronizedSigarProxyCache.getInstance(sigar);
|
|
||||||
|
|
||||||
traceln("");
|
traceln("");
|
||||||
testOK(proxy);
|
testOK(proxy);
|
||||||
|
|
Loading…
Reference in New Issue