public MassIndexer createIndexer(Class<?>... types) {
//We shouldn't expose the ServiceManager in phases other than startup or teardown, that's why the cast is required.
//Exceptionally, this very specific case is fine. TODO: cleanup this mess.
MutableSearchFactory msf = (MutableSearchFactory) getSearchFactoryImplementor();
ServiceManager serviceManager = msf.getServiceManager();
MassIndexerFactory service = serviceManager.requestService( MassIndexerFactoryProvider.class, null );
try {
return service.createMassIndexer( getSearchFactoryImplementor(), getFactory(), types );
}
finally {
serviceManager.releaseService( MassIndexerFactoryProvider.class );