return NOTIMPL if ProcFd fails

This commit is contained in:
Doug MacEachern 2008-10-18 23:36:30 +00:00
parent 2bc3a6ce2a
commit 6b46d63201
1 changed files with 8 additions and 7 deletions

View File

@ -34,6 +34,7 @@ import org.hyperic.sigar.SigarProxyCache;
public class SigarProcess implements SigarProcessMBean {
private static final Long NOTIMPL = new Long(Sigar.FIELD_NOTIMPL);
private Sigar sigarImpl;
private SigarProxy sigar;
private long pid = -1;
@ -75,12 +76,8 @@ public class SigarProcess implements SigarProcessMBean {
}
}
private synchronized ProcFd getFd() {
try {
private synchronized ProcFd getFd() throws SigarException {
return this.sigar.getProcFd(getPid());
} catch (SigarException e) {
throw unexpectedError("Fd", e);
}
}
public String getObjectName() throws SigarException {
@ -150,6 +147,10 @@ public class SigarProcess implements SigarProcessMBean {
}
public Long getOpenFd() {
try {
return new Long(getFd().getTotal());
} catch (SigarException e) {
return NOTIMPL;
}
}
}