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
FieldsModifier and TypeFieldDescriptionprotected booleanSLING-2895: avoid heartbeats after deactivationprotected org.osgi.service.component.ComponentContextkeep a reference to the component contextSLING-4765 : store endpoints to /clusterInstances for more verbose duplicate slingId/ghost detectionprotected final Objectlock object for synchronizing the run methodprotected final org.slf4j.Loggerprotected Stringthe name used for the period job with the schedulerprotected PeriodicBackgroundJobprotected static final Stringprotected static final Stringprotected static final Stringprotected StringSLING-2901: the runtimeId is a unique id, set on activation, used for robust duplicate sling.id detectionprotected Stringthe sling id of the local instance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate(org.osgi.service.component.ComponentContext context) protected voidbindHttpService(org.osgi.framework.ServiceReference reference) Bind a http servicevoidfor testing onlyprotected voidprotected voidprotected voidCheck whether the established view matches the reality, ie matches the heartbeatsprotected abstract AnnouncementRegistryprotected abstract BaseConfigprotected abstract ConnectorRegistryprotected Stringprotected abstract ResourceResolverFactoryprotected abstract Schedulerprotected abstract SlingSettingsServicevoidIssue a heartbeat and check the viewprotected voidIssue a remote heartbeat using the topology connectorsprotected voidIssue a heartbeat.voidrun()voidTrigger the issuance of the next heartbeat asap instead of at next heartbeat intervalprotected voidunbindHttpService(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:
checkViewin interfaceViewChecker
-
run
public void run() -
heartbeatAndCheckView
public void heartbeatAndCheckView()Description copied from interface:ViewCheckerIssue a heartbeat and check the view- Specified by:
heartbeatAndCheckViewin 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
-