public Invoker create ( Object service , Invoker rootInvoker ) { List < Method > timedmethods = new ArrayList <> ( ) ; List < Method > meteredmethods = new ArrayList <> ( ) ; List < Method > exceptionmeteredmethods = new ArrayList <> ( ) ; for ( Method m : service . getClass ( ) . getMethods ( ) ) { if ( m . isAnnotationPresent ( Timed . class ) ) { timedmethods . add ( m ) ; } if ( m . isAnnotationPresent ( Metered . class ) ) { meteredmethods . add ( m ) ; } if ( m . isAnnotationPresent ( ExceptionMetered . class ) ) { exceptionmeteredmethods . add ( m ) ; } } Invoker invoker = rootInvoker ; if ( timedmethods . size ( ) > 0 ) { invoker = this . timed ( invoker , timedmethods ) ; } if ( meteredmethods . size ( ) > 0 ) { invoker = this . metered ( invoker , meteredmethods ) ; } if ( exceptionmeteredmethods . size ( ) > 0 ) { invoker = this . exceptionMetered ( invoker , exceptionmeteredmethods ) ; } return invoker ; }
Factory method for creating instrumented invoker chain .