Package org.alfresco.solr.tracker
Class AbstractTracker
- java.lang.Object
-
- org.alfresco.solr.tracker.AbstractTracker
-
- All Implemented Interfaces:
Tracker
- Direct Known Subclasses:
ActivatableTracker,CommitTracker,ModelTracker,ShardStatePublisher
public abstract class AbstractTracker extends java.lang.Object implements Tracker
Abstract base class that provides commonTrackerbehaviour.- Author:
- Matt Ward
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.solr.tracker.Tracker
Tracker.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected org.alfresco.solr.client.SOLRAPIClientclientprotected java.lang.StringcoreNameprotected org.slf4j.Loggerloggerprotected java.util.Propertiespropsprotected booleanrollbackprotected intshardCountprotected intshardInstanceprotected java.util.Optional<java.lang.String>shardKeyThe string representation of the shard key.protected java.util.Optional<org.alfresco.service.namespace.QName>shardPropertyThe property to use for determining the shard.protected org.alfresco.solr.TrackerStatestateprotected java.lang.StringtrackerIdprotected booleantransformContentprotected Tracker.Typetype
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTracker(java.util.Properties p, org.alfresco.solr.client.SOLRAPIClient client, java.lang.String coreName, InformationServer informationServer, Tracker.Type type)protectedAbstractTracker(Tracker.Type type)Default constructor, strictly for testing.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.alfresco.solr.NodeReportcheckNode(java.lang.Long dbid)Returns information about theNodeassociated with the given dbid.protected abstract voiddoTrack(java.lang.String iterationId)Subclasses must implement behaviour that completes the following steps, in order: Purge Reindex Index Track repositoryDocRoutergetDocRouter()Returns theDocRouterinstance in use on this node.java.util.PropertiesgetProps()booleangetRollback()org.alfresco.solr.TrackerStategetTrackerState()Tracker.TypegetType()java.util.concurrent.SemaphoregetWriteLock()voidinvalidateState()booleanisAlreadyInShutDownMode()voidsetRollback(boolean rollback)voidsetShutdown(boolean shutdown)voidshutdown()voidtrack()Template method - subclasses must implement theTracker-specific indexing by implementing the abstract methoddoTrack(String).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.alfresco.solr.tracker.Tracker
hasMaintenance, maintenance
-
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
props
protected java.util.Properties props
-
client
protected org.alfresco.solr.client.SOLRAPIClient client
-
coreName
protected java.lang.String coreName
-
state
protected volatile org.alfresco.solr.TrackerState state
-
shardCount
protected int shardCount
-
shardInstance
protected int shardInstance
-
transformContent
protected boolean transformContent
-
rollback
protected volatile boolean rollback
-
type
protected final Tracker.Type type
-
trackerId
protected final java.lang.String trackerId
-
shardProperty
protected java.util.Optional<org.alfresco.service.namespace.QName> shardProperty
The property to use for determining the shard. Note that this property is not used by all trackers, it is actually managed by theShardStatePublisherandMetadataTracker. We put this property here because otherwise we should introduce another supertype layer for those two trackers.
-
shardKey
protected java.util.Optional<java.lang.String> shardKey
The string representation of the shard key. Note that this property is not used by all trackers, it is actually managed by theShardStatePublisherandMetadataTracker. We put this property here because otherwise we should introduce another supertype layer for those two trackers.
-
-
Constructor Detail
-
AbstractTracker
protected AbstractTracker(Tracker.Type type)
Default constructor, strictly for testing.
-
AbstractTracker
protected AbstractTracker(java.util.Properties p, org.alfresco.solr.client.SOLRAPIClient client, java.lang.String coreName, InformationServer informationServer, Tracker.Type type)
-
-
Method Detail
-
doTrack
protected abstract void doTrack(java.lang.String iterationId) throws java.lang.ThrowableSubclasses must implement behaviour that completes the following steps, in order:- Purge
- Reindex
- Index
- Track repository
- Parameters:
iterationId- an identifier which is uniquely associated with a given iteration.- Throws:
java.lang.Throwable
-
track
public void track()
Template method - subclasses must implement theTracker-specific indexing by implementing the abstract methoddoTrack(String).
-
getRollback
public boolean getRollback()
- Specified by:
getRollbackin interfaceTracker
-
setRollback
public void setRollback(boolean rollback)
- Specified by:
setRollbackin interfaceTracker
-
invalidateState
public void invalidateState()
- Specified by:
invalidateStatein interfaceTracker
-
getTrackerState
public org.alfresco.solr.TrackerState getTrackerState()
- Specified by:
getTrackerStatein interfaceTracker
-
isAlreadyInShutDownMode
public boolean isAlreadyInShutDownMode()
- Specified by:
isAlreadyInShutDownModein interfaceTracker
-
setShutdown
public void setShutdown(boolean shutdown)
- Specified by:
setShutdownin interfaceTracker
-
getWriteLock
public java.util.concurrent.Semaphore getWriteLock()
- Specified by:
getWriteLockin interfaceTracker
-
getType
public Tracker.Type getType()
-
checkNode
public org.alfresco.solr.NodeReport checkNode(java.lang.Long dbid)
Returns information about theNodeassociated with the given dbid.- Parameters:
dbid- the node identifier.- Returns:
- the
Nodeassociated with the given dbid.
-
-