com.atlassian.jira.issue.index
Interface LuceneConnectionManager

All Known Implementing Classes:
DefaultLuceneConnectionManager

public interface LuceneConnectionManager

Handle the lifecycle management of a LuceneConnection. These are state machines and they MUST be called in the following order:

  1. init(String, boolean, org.apache.lucene.analysis.Analyzer) to point to the physical location
  2. get()
  3. shutdown()
Once a LuceneConnectionManager has been shutdown it MUST be reinited.

The LuceneConnectionManager also can report on its active status with isActive()

A LuceneConnectionManager should be threadsafe, in that calls to get() prior to a shutdown() will return a live LuceneConnection, but the manager cannot guarantee that the connection itself will not be closed during use. Behaviour of the LuceneConnection itself is unspecified here. As well, Direct calls to the ILuceneConnection.close() methods will cause unspecified behaviour and should not be made.


Method Summary
 com.atlassian.bonnie.ILuceneConnection get()
          Get a live LuceneConnection.
 void init(String indexPath, boolean create, org.apache.lucene.analysis.Analyzer analyzer)
          The init parameters for the LuceneConnection.
 boolean isActive()
          Whether the LuceneConnection has been inited and not shutdown.
 void shutdown()
          Close the LuceneConnection and discard it.
 

Method Detail

get

com.atlassian.bonnie.ILuceneConnection get()
                                           throws IllegalStateException
Get a live LuceneConnection. Live means it has not been closed by a call to shutdown().

Returns:
Throws:
IllegalStateException - if isActive() is false

init

void init(String indexPath,
          boolean create,
          org.apache.lucene.analysis.Analyzer analyzer)
The init parameters for the LuceneConnection. This method should be called once when isActive() is false. Subsequent calls once the LuceneConnection is active are ignored.


isActive

boolean isActive()
Whether the LuceneConnection has been inited and not shutdown.


shutdown

void shutdown()
Close the LuceneConnection and discard it. Any subsequent calls to get() should fail, until init(String, boolean, org.apache.lucene.analysis.Analyzer) is invoked.

Subsequent calls to shutdown are ignored.



Copyright © 2002-2007 Atlassian. All Rights Reserved.