From 94d3d82aabf6372c2d4950ea2f4f5c0d6b5774a6 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 9 Nov 2005 18:22:00 +0000 Subject: [PATCH] more changes to avoid dmalloc reporting leaks --- bindings/java/src/net/hyperic/sigar/test/SigarTestCase.java | 1 + bindings/java/src/net/hyperic/sigar/test/TestCpu.java | 4 +--- bindings/java/src/net/hyperic/sigar/test/TestPTQL.java | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/test/SigarTestCase.java b/bindings/java/src/net/hyperic/sigar/test/SigarTestCase.java index 59547798..a5c3a3cd 100644 --- a/bindings/java/src/net/hyperic/sigar/test/SigarTestCase.java +++ b/bindings/java/src/net/hyperic/sigar/test/SigarTestCase.java @@ -55,6 +55,7 @@ public abstract class SigarTestCase extends TestCase { public static void closeSigar() { if (sigar != null) { sigar.close(); + sigar = null; } } diff --git a/bindings/java/src/net/hyperic/sigar/test/TestCpu.java b/bindings/java/src/net/hyperic/sigar/test/TestCpu.java index ce112351..e31dea04 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestCpu.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestCpu.java @@ -2,7 +2,6 @@ package net.hyperic.sigar.test; import net.hyperic.sigar.Sigar; import net.hyperic.sigar.SigarNotImplementedException; -import net.hyperic.sigar.SigarProxy; import net.hyperic.sigar.Cpu; public class TestCpu extends SigarTestCase { @@ -29,8 +28,7 @@ public class TestCpu extends SigarTestCase { } public void testCreate() throws Exception { - SigarProxy sigar = Sigar.getInstance(); //test reuse - + Sigar sigar = getSigar(); Cpu cpu = sigar.getCpu(); traceln("getCpu:"); diff --git a/bindings/java/src/net/hyperic/sigar/test/TestPTQL.java b/bindings/java/src/net/hyperic/sigar/test/TestPTQL.java index 6b9424fa..1af3ff14 100644 --- a/bindings/java/src/net/hyperic/sigar/test/TestPTQL.java +++ b/bindings/java/src/net/hyperic/sigar/test/TestPTQL.java @@ -2,7 +2,7 @@ package net.hyperic.sigar.test; import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarProxy; -import net.hyperic.sigar.SynchronizedSigarProxyCache; +import net.hyperic.sigar.SigarProxyCache; import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.ptql.ProcessQuery; @@ -140,7 +140,8 @@ public class TestPTQL extends SigarTestCase { } public void testCreate() throws Exception { - SigarProxy proxy = SynchronizedSigarProxyCache.getInstance(); + SigarProxy proxy = + SigarProxyCache.newInstance(getSigar()); testOK(proxy); testMalformed(proxy);