|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.index.DefaultLuceneConnectionManager
public class DefaultLuceneConnectionManager
Default implementation of the LuceneConnectionManager
interface.
This implemetation guarantees that any threads calling get()
after
a call to shutdown()
will fail.
ILuceneConnection
is delegated to
a LuceneConnectionFactory
.
Note: It uses a ThreadsafeLazyLoadedReference
hold the the LuceneConnection.
This class lazily loads the connection when it is first requested (ie. on the first
call to get()
rather than during init(String, boolean, org.apache.lucene.analysis.Analyzer)
.
As the LuceneConnection needs to be cleared when shutdown we throw away the
LuceneConnection reference when shutdown, and for thread safety we hold the lazy load
reference inside an AtomicReference. It is important to remember that due to this, the
LuceneConnection is doubly dereferenced. AtomicRef -> ThreadsafyLazyLoadedRef -> LuceneConnection.
Constructor Summary | |
---|---|
DefaultLuceneConnectionManager(LuceneConnectionFactory connectionFactory)
Construct a new object. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
DefaultLuceneConnectionManager(LuceneConnectionFactory connectionFactory) throws NullPointerException
connectionFactory
- to use for actual construction of a ILuceneConnection
instance
NullPointerException
- if the LuceneConnectionFactory is nullMethod Detail |
---|
public com.atlassian.bonnie.ILuceneConnection get()
LuceneConnectionManager
LuceneConnectionManager.shutdown()
.
get
in interface LuceneConnectionManager
public void init(String indexPath, boolean create, org.apache.lucene.analysis.Analyzer analyzer)
LuceneConnectionManager
LuceneConnectionManager.isActive()
is false. Subsequent calls once the LuceneConnection
is active are ignored.
init
in interface LuceneConnectionManager
public boolean isActive()
LuceneConnectionManager
isActive
in interface LuceneConnectionManager
public void shutdown()
LuceneConnectionManager
LuceneConnectionManager.get()
should fail, until LuceneConnectionManager.init(String, boolean, org.apache.lucene.analysis.Analyzer)
is invoked.
Subsequent calls to shutdown are ignored.
shutdown
in interface LuceneConnectionManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |