本文整理汇总了Java中org.javasimon.aop.Monitored类的典型用法代码示例。如果您正苦于以下问题:Java Monitored类的具体用法?Java Monitored怎么用?Java Monitored使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Monitored类属于org.javasimon.aop包,在下文中一共展示了Monitored类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMonitorName
import org.javasimon.aop.Monitored; //导入依赖的package包/类
/**
* Returns monitor name for the given method invocation with {@link org.javasimon.aop.Monitored#name()}
* and {@link org.javasimon.aop.Monitored#suffix()} applied as expected.
*
* @param methodInvocation current method invocation
* @return name of the Stopwatch for the invocation
*/
protected String getMonitorName(MethodInvocation methodInvocation) {
Class<?> targetClass = getTargetClass(methodInvocation);
Method targetMethod = getTargetMethod(methodInvocation, targetClass);
Monitored methodAnnotation = AnnotationUtils.findAnnotation(targetMethod, Monitored.class);
if (methodAnnotation != null && methodAnnotation.name() != null && methodAnnotation.name().length() > 0) {
return methodAnnotation.name();
}
StringBuilder nameBuilder = new StringBuilder();
Monitored classAnnotation = AnnotationUtils.findAnnotation(targetClass, Monitored.class);
if (classAnnotation != null && classAnnotation.name() != null && classAnnotation.name().length() > 0) {
nameBuilder.append(classAnnotation.name());
} else {
nameBuilder.append(getMeaningfulClassName(targetClass));
}
nameBuilder.append(Manager.HIERARCHY_DELIMITER);
String suffix = targetMethod.getName();
if (methodAnnotation != null && methodAnnotation.suffix() != null && methodAnnotation.suffix().length() > 0) {
suffix = methodAnnotation.suffix();
}
return nameBuilder.append(suffix).toString();
}
开发者ID:virgo47,项目名称:javasimon,代码行数:32,代码来源:SpringStopwatchSource.java
示例2: checkPsLineForServiceMatch
import org.javasimon.aop.Monitored; //导入依赖的package包/类
/**
*
* Note - the format in this method is determined by
*
* @param psLines
* @param liveInstanceConfig
* @param instanceWithUpdatedRuntime
* @param psIndex
* @param currLine
* @return
*
* @see performOsProcessList
*
*/
@Monitored
public boolean checkPsLineForServiceMatch (
String[] psLines,
ServiceInstance liveInstanceConfig,
ServiceInstance instanceWithUpdatedRuntime,
int psIndex, String currLine ) {
logger.debug( "Search for {} using {} in { }",
liveInstanceConfig.getServiceName(), liveInstanceConfig.getProcessFilter(), currLine );
if ( currLine.length() > 0 ) {
if ( !currLine.matches( liveInstanceConfig.getProcessFilter() ) ) {
logger.debug( "\t NO Match for {} using {} in {}",
liveInstanceConfig.getServiceName(), liveInstanceConfig.getProcessFilter(), currLine );
} else {
logger.debug( "\t MATCH for {} using {} in {}",
liveInstanceConfig.getServiceName(), liveInstanceConfig.getProcessFilter(), currLine );
// special hook to work with scripts. Ignore process
// matches that are tagged
if ( currLine.matches( ".*isCsapScript.*" )
&& !liveInstanceConfig.isScript() ) {
return false;
}
// first column is cpu usage
// MULTIPLE matches possible. eg Oracle spawns many
// processes
// input is generated in performOsProcessList:
// ps -e --no-heading --sort -rss -o
// pcpu,rss,nlwp,ruser,pid,args
String[] cols = currLine.trim().split( " " );
// some services have multiple pids add together
logger.debug( "{} adding cpu usage: {}", liveInstanceConfig.getServiceName(), cols[0] );
instanceWithUpdatedRuntime.addCpuUtil( cols[0] );
instanceWithUpdatedRuntime.addRssMemory( cols[1] );
instanceWithUpdatedRuntime.addVirtualMemory( cols[2] );
instanceWithUpdatedRuntime.addThreadCount( cols[3] );
instanceWithUpdatedRuntime.addPid( cols[5] );
instanceWithUpdatedRuntime.setCurrentProcessPriority( cols[6] );
int heapStart = currLine.indexOf( "-Xmx" );
int heapEnd = currLine.indexOf( " ", heapStart + 1 );
// logger.info("currLine: " + currLine + " heapCheck:" +
// heapStart + " heapEnd: " + heapEnd) ;
if ( heapStart != -1 && heapEnd != -1 ) {
instanceWithUpdatedRuntime.addRunHeap( currLine.substring(
heapStart, heapEnd ) );
}
if ( csapApp.isServiceDebug( liveInstanceConfig ) ) {
logger.info( "{} Clearing line: {}", liveInstanceConfig.getServiceName(), psLines[psIndex] );
}
// This can short circuit the matches if multiple conflicting
// matchers are used.
psLines[psIndex] = "";
logger.trace( "{} Updated Instance:\n {} ", liveInstanceConfig.getServiceName(),
instanceWithUpdatedRuntime );
return true;
}
}
return false;
}
开发者ID:csap-platform,项目名称:csap-core,代码行数:81,代码来源:OsManager.java
示例3: annotatedMethod
import org.javasimon.aop.Monitored; //导入依赖的package包/类
@Monitored
public void annotatedMethod() {
}
开发者ID:stevensouza,项目名称:automon,代码行数:4,代码来源:JavaSimonAnnotatedMethod.java
示例4: myException
import org.javasimon.aop.Monitored; //导入依赖的package包/类
@Monitored
public void myException(Throwable throwable) throws Throwable {
throw throwable;
}
开发者ID:stevensouza,项目名称:automon,代码行数:5,代码来源:JavaSimonAnnotatedMethod.java
示例5: isMonitoredAnnotationOnClassOrMethod
import org.javasimon.aop.Monitored; //导入依赖的package包/类
private boolean isMonitoredAnnotationOnClassOrMethod(Method method, Class targetClass) {
return AnnotationUtils.findAnnotation(targetClass, Monitored.class) != null
|| AnnotationUtils.findAnnotation(AopUtils.getMostSpecificMethod(method, targetClass), Monitored.class) != null;
}
开发者ID:virgo47,项目名称:javasimon,代码行数:5,代码来源:MonitoredMeasuringPointcut.java
示例6: run
import org.javasimon.aop.Monitored; //导入依赖的package包/类
@Monitored
void run();
开发者ID:virgo47,项目名称:javasimon,代码行数:3,代码来源:MonitoredService.java
注:本文中的org.javasimon.aop.Monitored类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论