com.twitter.common.inject
Class TimedInterceptor

java.lang.Object
  extended by com.twitter.common.inject.TimedInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public final class TimedInterceptor
extends Object
implements org.aopalliance.intercept.MethodInterceptor

A method interceptor that exports timing information for methods annotated with @Timed.


Nested Class Summary
static interface TimedInterceptor.Timed
          Marks a method as a target for timing.
 
Method Summary
static void bind(Binder binder)
          Installs an interceptor in a guice Injector, enabling @Timed method interception in guice-provided instances.
 Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
          Implement this method to perform extra treatments before and after the invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invoke

public Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
              throws Throwable
Description copied from interface: org.aopalliance.intercept.MethodInterceptor
Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint.proceed().

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Parameters:
methodInvocation - the method invocation joinpoint
Returns:
the result of the call to Joinpoint.proceed(), might be intercepted by the interceptor.
Throws:
Throwable - if the interceptors or the target-object throws an exception.

bind

public static void bind(Binder binder)
Installs an interceptor in a guice Injector, enabling @Timed method interception in guice-provided instances. Requires that a TimeSeriesRepository is bound elsewhere.

Parameters:
binder - a guice binder to require bindings against