mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Part 2 of ALF-9413 RSOLR 022: Fine-grained control of full-text indexing
- big switch to turn off content indexing is working for lucene sub-system - catches up (eventually) via FTS as expected - includes further improvements to subsystem shutdown which also relates to: ALF-9079 RSOLR 019: Lucene to SOLR switchover administration - lucene indexes can be deleted after subsystem shutdown - at subsystem star the index rebuilds if required and restarts FTS on load - subsystem shutdown requires more work if two lucene subsytems are ever to exist together - does not shutdown existing IndexInfo work nicely -> possible exceptions as IndexInfo resources are cremoved and cleaned up from those expecting them to be there ... may regrab resourcse git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29097 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -139,23 +139,36 @@ import com.werken.saxpath.XPathReader;
|
|||||||
*/
|
*/
|
||||||
public class IndexInfo implements IndexMonitor
|
public class IndexInfo implements IndexMonitor
|
||||||
{
|
{
|
||||||
public static void destroy()
|
public static synchronized void destroy()
|
||||||
{
|
{
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
timer = new Timer(true);
|
timer = new Timer(true);
|
||||||
for(IndexInfo indexInfo : indexInfos.values())
|
for(IndexInfo indexInfo : indexInfos.values())
|
||||||
{
|
{
|
||||||
|
indexInfo.destroyInstance();
|
||||||
|
}
|
||||||
|
indexInfos.clear();
|
||||||
|
ReferenceCountingReadOnlyIndexReaderFactory.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroyInstance()
|
||||||
|
{
|
||||||
|
getWriteLock();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((ReferenceCounting) indexInfo.mainIndexReader).setInvalidForReuse();
|
if(mainIndexReader != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
((ReferenceCounting) mainIndexReader).setInvalidForReuse();
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
// OK filed to close
|
// OK filed to close
|
||||||
}
|
}
|
||||||
indexInfo.mainIndexReader = null;
|
mainIndexReader = null;
|
||||||
|
|
||||||
for(IndexReader reader : indexInfo.referenceCountingReadOnlyIndexReaders.values())
|
for(IndexReader reader : referenceCountingReadOnlyIndexReaders.values())
|
||||||
{
|
{
|
||||||
ReferenceCounting referenceCounting = (ReferenceCounting) reader;
|
ReferenceCounting referenceCounting = (ReferenceCounting) reader;
|
||||||
try
|
try
|
||||||
@@ -168,8 +181,9 @@ public class IndexInfo implements IndexMonitor
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(IndexReader reader : indexInfo.indexReaders.values())
|
for(IndexReader reader : indexReaders.values())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -181,8 +195,9 @@ public class IndexInfo implements IndexMonitor
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
indexReaders.clear();
|
||||||
|
|
||||||
for(IndexWriter writer : indexInfo.indexWriters.values())
|
for(IndexWriter writer : indexWriters.values())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -199,9 +214,41 @@ public class IndexInfo implements IndexMonitor
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
indexWriters.clear();
|
||||||
|
|
||||||
|
if(indexInfoRAF != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
indexInfoRAF.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(indexInfoBackupRAF != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
indexInfoBackupRAF.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: should set some running flag .... to abort ungoing stuff
|
||||||
|
// at the moment it will die ungracefully ....
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
releaseWriteLock();
|
||||||
}
|
}
|
||||||
indexInfos.clear();
|
|
||||||
ReferenceCountingReadOnlyIndexReaderFactory.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String MAIN_READER = "MainReader";
|
public static final String MAIN_READER = "MainReader";
|
||||||
|
Reference in New Issue
Block a user