Codota Logo
com.jamonapi
Code IndexAdd Codota to your IDE (free)

How to use com.jamonapi

Best Java code snippets using com.jamonapi (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

/**
 * Count the thrown exception and put the stack trace in the details portion of the key.
 * This will allow the stack trace to be viewed in the JAMon web application.
 */
protected void trackException(MonKey key, Throwable ex) {
  String stackTrace = "stackTrace=" + Misc.getExceptionTrace(ex);
  key.setDetails(stackTrace);
  // Specific exception counter. Example: java.lang.RuntimeException
  MonitorFactory.add(new MonKeyImp(ex.getClass().getName(), stackTrace, "Exception"), 1);
  // General exception counter which is a total for all exceptions thrown
  MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTrace, "Exception"), 1);
}
origin: stackoverflow.com

 public aspect MonitorAspect {
  pointcut monitor() : execution(* *.ClassToMonitor.methodToMonitor(..));

  Object arround() : monitor() {
    Monitor monitor = MonitorFactory.start(thisJoinPoint.toShortString());
    Object returnedObject = proceed();
    monitor.stop();
    return returnedObject;
  }
}
origin: stackoverflow.com

 CompositeListener composite = new CompositeListener();
composite.registerListener(listener1);
composite.registerListener(listener2);
component.setOnEventListener(composite);
origin: spring-projects/spring-framework

/**
 * Wraps the invocation with a JAMon Monitor and writes the current
 * performance statistics to the log (if enabled).
 * @see com.jamonapi.MonitorFactory#start
 * @see com.jamonapi.Monitor#stop
 */
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
  String name = createInvocationTraceName(invocation);
  MonKey key = new MonKeyImp(name, name, "ms.");
  Monitor monitor = MonitorFactory.start(key);
  try {
    return invocation.proceed();
  }
  catch (Throwable ex) {
    trackException(key, ex);
    throw ex;
  }
  finally {
    monitor.stop();
    if (!this.trackAllInvocations || isLogEnabled(logger)) {
      writeToLog(logger, "JAMon performance statistics for method [" + name + "]:\n" + monitor);
    }
  }
}
origin: stevensouza/jamonapi

private JAMonBufferListener getExceptionBufferListener() {
  if (MonitorFactory.exists(MonitorFactory.EXCEPTIONS_LABEL, EXCEPTION)) {
    Monitor mon = MonitorFactory.getMonitor(MonitorFactory.EXCEPTIONS_LABEL, EXCEPTION);
    if (mon.hasListener("value", "FIFOBuffer")) {
      JAMonListener bufferListener = mon.getListenerType("value").getListener("FIFOBuffer");
      if (bufferListener instanceof JAMonBufferListener) {
        return (JAMonBufferListener) bufferListener;
      }
    }
  }
  return null;
}
origin: stevensouza/jamonapi

/** Ranges are implemented as JAMonListeners */
public void processEvent(Monitor mon) {
  double value=mon.getLastValue();
  getFrequencyDist(value).add(value);
}
origin: com.jamonapi/com.springsource.com.jamonapi

public JAMonDetailRow getJAMonDetailRow() {
  if (monData.enabled) {
    synchronized (monData) {
      return new JAMonDetailValue(getMonKey().getDetailLabel(),
          monData.lastValue, monData.activityStats.thisActive.getCount(),  monData.lastAccess);
    }
  } else
    return JAMonDetailValue.NULL_VALUE;
}
 
origin: com.jamonapi/com.springsource.com.jamonapi

private MonitorImp createMon(MonKey key, boolean isPrimary, boolean isTimeMonitor)  {
   ActivityStats activityStats=new ActivityStats(new Counter(), primaryActive, allActive);
   // get default range for this type and assign it to the monitor
   RangeImp range=rangeFactory.getRangeDefault(key.getRangeKey(), activityStats);
   MonitorImp mon=new MonitorImp(key, range, activityStats, isTimeMonitor); 
       
   mon.setPrimary(isPrimary);
   return mon;
}
origin: com.jamonapi/com.springsource.com.jamonapi

public TimeMon2() {
  super(new MonKeyImp("timer","ms."),new MonInternals());
  monData.activityStats=new ActivityStats();
  monData.isTimeMonitor=true;
}
origin: spring-projects/spring-framework

@Test
public void testInvokeUnderTraceWithNormalProcessing() throws Throwable {
  given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
  interceptor.invokeUnderTrace(mi, log);
  assertTrue("jamon must track the method being invoked", MonitorFactory.getNumRows() > 0);
  assertTrue("The jamon report must contain the toString method that was invoked",
      MonitorFactory.getReport().contains("toString"));
}
origin: stevensouza/jamonapi

