SigarProcess.close only applies to SigarProcess(void) constructor
This commit is contained in:
parent
bf361a1732
commit
b3603f4489
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue