private static void initIfNeeded ( ) { if ( ! INITIALIZED ) { synchronized ( JCRAPIAspect . class ) { if ( ! INITIALIZED ) { ExoContainer container = ExoContainerContext . getTopContainer ( ) ; JCRAPIAspectConfig config = null ; if ( container != null ) { config = ( JCRAPIAspectConfig ) container . getComponentInstanceOfType ( JCRAPIAspectConfig . class ) ; } if ( config == null ) { TARGET_INTERFACES = new Class < ? > [ ] { } ; LOG . warn ( "No interface to monitor could be found" ) ; } else { TARGET_INTERFACES = config . getTargetInterfaces ( ) ; for ( Class < ? > c : TARGET_INTERFACES ) { Statistics global = new Statistics ( null , "global" ) ; Map < String , Statistics > statistics = new TreeMap < String , Statistics > ( ) ; Method [ ] methods = c . getMethods ( ) ; for ( Method m : methods ) { String name = getStatisticsName ( m ) ; statistics . put ( name , new Statistics ( global , name ) ) ; } JCRStatisticsManager . registerStatistics ( c . getSimpleName ( ) , global , statistics ) ; ALL_STATISTICS . put ( c . getSimpleName ( ) , statistics ) ; } } INITIALIZED = true ; } } } }
Initializes the aspect if needed