Search in sources :

Example 1 with AggregateEventTrigger

use of org.eclipse.jetty.monitor.triggers.AggregateEventTrigger in project jetty.project by eclipse.

the class JavaMonitorAction method parseResponse.

/* ------------------------------------------------------------ */
private void parseResponse(Properties response) {
    if (response.get("onhold") != null)
        throw new Error("Suspended");
    if (response.get("session") != null) {
        _session = (String) response.remove("session");
        AggregateEventTrigger trigger = (AggregateEventTrigger) getTrigger();
        String queryString;
        ObjectName[] queryResults;
        for (Map.Entry<Object, Object> entry : response.entrySet()) {
            String[] values = ((String) entry.getValue()).split("\\|");
            queryString = values[0];
            if (queryString.startsWith("com.javamonitor.openfire"))
                continue;
            if (queryString.startsWith("com.javamonitor")) {
                queryString = "org.eclipse.jetty.monitor.integration:type=javamonitortools,id=0";
            }
            queryResults = null;
            try {
                queryResults = queryNames(queryString);
            } catch (IOException e) {
                LOG.debug(e);
            } catch (MalformedObjectNameException e) {
                LOG.debug(e);
            }
            if (queryResults != null) {
                int idx = 0;
                for (ObjectName objName : queryResults) {
                    String id = entry.getKey().toString() + (idx == 0 ? "" : ":" + idx);
                    String name = queryString.equals(objName.toString()) ? "" : objName.toString();
                    boolean repeat = Boolean.parseBoolean(values[2]);
                    trigger.add(new JavaMonitorTrigger(objName, values[1], id, name, repeat));
                }
            }
        }
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) IOException(java.io.IOException) ObjectName(javax.management.ObjectName) Map(java.util.Map) AggregateEventTrigger(org.eclipse.jetty.monitor.triggers.AggregateEventTrigger)

Aggregations

IOException (java.io.IOException)1 Map (java.util.Map)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 AggregateEventTrigger (org.eclipse.jetty.monitor.triggers.AggregateEventTrigger)1