Class OakViewChecker
java.lang.Object
org.apache.sling.discovery.base.commons.BaseViewChecker
org.apache.sling.discovery.oak.pinger.OakViewChecker
- All Implemented Interfaces:
Runnable
,ViewChecker
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
Modifier and TypeFieldDescriptionprotected AnnouncementRegistry
protected ConnectorRegistry
protected PeriodicBackgroundJob
protected ResourceResolverFactory
protected Scheduler
protected 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
Check whether the established view matches the reality, ie matches the heartbeatsprotected AnnouncementRegistry
protected BaseConfig
protected ConnectorRegistry
protected ResourceResolverFactory
protected Scheduler
protected SlingSettingsService
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
Hook that will cause a reset of the leaderElectionId on next invocation of issueClusterLocalHeartbeat.static OakViewChecker
testConstructor
(SlingSettingsService slingSettingsService, ResourceResolverFactory resourceResolverFactory, ConnectorRegistry connectorRegistry, AnnouncementRegistry announcementRegistry, Scheduler scheduler, Config config) for testing onlyprotected void
Methods inherited from class org.apache.sling.discovery.base.commons.BaseViewChecker
activate, bindHttpService, checkView, getEndpointsAsString, heartbeatAndCheckView, issueConnectorPings, issueHeartbeat, run, triggerAsyncConnectorPing, unbindHttpService
-
Field Details
-
slingSettingsService
-
resourceResolverFactory
-
connectorRegistry
-
announcementRegistry
-
scheduler
-
periodicCheckViewJob
-
-
Constructor Details
-
OakViewChecker
public OakViewChecker()
-
-
Method Details
-
testConstructor
public static OakViewChecker testConstructor(SlingSettingsService slingSettingsService, ResourceResolverFactory resourceResolverFactory, ConnectorRegistry connectorRegistry, AnnouncementRegistry announcementRegistry, Scheduler scheduler, Config config) for testing only -
getAnnouncementRegistry
- Specified by:
getAnnouncementRegistry
in classBaseViewChecker
-
getConnectorConfig
- Specified by:
getConnectorConfig
in classBaseViewChecker
-
getConnectorRegistry
- Specified by:
getConnectorRegistry
in classBaseViewChecker
-
getResourceResolverFactory
- Specified by:
getResourceResolverFactory
in classBaseViewChecker
-
getScheduler
- Specified by:
getScheduler
in classBaseViewChecker
-
getSlingSettingsService
- Specified by:
getSlingSettingsService
in classBaseViewChecker
-
doActivate
protected void doActivate()- Overrides:
doActivate
in classBaseViewChecker
-
deactivate
protected void deactivate()- Overrides:
deactivate
in classBaseViewChecker
-
initialize
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()Description copied from class:BaseViewChecker
Check whether the established view matches the reality, ie matches the heartbeats- Overrides:
doCheckView
in classBaseViewChecker
-
updateProperties
protected void updateProperties()- Specified by:
updateProperties
in classBaseViewChecker
-