@ Override public boolean registerMonitor ( Object monitor ) { // Process the annotated object, build a configuration, and create probe // listeners that represent each call site of the monitor. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "monitor = " + monitor ) ; } long startTime = System . nanoTime ( ) ; Set < ProbeListener > listeners = buildListenersFromAnnotated ( monitor ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "buildListenersFromAnnotated time = " + TimeUnit . NANOSECONDS . toMicros ( System . nanoTime ( ) - startTime ) + "usec" ) ; } // Update collections of listeners startTime = System . nanoTime ( ) ; if ( ! addListenersForMonitor ( monitor , listeners ) ) { return false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "addListenersForMonitorTime = " + TimeUnit . NANOSECONDS . toMicros ( System . nanoTime ( ) - startTime ) + "usec" ) ; } // Process all of the listeners and determine which of the available // classes needs to be transformed startTime = System . nanoTime ( ) ; Collection < Class < ? > > effectedClasses = processNewListeners ( listeners ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "processNewListeners time = " + TimeUnit . NANOSECONDS . toMicros ( System . nanoTime ( ) - startTime ) + "usec" ) ; } // Update the classes with the configured probes if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "effectedClasses.size() = " + effectedClasses . size ( ) ) ; } startTime = System . nanoTime ( ) ; this . transformer . instrumentWithProbes ( effectedClasses ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "instrumentWithProbes time = " + TimeUnit . NANOSECONDS . toMicros ( System . nanoTime ( ) - startTime ) + "usec" ) ; } return true ; }
Register an annotated object as a monitor . The annotations will be used to generate the appropriate configuration .