Class OakViewChecker
- java.lang.Object
-
- org.apache.sling.discovery.base.commons.BaseViewChecker
-
- org.apache.sling.discovery.oak.pinger.OakViewChecker
-
- All Implemented Interfaces:
Runnable,org.apache.sling.discovery.base.commons.ViewChecker
public class OakViewChecker extends org.apache.sling.discovery.base.commons.BaseViewCheckerThe 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.AnnouncementRegistryannouncementRegistryprotected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistryconnectorRegistryprotected org.apache.sling.discovery.base.commons.PeriodicBackgroundJobperiodicCheckViewJobprotected org.apache.sling.api.resource.ResourceResolverFactoryresourceResolverFactoryprotected org.apache.sling.commons.scheduler.Schedulerschedulerprotected org.apache.sling.settings.SlingSettingsServiceslingSettingsService
-
Constructor Summary
Constructors Constructor Description OakViewChecker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddeactivate()protected voiddoActivate()protected voiddoCheckView()protected org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistrygetAnnouncementRegistry()protected org.apache.sling.discovery.base.connectors.BaseConfiggetConnectorConfig()protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistrygetConnectorRegistry()protected org.apache.sling.api.resource.ResourceResolverFactorygetResourceResolverFactory()protected org.apache.sling.commons.scheduler.SchedulergetScheduler()protected org.apache.sling.settings.SlingSettingsServicegetSlingSettingsService()voidinitialize(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).booleanresetLeaderElectionId()Hook that will cause a reset of the leaderElectionId on next invocation of issueClusterLocalHeartbeat.static OakViewCheckertestConstructor(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 onlyprotected voidupdateProperties()
-
-
-
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
-
-
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:
getAnnouncementRegistryin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
getConnectorConfig
protected org.apache.sling.discovery.base.connectors.BaseConfig getConnectorConfig()
- Specified by:
getConnectorConfigin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
getConnectorRegistry
protected org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry getConnectorRegistry()
- Specified by:
getConnectorRegistryin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
getResourceResolverFactory
protected org.apache.sling.api.resource.ResourceResolverFactory getResourceResolverFactory()
- Specified by:
getResourceResolverFactoryin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
getScheduler
protected org.apache.sling.commons.scheduler.Scheduler getScheduler()
- Specified by:
getSchedulerin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
getSlingSettingsService
protected org.apache.sling.settings.SlingSettingsService getSlingSettingsService()
- Specified by:
getSlingSettingsServicein classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
doActivate
protected void doActivate()
- Overrides:
doActivatein classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
deactivate
protected void deactivate()
- Overrides:
deactivatein classorg.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:
doCheckViewin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
updateProperties
protected void updateProperties()
- Specified by:
updatePropertiesin classorg.apache.sling.discovery.base.commons.BaseViewChecker
-
-