Class OakBacklogClusterSyncService
java.lang.Object
org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService
- All Implemented Interfaces:
ClusterSyncService
public class OakBacklogClusterSyncService
extends AbstractServiceWithBackgroundCheck
implements ClusterSyncService
The OakBacklogClusterSyncService will wait until all instances
in the local cluster are no longer in any backlog state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DiscoveryLiteConfigprotected ResourceResolverFactoryprotected SlingSettingsServiceFields inherited from class org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
backgroundCheckRunnable, logger, slingId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate()voidprotected DiscoveryLiteConfigprotected ResourceResolverGet or create a ResourceResolverprotected SlingSettingsServicevoidsetConsistencyHistory(ClusterSyncHistory consistencyHistory) voidsync(BaseTopologyView view, Runnable callback) Starts the synchronization process and calls the provided callback upon completion.static OakBacklogClusterSyncServicetestConstructor(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory) for testing only!static OakBacklogClusterSyncServicetestConstructorAndActivate(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory) Methods inherited from class org.apache.sling.discovery.commons.providers.spi.base.AbstractServiceWithBackgroundCheck
cancelPreviousBackgroundCheck, startBackgroundCheck, triggerBackgroundCheck
-
Field Details
-
commonsConfig
-
resourceResolverFactory
-
settingsService
-
-
Constructor Details
-
OakBacklogClusterSyncService
public OakBacklogClusterSyncService()
-
-
Method Details
-
testConstructorAndActivate
public static OakBacklogClusterSyncService testConstructorAndActivate(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory) -
testConstructor
public static OakBacklogClusterSyncService testConstructor(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory) for testing only! -
activate
protected void activate() -
setConsistencyHistory
-
getConsistencyHistory
-
getResourceResolver
Get or create a ResourceResolver- Throws:
LoginException
-
cancelSync
public void cancelSync()- Specified by:
cancelSyncin interfaceClusterSyncService
-
sync
Description copied from interface:ClusterSyncServiceStarts the synchronization process and calls the provided callback upon completion.sync() is not thread-safe and should not be invoked concurrently.
If sync() gets called before a previous invocation finished, that previous invocation will be discarded, ie the callback of the previous invocation will no longer be called.
The synchronization process consists of making sure that the repository has processed any potential backlog of instances that are no longer part of the provided, new view. Plus it writes a 'sync-token' to a well-defined location, with all peers doing the same, and upon seeing all other sync-tokens declares successful completion - at which point it calls the callback.run().
- Specified by:
syncin interfaceClusterSyncService- Parameters:
view- the view which all instances in the local cluster should agree on having seencallback- the runnable which should be called after successful syncing
-
getCommonsConfig
-
getSettingsService
-
getSyncHistory
-