在使用hibernate search建立索引时发现的一个有关问题

在使用hibernate search建立索引时发现的一个问题
       我程序里有14个实体类,数据库里表是17个,没有任何数据,之前三个实体的时候没有问题,但今天用hibernate search建立索引时,用junit测试时会有大概30%左右的概率会出现卡死的现象。然后在tomcat中运行,每次必卡死。跟踪了一下源码,发现hibernate search在建立索引的时候在运行BatchCoordinator这个类的dobatchwork方法的时候卡住的。
       源码中是用ExecutorService,利用java的线程池来执行多个线程,每个线程分别对每个实体建立索引。
       在debug的时候,发现如果挨个执行的话,是没有问题的。但如果一起执行的话,就会有问题。具体原因不明,看了一下最新的4.2版的源码,这个地方没变。所以为了能用,我只好采用比较极端的处理办法,把这里多线程并发执行改成挨个执行,效率可想而知会受到影响,不过考虑到只是建立索引的话问题不大,就是不知道会不会影响其他的,目前就是这种处理办法了。
       下为源码(未改动)
private void doBatchWork() throws InterruptedException {
		ExecutorService executor = Executors.newFixedThreadPool( rootEntities.length, "BatchIndexingWorkspace" );
		for ( Class<?> type : rootEntities ) {
			executor.execute(
					new BatchIndexingWorkspace(
							searchFactoryImplementor, sessionFactory, type,
							objectLoadingThreads, collectionLoadingThreads,
							cacheMode, objectLoadingBatchSize,
							endAllSignal, monitor, backend, objectsLimit
					)
			);
		}
		executor.shutdown();
		endAllSignal.await(); //waits for the executor to finish
	}