Class LuceneAppointmentIndexFactory
- java.lang.Object
-
- fr.paris.lutece.plugins.appointment.modules.management.service.indexer.LuceneAppointmentIndexFactory
-
public class LuceneAppointmentIndexFactory extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LuceneAppointmentIndexFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Release the IndexWriter and its Directory when the Spring context is shut down.org.apache.lucene.store.DirectorygetDirectory()Return the Directory to use for the searchorg.apache.lucene.index.IndexWritergetIndexWriter(java.lang.Boolean bCreateIndex)Create the IndexWriter with its configuration
-
-
-
Method Detail
-
getIndexWriter
public org.apache.lucene.index.IndexWriter getIndexWriter(java.lang.Boolean bCreateIndex)
Create the IndexWriter with its configuration- Parameters:
bCreateIndex- The boolean which tell if the index must be created- Returns:
- the created IndexWriter
- Throws:
java.io.IOException- - if there is a low level IO error
-
close
@PreDestroy public void close()
Release the IndexWriter and its Directory when the Spring context is shut down. The IndexWriter is deliberately kept open for the whole life of the webapp, but it holds a native lock on the index directory ( write.lock ). That lock is registered in the JVM wide lock table, not in the web application : if it is not released when the context is destroyed, a hot redeployment leaves the stale lock behind and the new context fails with OverlappingFileLockException as soon as it tries to index. Invoked by Spring through AppInitListener.contextDestroyed -> SpringContextService.shutdown( ).
-
getDirectory
public org.apache.lucene.store.Directory getDirectory() throws java.io.IOExceptionReturn the Directory to use for the search- Returns:
- the Directory to use for the search
- Throws:
java.io.IOException- - if the path string cannot be converted to a Path
-
-