private static synchronized Set < OIndexFactory > getFactories ( ) { if ( FACTORIES == null ) { final Iterator < OIndexFactory > ite = lookupProviderWithOrientClassLoader ( OIndexFactory . class , orientClassLoader ) ; final Set < OIndexFactory > factories = new HashSet < OIndexFactory > ( ) ; while ( ite . hasNext ( ) ) { factories . add ( ite . next ( ) ) ; } FACTORIES = Collections . unmodifiableSet ( factories ) ; } return FACTORIES ; }
Cache a set of all factories . we do not use the service loader directly since it is not concurrent .