handle case of process going away

This commit is contained in:
Doug MacEachern 2009-01-08 04:41:21 +00:00
parent bb5dc06cba
commit 5a602a0a06
1 changed files with 6 additions and 1 deletions

View File

@ -51,7 +51,12 @@ public class TestMx extends SigarTestCase {
for (int i=0; i<pids.length; i++) { for (int i=0; i<pids.length; i++) {
SigarProcess proc = new SigarProcess(); SigarProcess proc = new SigarProcess();
proc.setPid(pids[i]); proc.setPid(pids[i]);
ObjectName name = new ObjectName(proc.getObjectName()); ObjectName name;
try {
name = new ObjectName(proc.getObjectName());
} catch (SigarException e) {
continue; //process may have gone away
}
if (server.isRegistered(name)) { if (server.isRegistered(name)) {
continue; continue;
} }