public boolean apply(final MonitorProcessor processor) { MonitoringLevel processorLevel = findMonitoringEngine().getProcessorLevel( processor.getName()); if (processorLevel != null) { return monitorLevel.hasHigherOrEqualPriorityThan(processorLevel); } else { return monitorLevel.hasHigherOrEqualPriorityThan(_monitoringLevel); } } });
/** * @@org.springframework.jmx.export.metadata.ManagedOperation * (description="Set the monitoring level for this process group" * ) * @@org.springframework.jmx.export.metadata.ManagedOperationParameter (index=0, * name="levelString", * description= * "new MonitoringLevel to apply" * ) */ @ManagedOperation(description = "Set the monitoring level for this process group") @ManagedOperationParameters({@ManagedOperationParameter(name = "levelString", description = "new MonitoringLevel to apply")}) public void updateMonitoringLevel(final String levelString) { if (!MonitoringLevel.isValidLevelStr(levelString)) { throw new IllegalArgumentException("levelString must match an existing MonitoringLevel"); } _monitoringLevel = MonitoringLevel.toLevel(levelString); log.info(this.toString() + " -> " + levelString); }
/** * @@org.springframework.jmx.export.metadata.ManagedAttribute * (description="get the string representation of the monitoring level for this process group" * ) */ @ManagedAttribute(description = "get the string representation of the monitoring level for this process group") public String getMonitoringLevel() { return _monitoringLevel.toString(); }
private MonitoringLevel getMonitoringLevel(final MethodInvocation invocation) { final MonitoredAttribute att = getAttribute(invocation); if (att == null) { return MonitoringLevel.INFO; } else { return MonitoringLevel.toLevel(att.getLevelStr()); } }
/** * This method should be called by all CompositeMonitor implementations * before they call monitorStarted(). * * @param compositeMonitor the composite monitor */ public void compositeMonitorStarted(CompositeMonitor compositeMonitor) { if (getEventPatternLevel().hasHigherPriorityThan(compositeMonitor.getLevel())) { if (log.isDebugEnabled()) { log.debug("skipping " + compositeMonitor.getAsString(Attribute.NAME)); } return; } LinkedList stack = getStack(); if (stack == null) { stack = new LinkedList(); threadBasedMap.put(Thread.currentThread(), stack); } stack.addLast(new StackFrame(compositeMonitor)); }
throw new IllegalArgumentException("nameStartsWith cannot be null"); else if (!MonitoringLevel.isValidLevelStr(levelStr)) { throw new IllegalArgumentException("levelStr must match an existing MonitoringLevel"); MonitoringLevel level = MonitoringLevel.toLevel(levelStr); MonitoringEngine.getInstance().addMonitorLevel(nameStartsWith, level); if (log.isInfoEnabled()) {
public void processMonitorForCompositeMonitor(Monitor monitor) { LinkedList stack = getStack(); if (stack != null) { if (! stack.isEmpty()) { StackFrame stackFrame = (StackFrame) stack.getLast(); CompositeMonitor parentMonitor = stackFrame.getCompositeMonitor(); // only add this monitor being processed to a parent if it is enabled // by its monitoring level MonitoringLevel monitorLevel = monitor.getLevel(); if ((monitorLevel != null) && (monitorLevel.hasHigherOrEqualPriorityThan(getEventPatternLevel()))) { parentMonitor.addChildMonitor(monitor); } } else { threadBasedMap.remove(Thread.currentThread()); } } }
throw new IllegalArgumentException("processor name cannot be null"); else if (!MonitoringLevel.isValidLevelStr(levelStr)) { throw new IllegalArgumentException("levelStr must match an existing MonitoringLevel"); MonitorProcessor processor = processors[i]; if (name.equalsIgnoreCase(processor.getName())) { MonitoringEngine.getInstance().addProcessorLevel(name, MonitoringLevel.toLevel(levelStr)); log.info("Changed Processor level: " + name + " -> " + levelStr); return;// two processors should not have same name