You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2015/10/23 13:50:06 UTC
svn commit: r1710183 - in /sling/trunk/bundles/extensions/discovery:
commons/src/main/java/org/apache/sling/discovery/commons/providers/
commons/src/main/java/org/apache/sling/discovery/commons/providers/base/
commons/src/main/java/org/apache/sling/dis...
Author: stefanegli
Date: Fri Oct 23 11:50:05 2015
New Revision: 1710183
URL: http://svn.apache.org/viewvc?rev=1710183&view=rev
Log:
SLING-5191 / SLING-4603 : rename ConsistencyService to ClusterSyncService - plus making timeout/interval values for the same configurable in discovery.oak
Added:
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ClusterSyncService.java
- copied, changed from r1710041, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java
- copied, changed from r1710047, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyHistory.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncServiceChain.java
- copied, changed from r1710041, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyServiceChain.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java
- copied, changed from r1710047, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenService.java
- copied, changed from r1710133, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenService.java
- copied, changed from r1710175, sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenConsistencyService.java
Removed:
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyHistory.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyServiceChain.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenConsistencyService.java
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenConsistencyService.java
Modified:
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerFactory.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerImpl.java
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteConfig.java
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/ClusterTest.java
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestMinEventDelayHandler.java
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestViewStateManager.java
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/Config.java
sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java
sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java
sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/its/setup/OakVirtualInstanceBuilder.java
Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/BaseTopologyView.java Fri Oct 23 11:50:05 2015
@@ -52,7 +52,7 @@ public abstract class BaseTopologyView i
/**
* Returns the id that shall be used in the syncToken
- * by the ConsistencyService.
+ * by the ClusterSyncService.
* <p>
* The clusterSyncId uniquely identifies each change
* of the local cluster for all participating instances.
@@ -72,7 +72,7 @@ public abstract class BaseTopologyView i
* of the TopologyView for all participating instances
* in the whole topology).
* <p>
- * This id can further safely be used by the ConsistencyService
+ * This id can further safely be used by the ClusterSyncService
* to identify a syncToken that it writes and that all
* other instances in the lcoal cluster wait for, before
* sending a TOPOLOGY_CHANGED event.
Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java Fri Oct 23 11:50:05 2015
@@ -26,7 +26,7 @@ import org.apache.sling.discovery.Topolo
* The ViewStateManager is at the core of managing TopologyEventListeners,
* the 'view state' (changing vs changed) and sending out the appropriate
* and according TopologyEvents to the registered listeners - depending
- * on the implementation it also supports the ConsistencyService, which is
+ * on the implementation it also supports the ClusterSyncService, which is
* invoked on handleNewView.
*/
public interface ViewStateManager {
Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerFactory.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerFactory.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerFactory.java Fri Oct 23 11:50:05 2015
@@ -21,7 +21,7 @@ package org.apache.sling.discovery.commo
import java.util.concurrent.locks.Lock;
import org.apache.sling.discovery.commons.providers.ViewStateManager;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
/**
* Used to create an implementation classes of type ViewStateManager
@@ -31,7 +31,7 @@ import org.apache.sling.discovery.common
public class ViewStateManagerFactory {
public static ViewStateManager newViewStateManager(Lock lock,
- ConsistencyService consistencyService) {
+ ClusterSyncService consistencyService) {
return new ViewStateManagerImpl(lock, consistencyService);
}
Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerImpl.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerImpl.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/base/ViewStateManagerImpl.java Fri Oct 23 11:50:05 2015
@@ -36,7 +36,7 @@ import org.apache.sling.discovery.Topolo
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
import org.apache.sling.discovery.commons.providers.EventHelper;
import org.apache.sling.discovery.commons.providers.ViewStateManager;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory;
* <p>
* Note re synchronization: this class rquires a lock object to be passed
* in the constructor - this will be applied to all public methods
- * appropriately. Additionally, the ConsistencyService callback will
+ * appropriately. Additionally, the ClusterSyncService callback will
* also be locked using the provided lock object.
*/
public class ViewStateManagerImpl implements ViewStateManager {
@@ -107,12 +107,12 @@ public class ViewStateManagerImpl implem
protected final Lock lock;
/**
- * An optional ConsistencyService can be provided in the constructor which, when set, will
+ * An optional ClusterSyncService can be provided in the constructor which, when set, will
* be invoked upon a new view becoming available (in handleNewView) and the actual
- * TOPOLOGY_CHANGED event will only be sent once the ConsistencyService.sync method
+ * TOPOLOGY_CHANGED event will only be sent once the ClusterSyncService.sync method
* does the according callback (which can be synchronous or asynchronous again).
*/
- private final ConsistencyService consistencyService;
+ private final ClusterSyncService consistencyService;
/**
* A modification counter that increments on each of the following methods:
@@ -123,7 +123,7 @@ public class ViewStateManagerImpl implem
* <li>handleNewView()</li>
* </ul>
* with the intent that - when a consistencyService is set - the callback from the
- * ConsistencyService can check if any of the above methods was invoked - and if so,
+ * ClusterSyncService can check if any of the above methods was invoked - and if so,
* it does not send the TOPOLOGY_CHANGED event due to those new facts that happened
* while it was synching with the repository.
*/
@@ -139,13 +139,13 @@ public class ViewStateManagerImpl implem
/**
* Creates a new ViewStateManager which synchronizes each method with the given
- * lock and which optionally uses the given ConsistencyService to sync the repository
+ * lock and which optionally uses the given ClusterSyncService to sync the repository
* upon handling a new view where an instances leaves the local cluster.
* @param lock the lock to be used - must not be null
- * @param consistencyService optional (ie can be null) - the ConsistencyService to
+ * @param consistencyService optional (ie can be null) - the ClusterSyncService to
* sync the repository upon handling a new view where an instances leaves the local cluster.
*/
- ViewStateManagerImpl(Lock lock, ConsistencyService consistencyService) {
+ ViewStateManagerImpl(Lock lock, ClusterSyncService consistencyService) {
if (lock==null) {
throw new IllegalArgumentException("lock must not be null");
}
@@ -486,10 +486,10 @@ public class ViewStateManagerImpl implem
return true;
}
- final boolean invokeConsistencyService;
+ final boolean invokeClusterSyncService;
if (consistencyService==null) {
- logger.info("handleNewViewNonDelayed: no consistencyService set - continuing directly.");
- invokeConsistencyService = false;
+ logger.info("handleNewViewNonDelayed: no ClusterSyncService set - continuing directly.");
+ invokeClusterSyncService = false;
} else {
// there used to be a distinction between:
// * if no previousView is set, then we should invoke the consistencyService
@@ -503,16 +503,16 @@ public class ViewStateManagerImpl implem
//
// which is a long way of saying: if the consistencyService is configured,
// then we always use it, hence:
- logger.info("handleNewViewNonDelayed: consistencyService set - invoking consistencyService");
- invokeConsistencyService = true;
+ logger.info("handleNewViewNonDelayed: ClusterSyncService set - invoking...");
+ invokeClusterSyncService = true;
}
- if (invokeConsistencyService) {
+ if (invokeClusterSyncService) {
// if "instances from the local cluster have been removed"
// then:
// run the set consistencyService
final int lastModCnt = modCnt;
- logger.info("handleNewViewNonDelayed: invoking waitForAsyncEvents, then consistencyService (modCnt={})", modCnt);
+ logger.info("handleNewViewNonDelayed: invoking waitForAsyncEvents, then clusterSyncService (modCnt={})", modCnt);
asyncEventSender.enqueue(new AsyncEvent() {
@Override
@@ -567,7 +567,7 @@ public class ViewStateManagerImpl implem
});
} else {
- // otherwise we're either told not to use any ConsistencyService
+ // otherwise we're either told not to use any ClusterSyncService
// or using it is not applicable at this stage - so continue
// with sending the TOPOLOGY_CHANGED (or TOPOLOGY_INIT if there
// are any newly bound topology listeners) directly
Copied: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ClusterSyncService.java (from r1710041, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ConsistencyService.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ClusterSyncService.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ClusterSyncService.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ConsistencyService.java&r1=1710041&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ConsistencyService.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/ClusterSyncService.java Fri Oct 23 11:50:05 2015
@@ -21,7 +21,7 @@ package org.apache.sling.discovery.commo
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
/**
- * The ConsistencyService can be used to establish strong
+ * The ClusterSyncService can be used to establish strong
* consistency with the underlying (eventually consistent) repository in use.
* <p>
* The issue is described in length in SLING-4627 - the short
@@ -41,7 +41,7 @@ import org.apache.sling.discovery.common
* to settle before the topology-dependent activity can continue
* </li>
* </ul>
- * Both of these two aspects are handled by this ConsistencyService.
+ * Both of these two aspects are handled by this ClusterSyncService.
* The former one by introducing a 'sync token' that gets written
* to the repository and on receiving it by the peers they know
* that the writing instance is aware of the ongoing change, that
@@ -54,7 +54,7 @@ import org.apache.sling.discovery.common
* is still being deactivated (eg has backlog). So this second
* part is repository dependent.
*/
-public interface ConsistencyService {
+public interface ClusterSyncService {
/**
* Starts the synchronization process and calls the provided
Copied: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java (from r1710047, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyHistory.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyHistory.java&r1=1710047&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyHistory.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncHistory.java Fri Oct 23 11:50:05 2015
@@ -27,7 +27,7 @@ import java.util.List;
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
-public class ConsistencyHistory {
+public class ClusterSyncHistory {
class HistoryEntry {
BaseTopologyView view;
Copied: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncServiceChain.java (from r1710041, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyServiceChain.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncServiceChain.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncServiceChain.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyServiceChain.java&r1=1710041&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ConsistencyServiceChain.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/ClusterSyncServiceChain.java Fri Oct 23 11:50:05 2015
@@ -23,25 +23,25 @@ import java.util.Iterator;
import java.util.List;
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Allows chaining of ConsistencyServices, itself implementing
- * the ConsistencyService interface
+ * Allows chaining of ClusterSyncService, itself implementing
+ * the ClusterSyncService interface
*/
-public class ConsistencyServiceChain implements ConsistencyService {
+public class ClusterSyncServiceChain implements ClusterSyncService {
protected final Logger logger = LoggerFactory.getLogger(getClass());
- private final List<ConsistencyService> chain;
+ private final List<ClusterSyncService> chain;
/**
- * Creates a new chain of ConsistencyServices that calls a
- * cascaded sync with the provided ConsistencyServices.
+ * Creates a new chain of ClusterSyncService that calls a
+ * cascaded sync with the provided ClusterSyncService.
*/
- public ConsistencyServiceChain(ConsistencyService... chain) {
+ public ClusterSyncServiceChain(ClusterSyncService... chain) {
if (chain==null || chain.length==0) {
throw new IllegalArgumentException("chain must be 1 or more");
}
@@ -50,18 +50,18 @@ public class ConsistencyServiceChain imp
@Override
public void sync(BaseTopologyView view, Runnable callback) {
- final Iterator<ConsistencyService> chainIt = chain.iterator();
+ final Iterator<ClusterSyncService> chainIt = chain.iterator();
chainedSync(view, callback, chainIt);
}
private void chainedSync(final BaseTopologyView view, final Runnable callback,
- final Iterator<ConsistencyService> chainIt) {
+ final Iterator<ClusterSyncService> chainIt) {
if (!chainIt.hasNext()) {
logger.debug("doSync: done with sync chain, invoking callback");
callback.run();
return;
}
- ConsistencyService next = chainIt.next();
+ ClusterSyncService next = chainIt.next();
next.sync(view, new Runnable() {
@Override
@@ -74,7 +74,7 @@ public class ConsistencyServiceChain imp
@Override
public void cancelSync() {
- for (ConsistencyService consistencyService : chain) {
+ for (ClusterSyncService consistencyService : chain) {
consistencyService.cancelSync();
}
}
Modified: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteConfig.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteConfig.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteConfig.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/DiscoveryLiteConfig.java Fri Oct 23 11:50:05 2015
@@ -39,12 +39,12 @@ public interface DiscoveryLiteConfig {
* Returns the timeout (in milliseconds) to be used when waiting for the sync tokens or id mapping
* @return the timeout (in milliseconds) to be used when waiting for the sync tokens or id mapping
*/
- long getBgTimeoutMillis();
+ long getClusterSyncServiceTimeoutMillis();
/**
* Returns the interval (in milliseconds) to be used when waiting for the sync tokens or id mapping
* @return the interval (in milliseconds) to be used when waiting for the sync tokens or id mapping
*/
- long getBgIntervalMillis();
+ long getClusterSyncServiceIntervalMillis();
}
Copied: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java (from r1710047, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogConsistencyService.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogConsistencyService.java&r1=1710047&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogConsistencyService.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/OakBacklogClusterSyncService.java Fri Oct 23 11:50:05 2015
@@ -33,16 +33,16 @@ import org.apache.sling.commons.json.JSO
import org.apache.sling.discovery.ClusterView;
import org.apache.sling.discovery.InstanceDescription;
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.apache.sling.settings.SlingSettingsService;
/**
- * The OakBacklogConsistencyService will wait until all instances
+ * The OakBacklogClusterSyncService will wait until all instances
* in the local cluster are no longer in any backlog state.
*/
@Component(immediate = false)
-@Service(value = { ConsistencyService.class, OakBacklogConsistencyService.class })
-public class OakBacklogConsistencyService extends AbstractServiceWithBackgroundCheck implements ConsistencyService {
+@Service(value = { ClusterSyncService.class, OakBacklogClusterSyncService.class })
+public class OakBacklogClusterSyncService extends AbstractServiceWithBackgroundCheck implements ClusterSyncService {
static enum BacklogStatus {
UNDEFINED /* when there was an error retrieving the backlog status with oak */,
@@ -62,14 +62,14 @@ public class OakBacklogConsistencyServic
@Reference
protected SlingSettingsService settingsService;
- private ConsistencyHistory consistencyHistory = new ConsistencyHistory();
+ private ClusterSyncHistory consistencyHistory = new ClusterSyncHistory();
- public static OakBacklogConsistencyService testConstructorAndActivate(
+ public static OakBacklogClusterSyncService testConstructorAndActivate(
final DiscoveryLiteConfig commonsConfig,
final IdMapService idMapService,
final SlingSettingsService settingsService,
ResourceResolverFactory resourceResolverFactory) {
- OakBacklogConsistencyService service = testConstructor(commonsConfig, idMapService, settingsService, resourceResolverFactory);
+ OakBacklogClusterSyncService service = testConstructor(commonsConfig, idMapService, settingsService, resourceResolverFactory);
service.activate();
return service;
}
@@ -86,12 +86,12 @@ public class OakBacklogConsistencyServic
* @throws LoginException when the login for initialization failed
* @throws JSONException when the descriptor wasn't proper json at init time
*/
- public static OakBacklogConsistencyService testConstructor(
+ public static OakBacklogClusterSyncService testConstructor(
final DiscoveryLiteConfig commonsConfig,
final IdMapService idMapService,
final SlingSettingsService settingsService,
ResourceResolverFactory resourceResolverFactory) {
- OakBacklogConsistencyService service = new OakBacklogConsistencyService();
+ OakBacklogClusterSyncService service = new OakBacklogClusterSyncService();
if (commonsConfig == null) {
throw new IllegalArgumentException("commonsConfig must not be null");
}
@@ -114,11 +114,11 @@ public class OakBacklogConsistencyServic
logger.info("activate: activated with slingId="+slingId);
}
- public void setConsistencyHistory(ConsistencyHistory consistencyHistory) {
+ public void setConsistencyHistory(ClusterSyncHistory consistencyHistory) {
this.consistencyHistory = consistencyHistory;
}
- public ConsistencyHistory getConsistencyHistory() {
+ public ClusterSyncHistory getConsistencyHistory() {
return consistencyHistory;
}
@@ -145,7 +145,7 @@ public class OakBacklogConsistencyServic
private void waitWhileBacklog(final BaseTopologyView view, final Runnable runnable) {
// start backgroundChecking until the backlogStatus
// is NO_BACKLOG
- startBackgroundCheck("OakSyncTokenConsistencyService-backlog-waiting", new BackgroundCheck() {
+ startBackgroundCheck("OakBacklogClusterSyncService-backlog-waiting", new BackgroundCheck() {
@Override
public boolean check() {
@@ -173,7 +173,7 @@ public class OakBacklogConsistencyServic
return false;
}
}
- }, runnable, getCommonsConfig().getBgTimeoutMillis(), getCommonsConfig().getBgIntervalMillis());
+ }, runnable, getCommonsConfig().getClusterSyncServiceTimeoutMillis(), getCommonsConfig().getClusterSyncServiceIntervalMillis());
}
private BacklogStatus getBacklogStatus(BaseTopologyView view) {
Copied: sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenService.java (from r1710133, sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenConsistencyService.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenService.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenService.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenConsistencyService.java&r1=1710133&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenConsistencyService.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/base/SyncTokenService.java Fri Oct 23 11:50:05 2015
@@ -31,7 +31,7 @@ import org.apache.sling.api.resource.Res
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.discovery.InstanceDescription;
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.apache.sling.discovery.commons.providers.util.ResourceHelper;
import org.apache.sling.settings.SlingSettingsService;
@@ -46,8 +46,8 @@ import org.apache.sling.settings.SlingSe
* and are aware of the new discoveryLite view.
*/
@Component(immediate = false)
-@Service(value = { ConsistencyService.class, SyncTokenConsistencyService.class })
-public class SyncTokenConsistencyService extends AbstractServiceWithBackgroundCheck implements ConsistencyService {
+@Service(value = { ClusterSyncService.class, SyncTokenService.class })
+public class SyncTokenService extends AbstractServiceWithBackgroundCheck implements ClusterSyncService {
@Reference
protected DiscoveryLiteConfig commonsConfig;
@@ -58,22 +58,22 @@ public class SyncTokenConsistencyService
@Reference
protected SlingSettingsService settingsService;
- protected ConsistencyHistory consistencyHistory = new ConsistencyHistory();
+ protected ClusterSyncHistory clusterSyncHistory = new ClusterSyncHistory();
- public static SyncTokenConsistencyService testConstructorAndActivate(
+ public static SyncTokenService testConstructorAndActivate(
DiscoveryLiteConfig commonsConfig,
ResourceResolverFactory resourceResolverFactory,
SlingSettingsService settingsService) {
- SyncTokenConsistencyService service = testConstructor(commonsConfig, resourceResolverFactory, settingsService);
+ SyncTokenService service = testConstructor(commonsConfig, resourceResolverFactory, settingsService);
service.activate();
return service;
}
- public static SyncTokenConsistencyService testConstructor(
+ public static SyncTokenService testConstructor(
DiscoveryLiteConfig commonsConfig,
ResourceResolverFactory resourceResolverFactory,
SlingSettingsService settingsService) {
- SyncTokenConsistencyService service = new SyncTokenConsistencyService();
+ SyncTokenService service = new SyncTokenService();
if (commonsConfig == null) {
throw new IllegalArgumentException("commonsConfig must not be null");
}
@@ -95,12 +95,12 @@ public class SyncTokenConsistencyService
logger.info("activate: activated with slingId="+slingId);
}
- public void setConsistencyHistory(ConsistencyHistory consistencyHistory) {
- this.consistencyHistory = consistencyHistory;
+ public void setConsistencyHistory(ClusterSyncHistory consistencyHistory) {
+ this.clusterSyncHistory = consistencyHistory;
}
- public ConsistencyHistory getConsistencyHistory() {
- return consistencyHistory;
+ public ClusterSyncHistory getClusterSyncHistory() {
+ return clusterSyncHistory;
}
/** Get or create a ResourceResolver **/
@@ -125,7 +125,7 @@ public class SyncTokenConsistencyService
protected void syncToken(final BaseTopologyView view, final Runnable callback) {
- startBackgroundCheck("SyncTokenConsistencyService", new BackgroundCheck() {
+ startBackgroundCheck("SyncTokenService", new BackgroundCheck() {
@Override
public boolean check() {
@@ -136,14 +136,14 @@ public class SyncTokenConsistencyService
// that they will have to wait until the timeout hits
// so to try to avoid this, retry storing my sync token later:
- consistencyHistory.addHistoryEntry(view, "storing my syncToken ("+localClusterSyncTokenId+")");
+ clusterSyncHistory.addHistoryEntry(view, "storing my syncToken ("+localClusterSyncTokenId+")");
return false;
}
// 2) then check if all others have done the same already
return seenAllSyncTokens(view);
}
- }, callback, commonsConfig.getBgTimeoutMillis(), commonsConfig.getBgIntervalMillis());
+ }, callback, commonsConfig.getClusterSyncServiceTimeoutMillis(), commonsConfig.getClusterSyncServiceIntervalMillis());
}
private boolean storeMySyncToken(String syncTokenId) {
@@ -227,10 +227,10 @@ public class SyncTokenConsistencyService
}
if (!success) {
logger.info("seenAllSyncTokens: not yet seen all expected syncTokens (see above for details)");
- consistencyHistory.addHistoryEntry(view, historyEntry.toString());
+ clusterSyncHistory.addHistoryEntry(view, historyEntry.toString());
return false;
} else {
- consistencyHistory.addHistoryEntry(view, "seen all syncTokens");
+ clusterSyncHistory.addHistoryEntry(view, "seen all syncTokens");
}
resourceResolver.commit();
Modified: sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/ClusterTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/ClusterTest.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/ClusterTest.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/ClusterTest.java Fri Oct 23 11:50:05 2015
@@ -31,7 +31,7 @@ import org.apache.sling.discovery.Topolo
import org.apache.sling.discovery.TopologyEvent.Type;
import org.apache.sling.discovery.commons.providers.BaseTopologyView;
import org.apache.sling.discovery.commons.providers.base.ViewStateManagerImpl;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -59,7 +59,7 @@ public class ClusterTest {
}
private ViewStateManagerImpl newMgr() {
- ViewStateManagerImpl mgr = new ViewStateManagerImpl(new ReentrantLock(), new ConsistencyService() {
+ ViewStateManagerImpl mgr = new ViewStateManagerImpl(new ReentrantLock(), new ClusterSyncService() {
public void sync(BaseTopologyView view, Runnable callback) {
callback.run();
Modified: sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestMinEventDelayHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestMinEventDelayHandler.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestMinEventDelayHandler.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestMinEventDelayHandler.java Fri Oct 23 11:50:05 2015
@@ -32,7 +32,7 @@ import org.apache.sling.discovery.common
import org.apache.sling.discovery.commons.providers.DummyTopologyView;
import org.apache.sling.discovery.commons.providers.EventHelper;
import org.apache.sling.discovery.commons.providers.base.ViewStateManagerImpl;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
@@ -56,7 +56,7 @@ public class TestMinEventDelayHandler {
@Before
public void setup() throws Exception {
- mgr = new ViewStateManagerImpl(new ReentrantLock(), new ConsistencyService() {
+ mgr = new ViewStateManagerImpl(new ReentrantLock(), new ClusterSyncService() {
public void sync(BaseTopologyView view, Runnable callback) {
callback.run();
Modified: sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestViewStateManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestViewStateManager.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestViewStateManager.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/base/TestViewStateManager.java Fri Oct 23 11:50:05 2015
@@ -38,7 +38,7 @@ import org.apache.sling.discovery.common
import org.apache.sling.discovery.commons.providers.DefaultInstanceDescription;
import org.apache.sling.discovery.commons.providers.DummyTopologyView;
import org.apache.sling.discovery.commons.providers.EventHelper;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -49,12 +49,12 @@ public class TestViewStateManager {
private static final Logger logger = LoggerFactory.getLogger(TestViewStateManager.class);
- private class ConsistencyServiceWithSemaphore implements ConsistencyService {
+ private class ClusterSyncServiceWithSemaphore implements ClusterSyncService {
private final Semaphore semaphore;
private final Lock lock;
- public ConsistencyServiceWithSemaphore(Lock lock, Semaphore semaphore) {
+ public ClusterSyncServiceWithSemaphore(Lock lock, Semaphore semaphore) {
this.lock = lock;
this.semaphore = semaphore;
}
@@ -63,9 +63,9 @@ public class TestViewStateManager {
try {
lock.unlock();
try{
- logger.info("ConsistencyServiceWithSemaphore.sync: acquiring lock ...");
+ logger.info("ClusterSyncServiceWithSemaphore.sync: acquiring lock ...");
semaphore.acquire();
- logger.info("ConsistencyServiceWithSemaphore.sync: lock acquired.");
+ logger.info("ClusterSyncServiceWithSemaphore.sync: lock acquired.");
} finally {
lock.lock();
}
@@ -88,7 +88,7 @@ public class TestViewStateManager {
@Before
public void setup() throws Exception {
- mgr = new ViewStateManagerImpl(new ReentrantLock(), new ConsistencyService() {
+ mgr = new ViewStateManagerImpl(new ReentrantLock(), new ClusterSyncService() {
public void sync(BaseTopologyView view, Runnable callback) {
callback.run();
@@ -225,7 +225,7 @@ public class TestViewStateManager {
@Test
public void testCancelSync() throws Exception {
final List<Runnable> syncCallbacks = new LinkedList<Runnable>();
- mgr = new ViewStateManagerImpl(new ReentrantLock(), new ConsistencyService() {
+ mgr = new ViewStateManagerImpl(new ReentrantLock(), new ClusterSyncService() {
public void sync(BaseTopologyView view, Runnable callback) {
synchronized(syncCallbacks) {
@@ -526,7 +526,7 @@ public class TestViewStateManager {
commonsLogger.setLevel(Level.INFO); // change here to DEBUG in case of issues with this test
final Semaphore serviceSemaphore = new Semaphore(0);
final ReentrantLock lock = new ReentrantLock();
- final ConsistencyServiceWithSemaphore cs = new ConsistencyServiceWithSemaphore(lock, serviceSemaphore );
+ final ClusterSyncServiceWithSemaphore cs = new ClusterSyncServiceWithSemaphore(lock, serviceSemaphore );
mgr = new ViewStateManagerImpl(lock, cs);
final DummyListener listener = new DummyListener();
mgr.bind(listener);
@@ -588,7 +588,7 @@ public class TestViewStateManager {
final Semaphore serviceSemaphore = new Semaphore(0);
final Semaphore testSemaphore = new Semaphore(0);
final ReentrantLock lock = new ReentrantLock();
- final ConsistencyServiceWithSemaphore cs = new ConsistencyServiceWithSemaphore(lock, serviceSemaphore );
+ final ClusterSyncServiceWithSemaphore cs = new ClusterSyncServiceWithSemaphore(lock, serviceSemaphore );
mgr = new ViewStateManagerImpl(lock, cs);
final DummyListener listener = new DummyListener();
mgr.bind(listener);
Copied: sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenService.java (from r1710175, sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenConsistencyService.java)
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenService.java?p2=sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenService.java&p1=sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenConsistencyService.java&r1=1710175&r2=1710183&rev=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenConsistencyService.java (original)
+++ sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/base/TestOakSyncTokenService.java Fri Oct 23 11:50:05 2015
@@ -34,13 +34,13 @@ import org.apache.sling.discovery.common
import org.apache.sling.discovery.commons.providers.base.ViewStateManagerFactory;
import org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig;
import org.apache.sling.discovery.commons.providers.spi.base.IdMapService;
-import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService;
import org.apache.sling.jcr.api.SlingRepository;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-public class TestOakSyncTokenConsistencyService {
+public class TestOakSyncTokenService {
private static final String SYNCTOKEN_PATH = "/var/discovery/commons/synctokens";
@@ -71,12 +71,12 @@ public class TestOakSyncTokenConsistency
}
@Override
- public long getBgTimeoutMillis() {
+ public long getClusterSyncServiceTimeoutMillis() {
return bgTimeoutMillis;
}
@Override
- public long getBgIntervalMillis() {
+ public long getClusterSyncServiceIntervalMillis() {
return bgIntervalMillis;
}
@@ -119,7 +119,7 @@ public class TestOakSyncTokenConsistency
public void testOneNode() throws Exception {
DummyTopologyView one = TestHelper.newView(true, slingId1, slingId1, slingId1);
Lock lock = new ReentrantLock();
- OakBacklogConsistencyService cs = OakBacklogConsistencyService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService1, new DummySlingSettingsService(slingId1), factory1);
+ OakBacklogClusterSyncService cs = OakBacklogClusterSyncService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService1, new DummySlingSettingsService(slingId1), factory1);
ViewStateManager vsm = ViewStateManagerFactory.newViewStateManager(lock, cs);
DummyListener l = new DummyListener();
assertEquals(0, l.countEvents());
@@ -145,7 +145,7 @@ public class TestOakSyncTokenConsistency
String slingId2 = UUID.randomUUID().toString();
DummyTopologyView two1 = TestHelper.newView(true, slingId1, slingId1, slingId1, slingId2);
Lock lock1 = new ReentrantLock();
- OakBacklogConsistencyService cs1 = OakBacklogConsistencyService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService1, new DummySlingSettingsService(slingId1), factory1);
+ OakBacklogClusterSyncService cs1 = OakBacklogClusterSyncService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService1, new DummySlingSettingsService(slingId1), factory1);
ViewStateManager vsm1 = ViewStateManagerFactory.newViewStateManager(lock1, cs1);
DummyListener l = new DummyListener();
vsm1.bind(l);
@@ -161,7 +161,7 @@ public class TestOakSyncTokenConsistency
Lock lock2 = new ReentrantLock();
IdMapService idMapService2 = IdMapService.testConstructor(
new SimpleCommonsConfig(), new DummySlingSettingsService(slingId2), factory2);
- OakBacklogConsistencyService cs2 = OakBacklogConsistencyService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService2, new DummySlingSettingsService(slingId2), factory2);
+ OakBacklogClusterSyncService cs2 = OakBacklogClusterSyncService.testConstructorAndActivate(new SimpleCommonsConfig(), idMapService2, new DummySlingSettingsService(slingId2), factory2);
ViewStateManager vsm2 = ViewStateManagerFactory.newViewStateManager(lock2, cs2);
cs1.triggerBackgroundCheck();
cs2.triggerBackgroundCheck();
Modified: sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java (original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java Fri Oct 23 11:50:05 2015
@@ -543,12 +543,12 @@ public class Config implements BaseConfi
}
@Override
- public long getBgTimeoutMillis() {
+ public long getClusterSyncServiceTimeoutMillis() {
return -1;
}
@Override
- public long getBgIntervalMillis() {
+ public long getClusterSyncServiceIntervalMillis() {
return 1000;
}
Modified: sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java (original)
+++ sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java Fri Oct 23 11:50:05 2015
@@ -61,7 +61,7 @@ import org.apache.sling.discovery.common
import org.apache.sling.discovery.commons.providers.DefaultInstanceDescription;
import org.apache.sling.discovery.commons.providers.ViewStateManager;
import org.apache.sling.discovery.commons.providers.base.ViewStateManagerFactory;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
import org.apache.sling.discovery.commons.providers.spi.base.IdMapService;
import org.apache.sling.discovery.commons.providers.util.PropertyNameHelper;
import org.apache.sling.discovery.commons.providers.util.ResourceHelper;
@@ -161,7 +161,7 @@ public class DiscoveryServiceImpl extend
public DiscoveryServiceImpl() {
viewStateManagerLock = new ReentrantLock();
- final ConsistencyService consistencyService = new ConsistencyService() {
+ final ClusterSyncService consistencyService = new ClusterSyncService() {
@Override
public void sync(BaseTopologyView view, Runnable callback) {
Modified: sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/Config.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/Config.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/Config.java (original)
+++ sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/Config.java Fri Oct 23 11:50:05 2015
@@ -73,6 +73,16 @@ public class Config implements BaseConfi
public static final String DISCOVERY_LITE_CHECK_INTERVAL_KEY = "discoveryLiteCheckInterval";
protected long discoveryLiteCheckInterval = DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL;
+ public static final long DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT = 120;
+ @Property(longValue=DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT)
+ public static final String CLUSTER_SYNC_SERVICE_TIMEOUT_KEY = "clusterSyncServiceTimeout";
+ protected long clusterSyncServiceTimeout = DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT;
+
+ public static final long DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL = 2;
+ @Property(longValue=DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL)
+ public static final String CLUSTER_SYNC_SERVICE_INTERVAL_KEY = "clusterSyncServiceInterval";
+ protected long clusterSyncServiceInterval = DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL;
+
/**
* If set to true a syncToken will be used on top of waiting for
* deactivating instances to be fully processed.
@@ -234,6 +244,17 @@ public class Config implements BaseConfi
logger.debug("configure: discoveryLiteCheckInterval='{}'",
this.discoveryLiteCheckInterval);
+ this.clusterSyncServiceTimeout = PropertiesUtil.toLong(
+ properties.get(CLUSTER_SYNC_SERVICE_TIMEOUT_KEY),
+ DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT);
+ logger.debug("configure: clusterSyncServiceTimeout='{}'",
+ this.clusterSyncServiceTimeout);
+
+ this.clusterSyncServiceInterval = PropertiesUtil.toLong(
+ properties.get(CLUSTER_SYNC_SERVICE_INTERVAL_KEY),
+ DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT);
+ logger.debug("configure: clusterSyncServiceInterval='{}'",
+ this.clusterSyncServiceInterval);
this.minEventDelay = PropertiesUtil.toInteger(
properties.get(MIN_EVENT_DELAY_KEY),
@@ -473,15 +494,13 @@ public class Config implements BaseConfi
}
@Override
- public long getBgTimeoutMillis() {
- // TODO: currently hard coded
- return -1;
+ public long getClusterSyncServiceTimeoutMillis() {
+ return clusterSyncServiceTimeout * 1000;
}
@Override
- public long getBgIntervalMillis() {
- // TODO: currently hard coded
- return 1000;
+ public long getClusterSyncServiceIntervalMillis() {
+ return clusterSyncServiceInterval * 1000;
}
public boolean getSyncTokenEnabled() {
Modified: sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java (original)
+++ sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java Fri Oct 23 11:50:05 2015
@@ -60,12 +60,12 @@ import org.apache.sling.discovery.common
import org.apache.sling.discovery.commons.providers.DefaultInstanceDescription;
import org.apache.sling.discovery.commons.providers.ViewStateManager;
import org.apache.sling.discovery.commons.providers.base.ViewStateManagerFactory;
-import org.apache.sling.discovery.commons.providers.spi.ConsistencyService;
-import org.apache.sling.discovery.commons.providers.spi.base.ConsistencyHistory;
-import org.apache.sling.discovery.commons.providers.spi.base.ConsistencyServiceChain;
+import org.apache.sling.discovery.commons.providers.spi.ClusterSyncService;
+import org.apache.sling.discovery.commons.providers.spi.base.ClusterSyncHistory;
+import org.apache.sling.discovery.commons.providers.spi.base.ClusterSyncServiceChain;
import org.apache.sling.discovery.commons.providers.spi.base.IdMapService;
-import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogConsistencyService;
-import org.apache.sling.discovery.commons.providers.spi.base.SyncTokenConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService;
+import org.apache.sling.discovery.commons.providers.spi.base.SyncTokenService;
import org.apache.sling.discovery.commons.providers.util.PropertyNameHelper;
import org.apache.sling.discovery.commons.providers.util.ResourceHelper;
import org.apache.sling.discovery.oak.pinger.OakViewChecker;
@@ -133,10 +133,10 @@ public class OakDiscoveryService extends
private IdMapService idMapService;
@Reference
- private OakBacklogConsistencyService oakBacklogConsistencyService;
+ private OakBacklogClusterSyncService oakBacklogClusterSyncService;
@Reference
- private SyncTokenConsistencyService syncTokenConsistencyService;
+ private SyncTokenService syncTokenService;
/** the slingId of the local instance **/
private String slingId;
@@ -157,8 +157,8 @@ public class OakDiscoveryService extends
OakViewChecker connectorPinger,
Scheduler scheduler,
IdMapService idMapService,
- OakBacklogConsistencyService oakBacklogConsistencyService,
- SyncTokenConsistencyService syncTokenConsistencyService,
+ OakBacklogClusterSyncService oakBacklogClusterSyncService,
+ SyncTokenService syncTokenService,
ResourceResolverFactory factory) {
OakDiscoveryService discoService = new OakDiscoveryService();
discoService.settingsService = settingsService;
@@ -169,8 +169,8 @@ public class OakDiscoveryService extends
discoService.oakViewChecker = connectorPinger;
discoService.scheduler = scheduler;
discoService.idMapService = idMapService;
- discoService.oakBacklogConsistencyService = oakBacklogConsistencyService;
- discoService.syncTokenConsistencyService = syncTokenConsistencyService;
+ discoService.oakBacklogClusterSyncService = oakBacklogClusterSyncService;
+ discoService.syncTokenService = syncTokenService;
discoService.resourceResolverFactory = factory;
return discoService;
}
@@ -210,15 +210,15 @@ public class OakDiscoveryService extends
slingId = settingsService.getSlingId();
- ConsistencyService consistencyService;
+ ClusterSyncService consistencyService;
if (config.getSyncTokenEnabled()) {
//TODO: ConsistencyHistory is implemented a little bit hacky ..
- ConsistencyHistory consistencyHistory = new ConsistencyHistory();
- oakBacklogConsistencyService.setConsistencyHistory(consistencyHistory);
- syncTokenConsistencyService.setConsistencyHistory(consistencyHistory);
- consistencyService = new ConsistencyServiceChain(oakBacklogConsistencyService, syncTokenConsistencyService);
+ ClusterSyncHistory consistencyHistory = new ClusterSyncHistory();
+ oakBacklogClusterSyncService.setConsistencyHistory(consistencyHistory);
+ syncTokenService.setConsistencyHistory(consistencyHistory);
+ consistencyService = new ClusterSyncServiceChain(oakBacklogClusterSyncService, syncTokenService);
} else {
- consistencyService = oakBacklogConsistencyService;
+ consistencyService = oakBacklogClusterSyncService;
}
viewStateManager = ViewStateManagerFactory.newViewStateManager(viewStateManagerLock, consistencyService);
Modified: sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java (original)
+++ sling/trunk/bundles/extensions/discovery/oak/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java Fri Oct 23 11:50:05 2015
@@ -65,7 +65,7 @@ import org.apache.sling.discovery.base.c
import org.apache.sling.discovery.base.connectors.ping.TopologyConnectorClientInformation;
import org.apache.sling.discovery.commons.InstancesDiff;
import org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteDescriptor;
-import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -114,7 +114,7 @@ public class TopologyWebConsolePlugin ex
protected ResourceResolverFactory resourceResolverFactory;
@Reference
- private OakBacklogConsistencyService consistencyService;
+ private OakBacklogClusterSyncService clusterSyncService;
private TopologyView currentView;
@@ -318,9 +318,9 @@ public class TopologyWebConsolePlugin ex
pw.println("</pre>");
pw.println("<br/>");
- pw.println("<p class=\"statline ui-state-highlight\">ConsistencyService History</p>");
+ pw.println("<p class=\"statline ui-state-highlight\">ClusterSyncService History</p>");
pw.println("<pre>");
- for (String syncHistoryEntry : consistencyService.getSyncHistory()) {
+ for (String syncHistoryEntry : clusterSyncService.getSyncHistory()) {
pw.println(syncHistoryEntry);
}
pw.println("</pre>");
@@ -983,9 +983,9 @@ public class TopologyWebConsolePlugin ex
pw.println();
pw.println();
- pw.println("ConsistencyService History");
+ pw.println("ClusterSyncService History");
pw.println("---------------------------------------");
- for (String syncHistoryEntry : consistencyService.getSyncHistory()) {
+ for (String syncHistoryEntry : clusterSyncService.getSyncHistory()) {
pw.println(syncHistoryEntry);
}
pw.println();
Modified: sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java (original)
+++ sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java Fri Oct 23 11:50:05 2015
@@ -56,12 +56,12 @@ public class OakDiscoveryServiceTest {
}
@Override
- public long getBgTimeoutMillis() {
+ public long getClusterSyncServiceTimeoutMillis() {
return bgTimeoutMillis;
}
@Override
- public long getBgIntervalMillis() {
+ public long getClusterSyncServiceIntervalMillis() {
return bgIntervalMillis;
}
Modified: sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/its/setup/OakVirtualInstanceBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/its/setup/OakVirtualInstanceBuilder.java?rev=1710183&r1=1710182&r2=1710183&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/its/setup/OakVirtualInstanceBuilder.java (original)
+++ sling/trunk/bundles/extensions/discovery/oak/src/test/java/org/apache/sling/discovery/oak/its/setup/OakVirtualInstanceBuilder.java Fri Oct 23 11:50:05 2015
@@ -33,9 +33,9 @@ import org.apache.sling.discovery.base.i
import org.apache.sling.discovery.base.its.setup.VirtualInstanceBuilder;
import org.apache.sling.discovery.base.its.setup.mock.MockFactory;
import org.apache.sling.discovery.commons.providers.spi.base.IdMapService;
-import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService;
import org.apache.sling.discovery.commons.providers.spi.base.RepositoryTestHelper;
-import org.apache.sling.discovery.commons.providers.spi.base.SyncTokenConsistencyService;
+import org.apache.sling.discovery.commons.providers.spi.base.SyncTokenService;
import org.apache.sling.discovery.oak.OakDiscoveryService;
import org.apache.sling.discovery.oak.cluster.OakClusterViewService;
import org.apache.sling.discovery.oak.pinger.OakViewChecker;
@@ -54,8 +54,8 @@ public class OakVirtualInstanceBuilder e
private IdMapService idMapService;
private OakViewChecker oakViewChecker;
private SimulatedLeaseCollection leaseCollection;
- private OakBacklogConsistencyService consistencyService;
- private SyncTokenConsistencyService syncTokenConsistencyService;
+ private OakBacklogClusterSyncService consistencyService;
+ private SyncTokenService syncTokenService;
@Override
public VirtualInstanceBuilder createNewRepository() throws Exception {
@@ -189,26 +189,26 @@ public class OakVirtualInstanceBuilder e
return OakViewChecker.testConstructor(getSlingSettingsService(), getResourceResolverFactory(), getConnectorRegistry(), getAnnouncementRegistry(), getScheduler(), getConfig());
}
- private OakBacklogConsistencyService getOakBacklogConsistencyService() throws Exception {
+ private OakBacklogClusterSyncService getOakBacklogClusterSyncService() throws Exception {
if (consistencyService == null) {
- consistencyService = createOakBacklogConsistencyService();
+ consistencyService = createOakBacklogClusterSyncService();
}
return consistencyService;
}
- private OakBacklogConsistencyService createOakBacklogConsistencyService() {
- return OakBacklogConsistencyService.testConstructorAndActivate(getConfig(), getIdMapService(), getSlingSettingsService(), getResourceResolverFactory());
+ private OakBacklogClusterSyncService createOakBacklogClusterSyncService() {
+ return OakBacklogClusterSyncService.testConstructorAndActivate(getConfig(), getIdMapService(), getSlingSettingsService(), getResourceResolverFactory());
}
- private SyncTokenConsistencyService getSyncTokenConsistencyService() throws Exception {
- if (syncTokenConsistencyService == null) {
- syncTokenConsistencyService = createSyncTokenConsistencyService();
+ private SyncTokenService getSyncTokenService() throws Exception {
+ if (syncTokenService == null) {
+ syncTokenService = createSyncTokenService();
}
- return syncTokenConsistencyService;
+ return syncTokenService;
}
- private SyncTokenConsistencyService createSyncTokenConsistencyService() {
- return SyncTokenConsistencyService.testConstructorAndActivate(getConfig(), getResourceResolverFactory(), getSlingSettingsService());
+ private SyncTokenService createSyncTokenService() {
+ return SyncTokenService.testConstructorAndActivate(getConfig(), getResourceResolverFactory(), getSlingSettingsService());
}
@Override
@@ -222,8 +222,8 @@ public class OakVirtualInstanceBuilder e
getOakViewChecker(),
getScheduler(),
getIdMapService(),
- getOakBacklogConsistencyService(),
- getSyncTokenConsistencyService(),
+ getOakBacklogClusterSyncService(),
+ getSyncTokenService(),
getResourceResolverFactory());
}