Class DefaultSnIndexerStrategy
- java.lang.Object
-
- de.hybris.platform.searchservices.indexer.service.impl.DefaultSnIndexerStrategy
-
- All Implemented Interfaces:
SnIndexerStrategy,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class DefaultSnIndexerStrategy extends java.lang.Object implements SnIndexerStrategy, org.springframework.context.ApplicationContextAware
Default implementation forSnIndexerStrategy.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDefaultSnIndexerStrategy.IndexerBatchprotected static classDefaultSnIndexerStrategy.IndexerBatchGroupprotected static classDefaultSnIndexerStrategy.IndexerBatchWrapper
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_INDEXER_THREAD_POOL_SIZEprotected static intDEFAULT_MAX_INDEXER_BATCH_RETRIESprotected static intDEFAULT_MAX_INDEXER_BATCH_SIZEprotected static intDEFAULT_MAX_INDEXER_RETRIES
-
Constructor Summary
Constructors Constructor Description DefaultSnIndexerStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultSnIndexerStrategy.IndexerBatchGroupbuildIndexerBatchGroup(SnIndexerContext indexerContext, SnDocumentOperationType documentOperationType, java.util.List<PK> indexerItemSourcePks, int batchIndex, int maxBatchSize)protected DefaultSnIndexerStrategy.IndexerBatchGroupbuildIndexerBatchGroup(SnIndexerContext indexerContext, java.util.List<SnIndexerItemSourceOperation> batchIndexerItemSourceOperations, int batchIndex, int batchSize)protected java.util.List<DefaultSnIndexerStrategy.IndexerBatchGroup>buildIndexerBatchGroups(SnIndexerContext indexerContext)protected java.lang.StringbuildIndexerBatchId(int batchIndex)protected java.util.concurrent.ExecutorServicecreateIndexerBatchExecutor(int threadPoolSize)protected SnIndexerBatchRunnablecreateIndexerBatchRunnable(SnIndexerContext indexerContext, java.util.List<SnIndexerItemSourceOperation> indexerItemSourceOperations, java.lang.String indexerBatchId)protected SnIndexerResponsecreateIndexerResponse(SnIndexerContext indexerContext, java.lang.Integer totalItems, java.lang.Integer processedItems)protected SnIndexerResponsedoExecute(SnIndexerContext indexerContext, java.util.List<DefaultSnIndexerStrategy.IndexerBatchGroup> indexerBatchGroups)SnIndexerResponseexecute(SnIndexerRequest indexerRequest)Executes the indexer batch request.protected voidexecuteAfterIndexErrorListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners)protected voidexecuteAfterIndexListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners)protected voidexecuteBeforeIndexListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners)protected java.lang.StringextractErrorMessage(java.lang.Exception exception)protected org.springframework.context.ApplicationContextgetApplicationContext()java.lang.StringgetIndexerBatchRunnableId()SnIndexerContextFactorygetSnIndexerContextFactory()SnIndexServicegetSnIndexService()SnListenerFactorygetSnListenerFactory()SnSearchProviderFactorygetSnSearchProviderFactory()SnSessionServicegetSnSessionService()protected java.util.List<SnIndexerItemSourceOperation>joinAndDedupIndexerItemSourceOperations(SnIndexerContext indexerContext)protected voidrunIndexerBatches(SnIndexerContext indexerContext, java.util.concurrent.ExecutorCompletionService<java.lang.String> completionService, int retriesLeft, java.util.List<DefaultSnIndexerStrategy.IndexerBatchWrapper> batches, java.util.List<DefaultSnIndexerStrategy.IndexerBatchWrapper> completedBatches)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetIndexerBatchRunnableId(java.lang.String batchRunnableBeanId)voidsetSnIndexerContextFactory(SnIndexerContextFactory snIndexerContextFactory)voidsetSnIndexService(SnIndexService snIndexService)voidsetSnListenerFactory(SnListenerFactory snListenerFactory)voidsetSnSearchProviderFactory(SnSearchProviderFactory snSearchProviderFactory)voidsetSnSessionService(SnSessionService snSessionService)protected voidupdateIndexerOperationStatusQuietly(SnIndexerContext indexerContext, SnIndexerOperationStatus status, java.lang.Exception exception)
-
-
-
Field Detail
-
DEFAULT_INDEXER_THREAD_POOL_SIZE
protected static final int DEFAULT_INDEXER_THREAD_POOL_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_INDEXER_BATCH_SIZE
protected static final int DEFAULT_MAX_INDEXER_BATCH_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_INDEXER_BATCH_RETRIES
protected static final int DEFAULT_MAX_INDEXER_BATCH_RETRIES
- See Also:
- Constant Field Values
-
DEFAULT_MAX_INDEXER_RETRIES
protected static final int DEFAULT_MAX_INDEXER_RETRIES
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public SnIndexerResponse execute(SnIndexerRequest indexerRequest) throws SnIndexerException
Description copied from interface:SnIndexerStrategyExecutes the indexer batch request.- Specified by:
executein interfaceSnIndexerStrategy- Parameters:
indexerRequest- - the indexer request- Returns:
- the indexer response
- Throws:
SnIndexerException- if an error occurs
-
updateIndexerOperationStatusQuietly
protected void updateIndexerOperationStatusQuietly(SnIndexerContext indexerContext, SnIndexerOperationStatus status, java.lang.Exception exception)
-
extractErrorMessage
protected java.lang.String extractErrorMessage(java.lang.Exception exception)
-
executeBeforeIndexListeners
protected void executeBeforeIndexListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners) throws SnException
- Throws:
SnException
-
executeAfterIndexListeners
protected void executeAfterIndexListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners) throws SnException
- Throws:
SnException
-
executeAfterIndexErrorListeners
protected void executeAfterIndexErrorListeners(SnIndexerContext indexerContext, java.util.List<SnIndexerListener> listeners)
-
buildIndexerBatchGroups
protected java.util.List<DefaultSnIndexerStrategy.IndexerBatchGroup> buildIndexerBatchGroups(SnIndexerContext indexerContext) throws SnIndexerException
- Throws:
SnIndexerException
-
joinAndDedupIndexerItemSourceOperations
protected java.util.List<SnIndexerItemSourceOperation> joinAndDedupIndexerItemSourceOperations(SnIndexerContext indexerContext) throws SnIndexerException
- Throws:
SnIndexerException
-
buildIndexerBatchGroup
protected DefaultSnIndexerStrategy.IndexerBatchGroup buildIndexerBatchGroup(SnIndexerContext indexerContext, java.util.List<SnIndexerItemSourceOperation> batchIndexerItemSourceOperations, int batchIndex, int batchSize)
-
buildIndexerBatchGroup
protected DefaultSnIndexerStrategy.IndexerBatchGroup buildIndexerBatchGroup(SnIndexerContext indexerContext, SnDocumentOperationType documentOperationType, java.util.List<PK> indexerItemSourcePks, int batchIndex, int maxBatchSize)
-
buildIndexerBatchId
protected java.lang.String buildIndexerBatchId(int batchIndex)
-
doExecute
protected SnIndexerResponse doExecute(SnIndexerContext indexerContext, java.util.List<DefaultSnIndexerStrategy.IndexerBatchGroup> indexerBatchGroups) throws SnIndexerException
- Throws:
SnIndexerException
-
createIndexerBatchExecutor
protected java.util.concurrent.ExecutorService createIndexerBatchExecutor(int threadPoolSize)
-
createIndexerBatchRunnable
protected SnIndexerBatchRunnable createIndexerBatchRunnable(SnIndexerContext indexerContext, java.util.List<SnIndexerItemSourceOperation> indexerItemSourceOperations, java.lang.String indexerBatchId) throws SnIndexerException
- Throws:
SnIndexerException
-
runIndexerBatches
protected void runIndexerBatches(SnIndexerContext indexerContext, java.util.concurrent.ExecutorCompletionService<java.lang.String> completionService, int retriesLeft, java.util.List<DefaultSnIndexerStrategy.IndexerBatchWrapper> batches, java.util.List<DefaultSnIndexerStrategy.IndexerBatchWrapper> completedBatches) throws SnIndexerException
- Throws:
SnIndexerException
-
createIndexerResponse
protected SnIndexerResponse createIndexerResponse(SnIndexerContext indexerContext, java.lang.Integer totalItems, java.lang.Integer processedItems)
-
getSnSessionService
public SnSessionService getSnSessionService()
-
setSnSessionService
public void setSnSessionService(SnSessionService snSessionService)
-
getSnIndexerContextFactory
public SnIndexerContextFactory getSnIndexerContextFactory()
-
setSnIndexerContextFactory
public void setSnIndexerContextFactory(SnIndexerContextFactory snIndexerContextFactory)
-
getSnIndexService
public SnIndexService getSnIndexService()
-
setSnIndexService
public void setSnIndexService(SnIndexService snIndexService)
-
getSnListenerFactory
public SnListenerFactory getSnListenerFactory()
-
setSnListenerFactory
public void setSnListenerFactory(SnListenerFactory snListenerFactory)
-
getSnSearchProviderFactory
public SnSearchProviderFactory getSnSearchProviderFactory()
-
setSnSearchProviderFactory
public void setSnSearchProviderFactory(SnSearchProviderFactory snSearchProviderFactory)
-
getIndexerBatchRunnableId
public java.lang.String getIndexerBatchRunnableId()
-
setIndexerBatchRunnableId
public void setIndexerBatchRunnableId(java.lang.String batchRunnableBeanId)
-
getApplicationContext
protected org.springframework.context.ApplicationContext getApplicationContext()
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
-