public JAMonDetailValue getJAMonDetailRow() {
  if (monData.enabled) {
    synchronized (monData) {
      return new JAMonDetailValue(getMonKey(),
          monData.lastValue, monData.getThisActiveCount(),  monData.lastAccess);
    }
  } else
    return JAMonDetailValue.NULL_VALUE;
}
origin: stevensouza/jamonapi

private static void init() {
  // enable the factory by default.
  boolean isKeySizeTrackingEnabled= (factory==null) ? false : factory.isTotalKeySizeTrackingEnabled();
  factory = debugFactory = enabledFactory = new FactoryEnabled();
  if (isKeySizeTrackingEnabled) {
    factory.enableTotalKeySizeTracking();
  }
  disabledFactory = new FactoryDisabled(enabledFactory);
  setDebugEnabled(false);
}
origin: com.jamonapi/com.springsource.com.jamonapi

public List getRowData(List rowData) {
 monData.key.getRowData(rowData);
 getThisRowData(rowData); 
 if (monData.range!=null)      
  monData.range.getRowData(rowData);
 
 return rowData;
 
}        
origin: com.jamonapi/com.springsource.com.jamonapi

public List getRowDisplayData(List rowData) {
 monData.key.getRowDisplayData(rowData);
   getThisRowData(rowData);   
 
 if (monData.range!=null)       
  monData.range.getRowDisplayData(rowData);
 
 return rowData;
}    
 
origin: stevensouza/jamonapi

private void addExceptionFifoBufferListener() {
  Monitor mon =  getMonitor(MonitorFactory.EXCEPTIONS_LABEL, "Exception");
  if (!mon.hasListener("value", "FIFOBuffer")) {
    mon.addListener("value", JAMonListenerFactory.get("FIFOBuffer"));
  }
}
origin: stevensouza/jamonapi

private MonitorImp getNanoMonitor(MonKey key) {
  boolean isPrimary=false;
  boolean isTimeMon=true;
  MonitorImp mon=getMonitor.getMon(key, isPrimary, isTimeMon);
  if (mon.isEnabled()) {
    mon = new TimeMonNano(key, mon.getMonInternals());
  }
  return mon;
}
origin: stevensouza/jamonapi

public List getDisplayHeader(List header) {
  monData.key.getDisplayHeader(header);
  getThisData(header);
  if (monData.range!=null)
    monData.range.getDisplayHeader(header);
  return header;
}
origin: spring-projects/spring-framework

@After
public void tearDown() {
  MonitorFactory.reset();
}
origin: spring-projects/spring-framework

@Test
public void testInvokeUnderTraceWithExceptionTracking() throws Throwable {
  given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
  given(mi.proceed()).willThrow(new IllegalArgumentException());
  try {
    interceptor.invokeUnderTrace(mi, log);
    fail("Must have propagated the IllegalArgumentException");
  }
  catch (IllegalArgumentException expected) {
  }
  assertEquals("Monitors must exist for the method invocation and 2 exceptions",
      3, MonitorFactory.getNumRows());
  assertTrue("The jamon report must contain the toString method that was invoked",
      MonitorFactory.getReport().contains("toString"));
  assertTrue("The jamon report must contain the generic exception: " + MonitorFactory.EXCEPTIONS_LABEL,
      MonitorFactory.getReport().contains(MonitorFactory.EXCEPTIONS_LABEL));
  assertTrue("The jamon report must contain the specific exception: IllegalArgumentException'",
      MonitorFactory.getReport().contains("IllegalArgumentException"));
}
origin: spring-projects/spring-framework

@Before
public void setUp() {
  MonitorFactory.reset();
}
com.jamonapi

Most used classes

  • Monitor
    Used to interact with monitor objects. I would have preferred to make this an interface, but didn't
  • MonitorFactory
    Static MonitorFactory that is good to use in most cases. In the situation when you want a different
  • MonitorComposite
    Treats groups of monitors the same way you treat one monitor. i.e. you can enable/disable/reset etc
  • MonKey
    Key that allows for a monitor to be passed any number of keys used in the equivalent of a group by c
  • MonKeyImp
  • Misc,
  • RangeHolder,
  • CompositeListener,
  • FactoryEnabled,
  • FrequencyDist,
  • MonKeyItem,
  • BufferList,
  • ActivityStats,
  • BasicTimingMonitor,
  • CopyJAMonListener,
  • Counter,
  • DecoMon,
  • FactoryEnabled$RangeFactory,
  • FrequencyDistBase
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now