Class BaseViewChecker
java.lang.Object
org.apache.sling.discovery.base.commons.BaseViewChecker
- All Implemented Interfaces:
Runnable
,ViewChecker
- Direct Known Subclasses:
OakViewChecker
The heartbeat handler is responsible and capable of issuing both local and
remote heartbeats and registers a periodic job with the scheduler for doing so.
Local heartbeats are stored in the repository. Remote heartbeats are POSTs to remote TopologyConnectorServlets.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
SLING-2895: avoid heartbeats after deactivationprotected org.osgi.service.component.ComponentContext
keep a reference to the component contextSLING-4765 : store endpoints to /clusterInstances for more verbose duplicate slingId/ghost detectionprotected final Object
lock object for synchronizing the run methodprotected final org.slf4j.Logger
protected String
the name used for the period job with the schedulerprotected PeriodicBackgroundJob
protected static final String
protected static final String
protected static final String
protected String
SLING-2901: the runtimeId is a unique id, set on activation, used for robust duplicate sling.id detectionprotected String
the sling id of the local instance -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate
(org.osgi.service.component.ComponentContext context) protected void
bindHttpService
(org.osgi.framework.ServiceReference reference) Bind a http servicevoid
for testing onlyprotected void
protected void
protected void
Check whether the established view matches the reality, ie matches the heartbeatsprotected abstract AnnouncementRegistry
protected abstract BaseConfig
protected abstract ConnectorRegistry
protected String
protected abstract ResourceResolverFactory
protected abstract Scheduler
protected abstract SlingSettingsService
void
Issue a heartbeat and check the viewprotected void
Issue a remote heartbeat using the topology connectorsprotected void
Issue a heartbeat.void
run()
void
Trigger the issuance of the next heartbeat asap instead of at next heartbeat intervalprotected void
unbindHttpService
(org.osgi.framework.ServiceReference reference) Unbind a http serviceprotected abstract void
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
PROPERTY_ID_ENDPOINTS
- See Also:
-
PROPERTY_ID_SLING_HOME_PATH
- See Also:
-
PROPERTY_ID_RUNTIME
- See Also:
-
NAME
the name used for the period job with the scheduler -
slingId
the sling id of the local instance -
runtimeId
SLING-2901: the runtimeId is a unique id, set on activation, used for robust duplicate sling.id detection -
lock
lock object for synchronizing the run method -
activated
protected volatile boolean activatedSLING-2895: avoid heartbeats after deactivation -
context
protected org.osgi.service.component.ComponentContext contextkeep a reference to the component context -
endpoints
SLING-4765 : store endpoints to /clusterInstances for more verbose duplicate slingId/ghost detection -
periodicPingJob
-
-
Constructor Details
-
BaseViewChecker
public BaseViewChecker()
-
-
Method Details
-
getSlingSettingsService
-
getResourceResolverFactory
-
getConnectorRegistry
-
getAnnouncementRegistry
-
getScheduler
-
getConnectorConfig
-
activate
protected void activate(org.osgi.service.component.ComponentContext context) -
doActivate
protected void doActivate() -
deactivate
protected void deactivate() -
checkView
public void checkView()for testing only- Specified by:
checkView
in interfaceViewChecker
-
run
public void run() -
heartbeatAndCheckView
public void heartbeatAndCheckView()Description copied from interface:ViewChecker
Issue a heartbeat and check the view- Specified by:
heartbeatAndCheckView
in interfaceViewChecker
-
triggerAsyncConnectorPing
public void triggerAsyncConnectorPing()Trigger the issuance of the next heartbeat asap instead of at next heartbeat interval -
issueHeartbeat
protected void issueHeartbeat()Issue a heartbeat.This action consists of first updating the local properties, then issuing a cluster-local heartbeat (within the repository) and then a remote heartbeat (to all the topology connectors which announce this part of the topology to others)
-
updateProperties
protected abstract void updateProperties() -
issueConnectorPings
protected void issueConnectorPings()Issue a remote heartbeat using the topology connectors -
doCheckView
protected void doCheckView()Check whether the established view matches the reality, ie matches the heartbeats -
bindHttpService
protected void bindHttpService(org.osgi.framework.ServiceReference reference) Bind a http service -
unbindHttpService
protected void unbindHttpService(org.osgi.framework.ServiceReference reference) Unbind a http service -
getEndpointsAsString
-