为什么会发生这种异常? Lucene例外

时间:2012-08-17 16:23:22

标签: java database lucene connection-pooling

我们的应用程序每两个小时左右崩溃一次,我们看到数据库连接在它之前出现峰值。尚未分离出这个问题。

有人可以回答以下例外的真正含义,并且可以解决数据库连接问题。

谢谢。

org.compass.core.engine.SearchEngineException: Failed to open writer for sub index [premiumobjectmessage]; nested exception is org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock
org.compass.core.engine.SearchEngineException: Failed to open writer for sub index [premiumobjectmessage]; nested exception is org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock
org.compass.core.engine.SearchEngineException: Failed to open writer for sub index [premiumobjectmessage]; nested exception is org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/opt/compass/index/premiumobjectmessage/lucene-9af515d29c67db8ae587aab2becbc6f3-write.lock

1 个答案:

答案 0 :(得分:1)

这源于想要打开相同FSDirectory的多个线程/进程。也许每个拥有自己的数据库连接的线程也会创建自己的IndexReader,这是一种错误的方法。 IndexReader s / IndexSearcher必须像数据库连接本身一样进行池化,最好使用NRTManager