Class OakViewChecker

  • All Implemented Interfaces:
    Runnable, org.apache.sling.discovery.base.commons.ViewChecker

    public class OakViewChecker
    extends org.apache.sling.discovery.base.commons.BaseViewChecker
    The OakViewChecker is taking care of checking the oak discovery-lite descriptor when checking the local cluster view and passing that on to the ViewStateManager which will then detect whether there was any change or not. Unlike discovery.impl's HeartbeatHandler this one does not store any heartbeats in the repository anymore.

    Remote heartbeats are POSTs to remote TopologyConnectorServlets using discovery.base

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry announcementRegistry  
      protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry connectorRegistry  
      protected org.apache.sling.discovery.base.commons.PeriodicBackgroundJob periodicCheckViewJob  
      protected org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory  
      protected org.apache.sling.commons.scheduler.Scheduler scheduler  
      protected org.apache.sling.settings.SlingSettingsService slingSettingsService  
      • Fields inherited from class org.apache.sling.discovery.base.commons.BaseViewChecker

        activated, context, endpoints, lock, logger, NAME, periodicPingJob, PROPERTY_ID_ENDPOINTS, PROPERTY_ID_RUNTIME, PROPERTY_ID_SLING_HOME_PATH, runtimeId, slingId
    • Constructor Summary

      Constructors 
      Constructor Description
      OakViewChecker()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void deactivate()  
      protected void doActivate()  
      protected void doCheckView()  
      protected org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry getAnnouncementRegistry()  
      protected org.apache.sling.discovery.base.connectors.BaseConfig getConnectorConfig()  
      protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry getConnectorRegistry()  
      protected org.apache.sling.api.resource.ResourceResolverFactory getResourceResolverFactory()  
      protected org.apache.sling.commons.scheduler.Scheduler getScheduler()  
      protected org.apache.sling.settings.SlingSettingsService getSlingSettingsService()  
      void initialize​(OakDiscoveryService discoveryService)
      The initialize method is called by the OakDiscoveryService.activate as we require the discoveryService (and the discoveryService has a reference on us - but we cant have circular references in osgi).
      boolean resetLeaderElectionId()
      Hook that will cause a reset of the leaderElectionId on next invocation of issueClusterLocalHeartbeat.
      static OakViewChecker testConstructor​(org.apache.sling.settings.SlingSettingsService slingSettingsService, org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory, org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry connectorRegistry, org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry announcementRegistry, org.apache.sling.commons.scheduler.Scheduler scheduler, Config config)
      for testing only
      protected void updateProperties()  
      • Methods inherited from class org.apache.sling.discovery.base.commons.BaseViewChecker

        activate, bindHttpService, checkView, getEndpointsAsString, heartbeatAndCheckView, issueConnectorPings, issueHeartbeat, run, triggerAsyncConnectorPing, unbindHttpService
    • Field Detail

      • slingSettingsService

        protected org.apache.sling.settings.SlingSettingsService slingSettingsService
      • resourceResolverFactory

        protected org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory
      • connectorRegistry

        protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry connectorRegistry
      • announcementRegistry

        protected org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry announcementRegistry
      • scheduler

        protected org.apache.sling.commons.scheduler.Scheduler scheduler
      • periodicCheckViewJob

        protected org.apache.sling.discovery.base.commons.PeriodicBackgroundJob periodicCheckViewJob
    • Constructor Detail

      • OakViewChecker

        public OakViewChecker()
    • Method Detail

      • testConstructor

        public static OakViewChecker testConstructor​(org.apache.sling.settings.SlingSettingsService slingSettingsService,
                                                     org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory,
                                                     org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry connectorRegistry,
                                                     org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry announcementRegistry,
                                                     org.apache.sling.commons.scheduler.Scheduler scheduler,
                                                     Config config)
        for testing only
      • getAnnouncementRegistry

        protected org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry getAnnouncementRegistry()
        Specified by:
        getAnnouncementRegistry in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • getConnectorConfig

        protected org.apache.sling.discovery.base.connectors.BaseConfig getConnectorConfig()
        Specified by:
        getConnectorConfig in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • getConnectorRegistry

        protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry getConnectorRegistry()
        Specified by:
        getConnectorRegistry in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • getResourceResolverFactory

        protected org.apache.sling.api.resource.ResourceResolverFactory getResourceResolverFactory()
        Specified by:
        getResourceResolverFactory in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • getScheduler

        protected org.apache.sling.commons.scheduler.Scheduler getScheduler()
        Specified by:
        getScheduler in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • getSlingSettingsService

        protected org.apache.sling.settings.SlingSettingsService getSlingSettingsService()
        Specified by:
        getSlingSettingsService in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • doActivate

        protected void doActivate()
        Overrides:
        doActivate in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • deactivate

        protected void deactivate()
        Overrides:
        deactivate in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • initialize

        public void initialize​(OakDiscoveryService discoveryService)
        The initialize method is called by the OakDiscoveryService.activate as we require the discoveryService (and the discoveryService has a reference on us - but we cant have circular references in osgi).
      • resetLeaderElectionId

        public boolean resetLeaderElectionId()
        Hook that will cause a reset of the leaderElectionId on next invocation of issueClusterLocalHeartbeat.
        Returns:
        true if the leaderElectionId was reset - false if that was not necessary as that happened earlier already and it has not propagated yet to the ./clusterInstances in the meantime
      • doCheckView

        protected void doCheckView()
        Overrides:
        doCheckView in class org.apache.sling.discovery.base.commons.BaseViewChecker
      • updateProperties

        protected void updateProperties()
        Specified by:
        updateProperties in class org.apache.sling.discovery.base.commons.BaseViewChecker