Collection < Class < ? > > processNewListeners ( Collection < ProbeListener > listeners ) { Set < Class < ? > > classesToTransform = new HashSet < Class < ? > > ( ) ; Set < ProbeListener > matchingListeners = new HashSet < ProbeListener > ( ) ; Set < Class < ? > > monitorableTemp ; synchronized ( this . monitorable ) { monitorableTemp = new HashSet < Class < ? > > ( this . monitorable ) ; } for ( Class < ? > clazz : monitorableTemp /* instrumentation.getAllLoadedClasses() */ ) { if ( ! isMonitorable ( clazz ) ) { continue ; } for ( ProbeListener listener : listeners ) { ProbeFilter filter = listener . getProbeFilter ( ) ; if ( filter . matches ( clazz ) ) { matchingListeners . add ( listener ) ; } } if ( ! matchingListeners . isEmpty ( ) ) { classesToTransform . add ( clazz ) ; addInterestedByClass ( clazz , matchingListeners ) ; } matchingListeners . clear ( ) ; } return classesToTransform ; }
Process recently registered listeners and calculate which classes need to be transformed with probes that drive the listeners .