Class AbstractTracker

    • 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.SOLRAPIClient client  
      protected java.lang.String coreName  
      protected java.util.Properties props  
      protected boolean rollback  
      protected java.lang.Throwable rollbackCausedBy
      When rollback is set, original error is also gathered in order to provide detailed logging.
      protected int shardCount  
      protected int shardInstance  
      protected java.util.Optional<java.lang.String> shardKey
      The string representation of the shard key.
      protected java.util.Optional<org.alfresco.service.namespace.QName> shardProperty
      The property to use for determining the shard.
      protected org.alfresco.solr.TrackerState state  
      protected java.lang.String trackerId  
      protected boolean transformContent  
      protected Tracker.Type type  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      org.alfresco.solr.NodeReport checkNode​(java.lang.Long dbid)
      Returns information about the Node associated with the given dbid.
      protected abstract void doTrack​(java.lang.String iterationId)
      Subclasses must implement behaviour that completes the following steps, in order: Purge Reindex Index Track repository
      DocRouter getDocRouter()
      Returns the DocRouter instance in use on this node.
      java.util.Properties getProps()  
      boolean getRollback()  
      java.lang.Throwable getRollbackCausedBy()  
      abstract java.util.concurrent.Semaphore getRunLock()
      Trackers implementing this method should decide if the Run Lock is applied globally for every Tracker Thread (static) or locally for each running Thread
      org.alfresco.solr.TrackerState getTrackerState()  
      Tracker.Type getType()  
      abstract java.util.concurrent.Semaphore getWriteLock()
      Trackers implementing this method should decide if the Write Lock is applied globally for every Tracker Thread (static) or locally for each running Thread
      void invalidateState()  
      boolean isAlreadyInShutDownMode()  
      void setRollback​(boolean rollback, java.lang.Throwable rollbackCausedBy)  
      void setShutdown​(boolean shutdown)  
      void shutdown()  
      void track()
      Template method - subclasses must implement the Tracker-specific indexing by implementing the abstract method doTrack(String).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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
      • rollbackCausedBy

        protected java.lang.Throwable rollbackCausedBy
        When rollback is set, original error is also gathered in order to provide detailed logging.
      • 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 the ShardStatePublisher and MetadataTracker. 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 the ShardStatePublisher and MetadataTracker. 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.Throwable
        Subclasses must implement behaviour that completes the following steps, in order:
        1. Purge
        2. Reindex
        3. Index
        4. 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 the Tracker-specific indexing by implementing the abstract method doTrack(String).
        Specified by:
        track in interface Tracker
      • getRollback

        public boolean getRollback()
        Specified by:
        getRollback in interface Tracker
      • setRollback

        public void setRollback​(boolean rollback,
                                java.lang.Throwable rollbackCausedBy)
        Specified by:
        setRollback in interface Tracker
      • getTrackerState

        public org.alfresco.solr.TrackerState getTrackerState()
        Specified by:
        getTrackerState in interface Tracker
      • setShutdown

        public void setShutdown​(boolean shutdown)
        Specified by:
        setShutdown in interface Tracker
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface Tracker
      • getWriteLock

        public abstract java.util.concurrent.Semaphore getWriteLock()
        Trackers 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:
        getWriteLock in interface Tracker
      • getRunLock

        public abstract java.util.concurrent.Semaphore getRunLock()
        Trackers implementing this method should decide if the Run Lock is applied globally for every Tracker Thread (static) or locally for each running Thread
      • getProps

        public java.util.Properties getProps()
        Specified by:
        getProps in interface Tracker
      • checkNode

        public org.alfresco.solr.NodeReport checkNode​(java.lang.Long dbid)
        Returns information about the Node associated with the given dbid.
        Parameters:
        dbid - the node identifier.
        Returns:
        the Node associated with the given dbid.
      • getDocRouter

        public DocRouter getDocRouter()
        Returns the DocRouter instance in use on this node.
        Returns:
        the DocRouter instance in use on this node.