private synchronized Resource [ ] internalGet ( String pattern ) { Resource [ ] resources = cache . get ( pattern ) ; if ( resources != null ) { return resources ; } try { resources = resolver . getResources ( pattern ) ; } catch ( IOException e ) { throw MiscUtil . toUnchecked ( e ) ; } if ( resources == null ) { resources = new Resource [ 0 ] ; } else { Arrays . sort ( resources , resourceComparator ) ; } cache . put ( pattern , resources ) ; return resources ; }
Use application context to enumerate resources . This call is thread safe .