Class IdMapService
java.lang.Object
org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
org.apache.sling.discovery.commons.providers.spi.base.IdMapService
- All Implemented Interfaces:
org.apache.sling.api.resource.observation.ResourceChangeListener
public class IdMapService
extends AbstractServiceWithBackgroundCheck
implements org.apache.sling.api.resource.observation.ResourceChangeListener
The IdMapService is responsible for storing a slingId-clusterNodeId
pair to the repository and given all other instances in the cluster
do the same can map clusterNodeIds to slingIds (or vice-versa)
-
Field Summary
Fields inherited from class org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
backgroundCheckRunnable, logger
Fields inherited from interface org.apache.sling.api.resource.observation.ResourceChangeListener
CHANGES, PATHS, PROPERTY_NAMES_HINT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
activate
(org.osgi.framework.BundleContext bundleContext) void
protected void
long
getMyId()
boolean
void
static IdMapService
testConstructor
(DiscoveryLiteConfig commonsConfig, org.apache.sling.settings.SlingSettingsService settingsService, org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory) test-only constructortoSlingId
(int clusterNodeId, org.apache.sling.api.resource.ResourceResolver resourceResolver) boolean
waitForInit
(long timeout) for testing onlyMethods inherited from class org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
cancelPreviousBackgroundCheck, startBackgroundCheck, triggerBackgroundCheck
-
Constructor Details
-
IdMapService
public IdMapService()
-
-
Method Details
-
testConstructor
public static IdMapService testConstructor(DiscoveryLiteConfig commonsConfig, org.apache.sling.settings.SlingSettingsService settingsService, org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory) test-only constructor -
activate
protected void activate(org.osgi.framework.BundleContext bundleContext) -
deactivate
protected void deactivate() -
getMyId
public long getMyId() -
waitForInit
public boolean waitForInit(long timeout) for testing only -
isInitialized
public boolean isInitialized() -
clearCache
public void clearCache() -
toSlingId
public String toSlingId(int clusterNodeId, org.apache.sling.api.resource.ResourceResolver resourceResolver) throws org.apache.sling.api.resource.PersistenceException - Throws:
org.apache.sling.api.resource.PersistenceException
-
onChange
- Specified by:
onChange
in interfaceorg.apache.sling.api.resource.observation.ResourceChangeListener
-