FileDocCategorySizeDatePackage
ClearMonitorAlertsServlet.javaAPI DocJBoss 4.2.13214Fri Jul 13 21:02:14 BST 2007org.jboss.console.plugins.monitor

ClearMonitorAlertsServlet

public class ClearMonitorAlertsServlet extends HttpServlet
Created by IntelliJ IDEA. User: wburke Date: Nov 25, 2003 Time: 5:53:01 PM To change this template use Options | File Templates.

Fields Summary
Constructors Summary
Methods Summary
protected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      doit(req, resp);
   
protected voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      doit(req, resp);
   
protected voiddoit(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

      try
      {
         MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
         InstanceOfQueryExp queryExp = null;
         queryExp = new InstanceOfQueryExp("org.jboss.monitor.JBossMonitorMBean");
         Set monitors = mbeanServer.queryNames(null, queryExp);
         Iterator mbeans = monitors.iterator();
         while (mbeans.hasNext())
         {
            ObjectName moname = (ObjectName) mbeans.next();
            Object[] nullArgs = {};
            String[] nullSig = {};
            boolean alerted = ((Boolean) mbeanServer.invoke(moname, "alerted", nullArgs, nullSig)).booleanValue();
            if (alerted)
            {
               mbeanServer.invoke(moname, "clearAlert", nullArgs, nullSig);
            }
         }
      }
      catch (Exception ex)
      {
         req.setAttribute("error", "Error clearing alerts: " + ex.toString());
      }
      req.getRequestDispatcher("/listMonitors.jsp").forward(req, resp);