public class OakBacklogClusterSyncService extends AbstractServiceWithBackgroundCheck implements ClusterSyncService
Modifier and Type | Field and Description |
---|---|
protected DiscoveryLiteConfig |
commonsConfig |
protected ResourceResolverFactory |
resourceResolverFactory |
protected SlingSettingsService |
settingsService |
backgroundCheckRunnable, logger, slingId
Constructor and Description |
---|
OakBacklogClusterSyncService() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate() |
void |
cancelSync() |
protected DiscoveryLiteConfig |
getCommonsConfig() |
ClusterSyncHistory |
getConsistencyHistory() |
protected ResourceResolver |
getResourceResolver()
Get or create a ResourceResolver
|
protected SlingSettingsService |
getSettingsService() |
java.util.List<java.lang.String> |
getSyncHistory() |
void |
setConsistencyHistory(ClusterSyncHistory consistencyHistory) |
void |
sync(BaseTopologyView view,
java.lang.Runnable callback)
Starts the synchronization process and calls the provided
callback upon completion.
|
static OakBacklogClusterSyncService |
testConstructor(DiscoveryLiteConfig commonsConfig,
IdMapService idMapService,
SlingSettingsService settingsService,
ResourceResolverFactory resourceResolverFactory)
for testing only!
|
static OakBacklogClusterSyncService |
testConstructorAndActivate(DiscoveryLiteConfig commonsConfig,
IdMapService idMapService,
SlingSettingsService settingsService,
ResourceResolverFactory resourceResolverFactory) |
cancelPreviousBackgroundCheck, startBackgroundCheck, triggerBackgroundCheck
protected DiscoveryLiteConfig commonsConfig
protected ResourceResolverFactory resourceResolverFactory
protected SlingSettingsService settingsService
public static OakBacklogClusterSyncService testConstructorAndActivate(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory)
public static OakBacklogClusterSyncService testConstructor(DiscoveryLiteConfig commonsConfig, IdMapService idMapService, SlingSettingsService settingsService, ResourceResolverFactory resourceResolverFactory)
protected void activate()
public void setConsistencyHistory(ClusterSyncHistory consistencyHistory)
public ClusterSyncHistory getConsistencyHistory()
protected ResourceResolver getResourceResolver() throws LoginException
LoginException
public void cancelSync()
cancelSync
in interface ClusterSyncService
public void sync(BaseTopologyView view, java.lang.Runnable callback)
ClusterSyncService
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().
sync
in interface ClusterSyncService
view
- the view which all instances in the local cluster
should agree on having seencallback
- the runnable which should be called after
successful syncingprotected DiscoveryLiteConfig getCommonsConfig()
protected SlingSettingsService getSettingsService()
public java.util.List<java.lang.String> getSyncHistory()
Copyright © 2018 The Apache Software Foundation. All rights reserved.