private void register ( final Bundle bundle ) { LOG . debug ( "Scanning bundle [" + bundle . getSymbolicName ( ) + "]" ) ; final List < T > resources = m_scanner . scan ( bundle ) ; m_mappings . put ( bundle , resources ) ; if ( resources != null && resources . size ( ) > 0 ) { LOG . debug ( "Found resources " + resources ) ; for ( final BundleObserver < T > observer : m_observers ) { try { //here the executor service completes the job in an extra thread. executorService . submit ( new Runnable ( ) { public void run ( ) { try { observer . addingEntries ( bundle , Collections . unmodifiableList ( resources ) ) ; } catch ( Throwable t ) { LOG . error ( "Exception in executor thread" , t ) ; } } } ) ; } catch ( Throwable ignore ) { LOG . error ( "Ignored exception during register" , ignore ) ; } } } }
Scans entries using the bundle scanner and registers the result of scanning process . Then notify the observers . If an exception appears during notification it is ignored .