SigarProcess.close only applies to SigarProcess(void) constructor

This commit is contained in:
Doug MacEachern 2009-04-29 14:34:40 -07:00
parent bf361a1732
commit b3603f4489
2 changed files with 9 additions and 7 deletions

View File

@ -71,7 +71,7 @@ public class Mx extends SigarCommandBase {
SigarRegistry registry = new SigarRegistry(this.proxy);
try {
server.registerMBean(registry, null);
SigarProcess proc = new SigarProcess();
SigarProcess proc = new SigarProcess(this.sigar);
server.registerMBean(proc, new ObjectName(proc.getObjectName()));
isRegistered = true;
} catch (Exception e) {

View File

@ -40,16 +40,18 @@ public class SigarProcess implements SigarProcessMBean {
private long pid = -1;
public SigarProcess() {
this(new Sigar());
}
public SigarProcess(Sigar sigar) {
this.sigarImpl = sigar;
this.sigarImpl = new Sigar();
this.sigar = SigarProxyCache.newInstance(sigarImpl);
}
public SigarProcess(SigarProxy sigar) {
this.sigar = sigar;
}
public void close() {
this.sigarImpl.close();
if (this.sigarImpl != null) {
this.sigarImpl.close();
}
}
private RuntimeException unexpectedError(String type,