public abstract class AbstractReindexComponent extends Object implements IndexRecovery
reindexImpl()
,
getIndexerWriteLock()
,
isShuttingDown()
Modifier and Type | Class and Description |
---|---|
static class |
AbstractReindexComponent.InIndex |
protected static interface |
AbstractReindexComponent.ReindexNodeCallback
Callback to notify caller whenever a node has been indexed
|
static class |
AbstractReindexComponent.ReindexTerminatedException
Marker exception to neatly handle VM-driven termination of a reindex
|
Modifier and Type | Field and Description |
---|---|
protected FullTextSearchIndexer |
ftsIndexer
the FTS indexer that we will prompt to pick up on any un-indexed text
|
protected Indexer |
indexer
the component to index the node hierarchy
|
protected NodeDAO |
nodeDAO
the component giving direct access to transaction instances
|
protected org.alfresco.service.cmr.repository.NodeService |
nodeService
the component giving direct access to store instances
|
protected org.alfresco.service.cmr.search.SearchService |
searcher
the component providing searches of the indexed nodes
|
protected TransactionServiceImpl |
transactionService
provides transactions to atomically index each missed transaction
|
Constructor and Description |
---|
AbstractReindexComponent() |
Modifier and Type | Method and Description |
---|---|
protected <T2> T2 |
doInRetryingTransaction(RetryingTransactionHelper.RetryingTransactionCallback<T2> callback,
boolean isReadThrough)
To allow for possible 'read committed' behaviour in some databases, where a node that previously existed during a
transaction can disappear from existence, we treat InvalidNodeRefExceptions as concurrency conditions.
|
protected ReentrantReadWriteLock.WriteLock |
getIndexerWriteLock()
Convenience method to get a common write lock.
|
boolean |
isIgnorableStore(org.alfresco.service.cmr.repository.StoreRef storeRef)
Find out if a store is ignored by the indexing code
|
protected boolean |
isShuttingDown() |
AbstractReindexComponent.InIndex |
isTxnPresentInIndex(Transaction txn)
Determines if a given transaction is definitely in the index or not.
|
AbstractReindexComponent.InIndex |
isTxnPresentInIndex(Transaction txn,
boolean readThrough) |
void |
reindex()
If this object is currently busy, then it just nothing
|
protected abstract void |
reindexImpl()
Perform the actual work.
|
protected void |
reindexTransaction(long txnId,
AbstractReindexComponent.ReindexNodeCallback callback,
boolean isFull)
Perform a full reindexing of the given transaction on the current thread.
|
protected void |
reindexTransaction(Long txnId,
boolean isFull) |
protected void |
reindexTransactionAsynchronously(List<Long> txnIds,
boolean isFull)
Performs indexing off the current thread, which may return quickly if there are threads immediately
available in the thread pool.
|
protected boolean |
requireTransaction()
Determines if calls to
reindexImpl() should be wrapped in a transaction or not. |
void |
setAuthenticationComponent(AuthenticationComponent authenticationComponent)
No longer required
|
void |
setFtsIndexer(FullTextSearchIndexer ftsIndexer) |
void |
setIndexer(Indexer indexer) |
void |
setNodeDAO(NodeDAO nodeDAO) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setSearcher(org.alfresco.service.cmr.search.SearchService searcher) |
void |
setShutdown(boolean shutdown)
Programmatically notify a reindex thread to terminate
|
void |
setStoreProtocolsToIgnore(List<String> storeProtocolsToIgnore) |
void |
setStoresToIgnore(List<String> storesToIgnore) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor)
Set the thread pool to use when doing asynchronous reindexing.
|
void |
setTransactionService(TransactionServiceImpl transactionService)
Set the low-level transaction component to use
|
protected void |
waitForAsynchronousReindexing()
Wait for all asynchronous indexing to finish before returning.
|
protected TransactionServiceImpl transactionService
protected Indexer indexer
protected FullTextSearchIndexer ftsIndexer
protected org.alfresco.service.cmr.search.SearchService searcher
protected org.alfresco.service.cmr.repository.NodeService nodeService
protected NodeDAO nodeDAO
protected ReentrantReadWriteLock.WriteLock getIndexerWriteLock()
public void setShutdown(boolean shutdown)
shutdown
- true to shutdown, false to resetprotected boolean isShuttingDown()
shut down
public void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
public void setTransactionService(TransactionServiceImpl transactionService)
transactionService
- provide transactions to index each missed transactionpublic void setIndexer(Indexer indexer)
indexer
- the indexer that will be indexpublic void setFtsIndexer(FullTextSearchIndexer ftsIndexer)
ftsIndexer
- the FTS background indexerpublic void setSearcher(org.alfresco.service.cmr.search.SearchService searcher)
searcher
- component providing index searchespublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- provides information about nodes for indexingpublic void setNodeDAO(NodeDAO nodeDAO)
nodeDAO
- provides access to transaction-related queriespublic void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor)
threadPoolExecutor
- a pre-configured thread pool for the reindex workpublic void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setStoreProtocolsToIgnore(List<String> storeProtocolsToIgnore)
storeProtocolsToIgnore
- a list of store protocols that will be ignored
by the index check code e.g. 'deleted' in 'deleted://MyStore'public void setStoresToIgnore(List<String> storesToIgnore)
storesToIgnore
- a list of store references that will be ignored
by the index check code e.g. 'test://TestOne'public boolean isIgnorableStore(org.alfresco.service.cmr.repository.StoreRef storeRef)
storeRef
- the store to checkprotected boolean requireTransaction()
reindexImpl()
should be wrapped in a transaction or not.
The default is true.protected abstract void reindexImpl()
protected <T2> T2 doInRetryingTransaction(RetryingTransactionHelper.RetryingTransactionCallback<T2> callback, boolean isReadThrough)
public final void reindex()
reindex
in interface IndexRecovery
public AbstractReindexComponent.InIndex isTxnPresentInIndex(Transaction txn)
txn
- a specific transactionpublic AbstractReindexComponent.InIndex isTxnPresentInIndex(Transaction txn, boolean readThrough)
protected void reindexTransaction(Long txnId, boolean isFull)
protected void reindexTransaction(long txnId, AbstractReindexComponent.ReindexNodeCallback callback, boolean isFull)
txnId
- the transaction identifiercallback
- the callback to notify of each node indexedAbstractReindexComponent.ReindexTerminatedException
- if the VM is shutdown during the reindexprotected void reindexTransactionAsynchronously(List<Long> txnIds, boolean isFull)
Commits are guaranteed to occur in the order in which this reindex jobs are added to the queue.
reindexTransaction(Long, boolean)
,
waitForAsynchronousReindexing()
protected void waitForAsynchronousReindexing()
Copyright © 2005–2017 Alfresco Software. All rights reserved.