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:
ResourceChangeListener
public class IdMapService extends AbstractServiceWithBackgroundCheck implements 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 interface org.apache.sling.api.resource.observation.ResourceChangeListener
CHANGES, PATHS, PROPERTY_NAMES_HINT
-
-
Constructor Summary
Constructors Constructor Description IdMapService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()longgetMyId()booleanisInitialized()voidonChange(java.util.List<ResourceChange> changes)Report resource changes based on the filter properties of this listener.static IdMapServicetestConstructor(DiscoveryLiteConfig commonsConfig, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory)test-only constructorjava.lang.StringtoSlingId(int clusterNodeId, ResourceResolver resourceResolver)booleanwaitForInit(long timeout)for testing only
-
-
-
Method Detail
-
testConstructor
public static IdMapService testConstructor(DiscoveryLiteConfig commonsConfig, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory)
test-only constructor
-
getMyId
public long getMyId()
-
waitForInit
public boolean waitForInit(long timeout)
for testing only
-
isInitialized
public boolean isInitialized()
-
clearCache
public void clearCache()
-
toSlingId
public java.lang.String toSlingId(int clusterNodeId, ResourceResolver resourceResolver) throws PersistenceException- Throws:
PersistenceException
-
onChange
public void onChange(java.util.List<ResourceChange> changes)
Description copied from interface:ResourceChangeListenerReport resource changes based on the filter properties of this listener.Starting with version 1.2 of this API, an instance of
ResoureChangeListis passed as the parameter to allow passing additional information.- Specified by:
onChangein interfaceResourceChangeListener- Parameters:
changes- The changes list. This list is immutable.
-
-