Package org.alfresco.solr.tracker
Class ShardStatePublisher
- java.lang.Object
-
- org.alfresco.solr.tracker.AbstractTracker
-
- org.alfresco.solr.tracker.ShardStatePublisher
-
- All Implemented Interfaces:
Tracker
public class ShardStatePublisher extends AbstractTracker
Despite belonging to the Tracker ecosystem, this component is actually a publisher, which periodically informs Alfresco about the state of the hosting core. This has been introduced in SEARCH-1752 for splitting the dual responsibility of theMetadataTracker. As consequence of that, this class contains only the members needed for obtaining a validShardStatethat can be periodically communicated to Alfresco.- Since:
- 1.5
- Author:
- Andrea Gazzarini
- See Also:
- SEARCH-1752
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.solr.tracker.Tracker
Tracker.Type
-
-
Field Summary
-
Fields inherited from class org.alfresco.solr.tracker.AbstractTracker
client, coreName, props, rollback, rollbackCausedBy, shardCount, shardInstance, shardKey, shardProperty, state, trackerId, transformContent, type
-
-
Constructor Summary
Constructors Constructor Description ShardStatePublisher(boolean isMaster, Properties p, org.alfresco.solr.client.SOLRAPIClient client, String coreName, InformationServer informationServer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoTrack(String iterationId)Subclasses must implement behaviour that completes the following steps, in order: Purge Reindex Index Track repositorySemaphoregetRunLock()Trackers implementing this method should decide if the Run Lock is applied globally for every Tracker Thread (static) or locally for each running Threadorg.alfresco.solr.TrackerStategetTrackerState()When running in a slave mode, we need to recreate the tracker state every time.SemaphoregetWriteLock()Trackers implementing this method should decide if the Write Lock is applied globally for every Tracker Thread (static) or locally for each running ThreadbooleanhasMaintenance()booleanisOnMasterOrStandalone()Returns true if the hosting core is master or standalone.voidmaintenance()-
Methods inherited from class org.alfresco.solr.tracker.AbstractTracker
checkNode, getDocRouter, getProps, getRollback, getRollbackCausedBy, getType, invalidateState, isAlreadyInShutDownMode, setRollback, setShutdown, shutdown, track
-
-
-
-
Constructor Detail
-
ShardStatePublisher
public ShardStatePublisher(boolean isMaster, Properties p, org.alfresco.solr.client.SOLRAPIClient client, String coreName, InformationServer informationServer)
-
-
Method Detail
-
doTrack
protected void doTrack(String iterationId)
Description copied from class:AbstractTrackerSubclasses must implement behaviour that completes the following steps, in order:- Purge
- Reindex
- Index
- Track repository
- Specified by:
doTrackin classAbstractTracker- Parameters:
iterationId- an identifier which is uniquely associated with a given iteration.
-
maintenance
public void maintenance()
-
hasMaintenance
public boolean hasMaintenance()
-
getTrackerState
public org.alfresco.solr.TrackerState getTrackerState()
When running in a slave mode, we need to recreate the tracker state every time. This because in that context we don't have any tracker updating the state (e.g. lastIndexedChangeSetCommitTime, lastIndexedChangeSetId)- Specified by:
getTrackerStatein interfaceTracker- Overrides:
getTrackerStatein classAbstractTracker- Returns:
- a new, fresh and up to date instance of
TrackerState.
-
getWriteLock
public Semaphore getWriteLock()
Description copied from class:AbstractTrackerTrackers implementing this method should decide if the Write Lock is applied globally for every Tracker Thread (static) or locally for each running Thread- Specified by:
getWriteLockin interfaceTracker- Specified by:
getWriteLockin classAbstractTracker
-
getRunLock
public Semaphore getRunLock()
Description copied from class:AbstractTrackerTrackers implementing this method should decide if the Run Lock is applied globally for every Tracker Thread (static) or locally for each running Thread- Specified by:
getRunLockin classAbstractTracker
-
isOnMasterOrStandalone
public boolean isOnMasterOrStandalone()
Returns true if the hosting core is master or standalone.- Returns:
- true if the hosting core is master or standalone.
-
-