List of usage examples for org.aspectj.lang ProceedingJoinPoint getSourceLocation
SourceLocation getSourceLocation();
If there is no source location available, returns null.
Returns the SourceLocation of the defining class for default constructors.
getStaticPart().getSourceLocation()
returns the same object.
From source file:org.spf4j.perf.aspects.NetworkMonitorAspect.java
License:Open Source License
@Around("call(int java.nio.channels.SocketChannel.read(..))") public Object nioReadInt(final ProceedingJoinPoint pjp) throws Throwable { Integer result = (Integer) pjp.proceed(); if (result >= 0) { RECORDER_READ.getRecorder(pjp.getSourceLocation().getWithinType()).record(result); }//from ww w . j a v a2 s .com return result; }
From source file:org.spf4j.perf.aspects.NetworkMonitorAspect.java
License:Open Source License
@Around("call(long java.nio.channels.SocketChannel.write(..))") public Object nioWriteLong(final ProceedingJoinPoint pjp) throws Throwable { Long result = (Long) pjp.proceed(); if (result >= 0) { RECORDER_WRITE.getRecorder(pjp.getSourceLocation().getWithinType()).record(result); }//from w w w.j a va2s . c o m return result; }
From source file:org.spf4j.perf.aspects.NetworkMonitorAspect.java
License:Open Source License
@Around("call(int java.nio.channels.SocketChannel.write(..))") public Object nioWriteInt(final ProceedingJoinPoint pjp) throws Throwable { Integer result = (Integer) pjp.proceed(); if (result >= 0) { RECORDER_WRITE.getRecorder(pjp.getSourceLocation().getWithinType()).record(result); }//from ww w . j a v a2 s . c om return result; }
From source file:org.spf4j.perf.aspects.NetworkMonitorAspect.java
License:Open Source License
@Around("call(* java.net.Socket.getInputStream())") public Object socketIS(final ProceedingJoinPoint pjp) throws Throwable { InputStream result = (InputStream) pjp.proceed(); return new MeasuredInputStream(result, pjp.getSourceLocation().getWithinType().getName(), RECORDER_READ); }
From source file:org.spf4j.perf.aspects.NetworkMonitorAspect.java
License:Open Source License
@Around("call(* java.net.Socket.getOutputStream())") public Object socketOS(final ProceedingJoinPoint pjp) throws Throwable { OutputStream result = (OutputStream) pjp.proceed(); return new MeasuredOutputStream(result, pjp.getSourceLocation().getWithinType().getName(), RECORDER_WRITE); }
From source file:sample.metrics.atsd.MeasuredAspect.java
License:Apache License
@Around("@annotation(sample.metrics.atsd.Measured) or @within(sample.metrics.atsd.Measured)") public Object doProfiling(ProceedingJoinPoint pjp) throws Throwable { Class<?> clazz = pjp.getSourceLocation().getWithinType(); Method method = ((MethodSignature) pjp.getSignature()).getMethod(); String name = composeMetricName(method, clazz); StopWatch stopWatch = new StopWatch(); stopWatch.start();/*w w w . j a v a 2 s .c om*/ try { return pjp.proceed(); } catch (Throwable throwable) { name += ".failed"; throw throwable; } finally { stopWatch.stop(); this.gaugeService.submit(name, stopWatch.getTotalTimeMillis()); this.counterService.increment(name); } }