WeakHashMap<Configuration, SearchFactoryImpl> contextMap = contexts.get();
if ( contextMap == null ) {
contextMap = new WeakHashMap<Configuration, SearchFactoryImpl>( 2 );
contexts.set( contextMap );
}
SearchFactoryImpl searchFactory = contextMap.get( cfg );
if ( searchFactory == null ) {
searchFactory = new SearchFactoryImpl( new SearchConfigurationFromHibernateCore( cfg ) );
contextMap.put( cfg, searchFactory );
}
return searchFactory;
}