more sigar.close for dmalloc

This commit is contained in:
Doug MacEachern 2005-11-09 17:31:16 +00:00
parent 3a822b7d4f
commit aa28742fdd
6 changed files with 15 additions and 1 deletions

View File

@ -20,7 +20,9 @@ import net.hyperic.sigar.shell.ShellCommandHandler;
import net.hyperic.sigar.shell.ShellCommandInitException; import net.hyperic.sigar.shell.ShellCommandInitException;
import net.hyperic.sigar.shell.ShellCommandUsageException; import net.hyperic.sigar.shell.ShellCommandUsageException;
import net.hyperic.sigar.test.SigarTestCase;
import net.hyperic.sigar.test.SigarTestRunner; import net.hyperic.sigar.test.SigarTestRunner;
import net.hyperic.sigar.util.Getline; import net.hyperic.sigar.util.Getline;
/** /**
@ -166,6 +168,7 @@ public class Shell extends ShellBase {
public void shutdown() { public void shutdown() {
this.sigar.close(); this.sigar.close();
SigarTestCase.closeSigar(); //shutup dmalloc
super.shutdown(); super.shutdown();
} }

View File

@ -52,6 +52,12 @@ public abstract class SigarTestCase extends TestCase {
return sigar; return sigar;
} }
public static void closeSigar() {
if (sigar != null) {
sigar.close();
}
}
public Properties getProperties() { public Properties getProperties() {
return this.props; return this.props;
} }

View File

@ -56,6 +56,8 @@ public class TestInvoker extends SigarTestCase {
SigarProxyCache.newInstance(sigar); SigarProxyCache.newInstance(sigar);
testOK(proxy); testOK(proxy);
sigar.close();
} }
private void testOK(SigarProxy proxy) throws Exception { private void testOK(SigarProxy proxy) throws Exception {

View File

@ -13,5 +13,6 @@ public class TestLog extends SigarTestCase {
sigar.enableLogging(true); sigar.enableLogging(true);
sigar.enableLogging(false); sigar.enableLogging(false);
sigar.enableLogging(true); sigar.enableLogging(true);
sigar.close();
} }
} }

View File

@ -32,5 +32,7 @@ public class TestProcTime extends SigarTestCase {
assertGtEqZeroTrace("Sys", procTime.getSys()); assertGtEqZeroTrace("Sys", procTime.getSys());
assertGtEqZeroTrace("Total", procTime.getTotal()); assertGtEqZeroTrace("Total", procTime.getTotal());
sigar.close();
} }
} }

View File

@ -12,7 +12,7 @@ public class TestThreadCpu extends SigarTestCase {
} }
public void testCreate() throws Exception { public void testCreate() throws Exception {
Sigar sigar = new Sigar(); Sigar sigar = getSigar();
ThreadCpu cpu; ThreadCpu cpu;
try { try {