Package org.hyperic.sigar

Examples of org.hyperic.sigar.SigarException


    @Test
    public void testGetParentPidWithNullState() throws Exception {
        // Force new test instance because this test case work with data
        // which is initialized at instance creation
        when(sigarProxy.getProcState(PID)).thenThrow(new SigarException());
        // This is to avoid NPE in test instance error checking code
        when(sigarProxy.getProcList()).thenReturn(new long[] { PID });
        processInfo = new ProcessInfo(PID, sigarProxy);
        assertEquals(processInfo.getParentPid(), 0);
    }
View Full Code Here


            printHeader();
            output(fs);
            return;
        }

        throw new SigarException(arg +
                                 " No such file or directory");
    }
View Full Code Here

            }
            else if (arg.equals("-S")) {
                this.mode = "Cur";
            }
            else {
                throw new SigarException("Unknown argument: " + arg);
            }
        }
       
        println("core file size......." + getValue("Core"));
        println("data seg size........" + getValue("Data"));
View Full Code Here

        throws SigarException {
        List servers =
            MBeanServerFactory.findMBeanServer(null);
   
        if (servers.size() == 0) {
            throw new SigarException("No MBeanServers available");
        }
        else {
            return (MBeanServer)servers.get(0);
        }
    }
View Full Code Here

            if (!server.isRegistered(pname)) {
                server.registerMBean(proc, pname);
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new SigarException(e.getMessage());
        }
    }
View Full Code Here

                else {
                    println(name.toString());
                }
            }
        } catch (Exception e) {
            throw new SigarException(e.getMessage());
        }
        if (launchJconsole) {
            flush();
            jconsole();
            try { //test unregisterMBean
View Full Code Here

                }
                String name = FileCompleter.expand(arg);
                FileSystem fs = mounts.getMountPoint(name);

                if (fs == null) {
                    throw new SigarException(arg +
                                             " No such file or directory");
                }
                sys.add(fs);
            }
        }
View Full Code Here

                    Sigar s = new Sigar();

                    try {
                        runall(i);
                    } catch (IllegalAccessException e) {
                        throw new SigarException(e.getMessage());
                    } catch (InvocationTargetException e) {
                        throw new SigarException(e.getMessage());
                    } finally {
                        s.close();
                    }
                }

                long totalTime = System.currentTimeMillis() - startTime;
               
                proxy = null;
                output("Running garbage collector..");
                System.gc();
                memstat(lastChange+1);

                output(num + " iterations took " +
                       totalTime + "ms");

                output("startSize=" + startSize +
                       ", endSize=" + currentSize +
                       ", diff=" + (currentSize - startSize));
            }
            else {
                Object obj = invoke(new SigarInvoker(proxy, type), null, attr);

                output(obj.toString());
            }
        }
        else {
            try {
                runall(0);
            } catch (IllegalAccessException e) {
                throw new SigarException(e.getMessage());
            } catch (InvocationTargetException e) {
                        throw new SigarException(e.getMessage());
            }
        }
    }
View Full Code Here

            }
            else if (Character.isDigit(arg.charAt(0))) {
                this.number = Integer.parseInt(arg);
            }
            else {
                throw new SigarException("Unknown argument: " + args[i]);
            }
        }
    }
View Full Code Here

                    Sigar s = new Sigar();

                    try {
                        runall(i);
                    } catch (IllegalAccessException e) {
                        throw new SigarException(e.getMessage());
                    } catch (InvocationTargetException e) {
                        throw new SigarException(e.getMessage());
                    } finally {
                        s.close();
                    }
                }

                long totalTime = System.currentTimeMillis() - startTime;
               
                proxy = null;
                output("Running garbage collector..");
                System.gc();
                memstat(lastChange+1);

                output(num + " iterations took " +
                       totalTime + "ms");

                output("startSize=" + startSize +
                       ", endSize=" + currentSize +
                       ", diff=" + (currentSize - startSize));
            }
            else {
                Object obj = invoke(new SigarInvoker(proxy, type), null, attr);

                output(obj.toString());
            }
        }
        else {
            try {
                runall(0);
            } catch (IllegalAccessException e) {
                throw new SigarException(e.getMessage());
            } catch (InvocationTargetException e) {
                        throw new SigarException(e.getMessage());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.SigarException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.