Class FileSystemSolrIndexStatusProviderImpl
java.lang.Object
org.broadleafcommerce.core.search.service.solr.FileSystemSolrIndexStatusProviderImpl
- All Implemented Interfaces:
SolrIndexStatusProvider
public class FileSystemSolrIndexStatusProviderImpl
extends Object
implements SolrIndexStatusProvider
XML based Index Status provider. Tracks current index status (last successful event id), events that have error (along with retry count), events that
have exceeded the retry count and are considered dead. Also supports a period purge of the dead events to keep the XML file from growing too large.
- Author:
- Jeff Fischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentBuilderprotected Integerprotected Integerprotected SimpleDateFormatprotected SearchServiceprotected SolrConfigurationprotected XPath -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCommon routine to remove all children nodes from the passed element containerprotected StringgetStatusDirectory(SolrSearchServiceImpl searchService) protected FilegetStatusFile(SolrSearchServiceImpl searchService) voidUpdates the XML file with the index status, error status, and dead event statusprotected voidhandleUpdateIndexStatus(IndexStatusInfo status, boolean clearDeadEvents) Updates the XML file with the index status, error status, and dead event statusprotected voidpurgeDeadEvents(Document document, IndexStatusInfo status) Periodically purges the dead events based on solr.index.status.dead.event.purge.seconds - populating the deadEvents map in the IndexStatusInfo when it does.readIndexStatus(IndexStatusInfo status) Builds the Index Status object.protected voidupdateDeadEventSegment(Document document, Element rootElement, IndexStatusInfo status, boolean clearDeadEvents) Performs the XML building for the dead event segment.protected voidupdateErrorSegment(Document document, Element rootElement, IndexStatusInfo status) Performs the XML building for the error segmentprotected voidupdateIndexSegment(Document document, Element rootElement, IndexStatusInfo status) Performs the XML building for the Index segment
-
Field Details
-
solrConfiguration
@Qualifier("blCatalogSolrConfiguration") @Autowired(required=false) protected SolrConfiguration solrConfiguration -
searchService
-
builder
-
xPath
-
format
-
deadEventTTLSeconds
-
deadEventPurgeCycleSeconds
@Value("${solr.index.status.dead.event.purge.seconds:3600}") protected Integer deadEventPurgeCycleSeconds
-
-
Constructor Details
-
FileSystemSolrIndexStatusProviderImpl
public FileSystemSolrIndexStatusProviderImpl()
-
-
Method Details
-
handleUpdateIndexStatus
Updates the XML file with the index status, error status, and dead event status- Specified by:
handleUpdateIndexStatusin interfaceSolrIndexStatusProvider
-
handleUpdateIndexStatus
Updates the XML file with the index status, error status, and dead event status -
updateIndexSegment
protected void updateIndexSegment(Document document, Element rootElement, IndexStatusInfo status) throws XPathExpressionException, ParseException Performs the XML building for the Index segment- Parameters:
document-rootElement-status-- Throws:
XPathExpressionExceptionParseException
-
updateErrorSegment
protected void updateErrorSegment(Document document, Element rootElement, IndexStatusInfo status) throws XPathExpressionException Performs the XML building for the error segment- Parameters:
document-rootElement-status-- Throws:
XPathExpressionException
-
updateDeadEventSegment
protected void updateDeadEventSegment(Document document, Element rootElement, IndexStatusInfo status, boolean clearDeadEvents) throws XPathExpressionException Performs the XML building for the dead event segment. Note that this only clears the dead event node if specified.- Parameters:
document-rootElement-status-- Throws:
XPathExpressionException
-
clearNode
Common routine to remove all children nodes from the passed element container- Parameters:
parentElement-nodeName-- Throws:
XPathExpressionException
-
readIndexStatus
Builds the Index Status object. Note for efficiency reasons, this typically does not return the Dead Event instances. The exception is if a purge cycle is executed.- Specified by:
readIndexStatusin interfaceSolrIndexStatusProvider
-
purgeDeadEvents
protected void purgeDeadEvents(Document document, IndexStatusInfo status) throws XPathExpressionException, ParseException Periodically purges the dead events based on solr.index.status.dead.event.purge.seconds - populating the deadEvents map in the IndexStatusInfo when it does.- Parameters:
document-status-- Throws:
XPathExpressionExceptionParseException
-
getStatusFile
-
getStatusDirectory
-