more context incase of error
This commit is contained in:
1 parent
c91d0991ad
commit
9fa41cc1c7
1 file changed
+11
-3
@@ -27,12 +27,20 @@ public class SigarProcess implements SigarProcessMBean {
|
|||||||
this.sigarImpl.close();
|
this.sigarImpl.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RuntimeException unexpectedError(String type,
|
||||||
|
SigarException e) {
|
||||||
|
String msg =
|
||||||
|
"Unexected error in Sigar.get" + type +
|
||||||
|
": " + e.getMessage();
|
||||||
|
return new IllegalArgumentException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized ProcMem getMem() {
|
private synchronized ProcMem getMem() {
|
||||||
try {
|
try {
|
||||||
long pid = this.sigar.getPid();
|
long pid = this.sigar.getPid();
|
||||||
return this.sigar.getProcMem(pid);
|
return this.sigar.getProcMem(pid);
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
throw new IllegalArgumentException();
|
throw unexpectedError("Mem", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +49,7 @@ public class SigarProcess implements SigarProcessMBean {
|
|||||||
long pid = this.sigar.getPid();
|
long pid = this.sigar.getPid();
|
||||||
return this.sigar.getProcTime(pid);
|
return this.sigar.getProcTime(pid);
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
throw new IllegalArgumentException();
|
throw unexpectedError("Time", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +58,7 @@ public class SigarProcess implements SigarProcessMBean {
|
|||||||
long pid = this.sigar.getPid();
|
long pid = this.sigar.getPid();
|
||||||
return this.sigar.getProcFd(pid);
|
return this.sigar.getProcFd(pid);
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
throw new IllegalArgumentException();
|
throw unexpectedError("Fd", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user