jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1414093 - in /jackrabbit/trunk/jackrabbit-core/src/main: java/org/apache/jackrabbit/core/cluster/ java/org/apache/jackrabbit/core/config/ resources/org/apache/jackrabbit/core/config/
Date Tue, 27 Nov 2012 10:28:02 GMT
Author: mreutegg
Date: Tue Nov 27 10:28:00 2012
New Revision: 1414093

URL: http://svn.apache.org/viewvc?rev=1414093&view=rev
Log:
JCR-3463: Configurable stopDelay

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java?rev=1414093&r1=1414092&r2=1414093&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
Tue Nov 27 10:28:00 2012
@@ -224,7 +224,7 @@ public class ClusterNode implements Runn
         ClusterConfig cc = clusterContext.getClusterConfig();
         clusterNodeId = cc.getId();
         syncDelay = cc.getSyncDelay();
-        stopDelay = syncDelay * 2;
+        stopDelay = cc.getStopDelay();
 
         try {
             journal = cc.getJournal(clusterContext.getNamespaceResolver());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java?rev=1414093&r1=1414092&r2=1414093&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
Tue Nov 27 10:28:00 2012
@@ -38,6 +38,11 @@ public class ClusterConfig implements Jo
     private final long syncDelay;
 
     /**
+     * Stop delay.
+     */
+    private final long stopDelay;
+
+    /**
      * Journal factory.
      */
     private final JournalFactory jf;
@@ -50,8 +55,22 @@ public class ClusterConfig implements Jo
      * @param jf journal factory
      */
     public ClusterConfig(String id, long syncDelay, JournalFactory jf) {
+        this(id, syncDelay, -1, jf);
+    }
+
+    /**
+     * Creates a new cluster configuration.
+     *
+     * @param id custom cluster node id
+     * @param syncDelay syncDelay, in milliseconds
+     * @param stopDelay stopDelay in milliseconds
+     * @param jf journal factory
+     */
+    public ClusterConfig(String id, long syncDelay,
+                         long stopDelay, JournalFactory jf) {
         this.id = id;
         this.syncDelay = syncDelay;
+        this.stopDelay = stopDelay < 0 ? syncDelay * 10 : stopDelay;
         this.jf = jf;
     }
 
@@ -74,6 +93,13 @@ public class ClusterConfig implements Jo
     }
 
     /**
+     * @return stopDelay the stopDelay configuration attribute value.
+     */
+    public long getStopDelay() {
+        return stopDelay;
+    }
+
+    /**
      * Returns an initialized journal instance.
      *
      * @param resolver namespace resolver

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=1414093&r1=1414092&r2=1414093&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Tue Nov 27 10:28:00 2012
@@ -181,6 +181,9 @@ public class RepositoryConfigurationPars
     /** Name of the syncDelay configuration attribute. */
     public static final String SYNC_DELAY_ATTRIBUTE = "syncDelay";
 
+    /** Name of the stopDelay configuration attribute. */
+    public static final String STOP_DELAY_ATTRIBUTE = "stopDelay";
+
     /** Name of the default search index implementation class. */
     public static final String DEFAULT_QUERY_HANDLER =
         "org.apache.jackrabbit.core.query.lucene.SearchIndex";
@@ -197,6 +200,12 @@ public class RepositoryConfigurationPars
     /** Default synchronization delay, in milliseconds. */
     public static final String DEFAULT_SYNC_DELAY = "5000";
 
+    /**
+     * Default stop delay, in milliseconds or -1 if the default is derived
+     * from the sync delay.
+     */
+    public static final String DEFAULT_STOP_DELAY = "-1";
+
     /** Name of the workspace specific security configuration element */
     private static final String WSP_SECURITY_ELEMENT = "WorkspaceSecurity";
 
@@ -885,9 +894,11 @@ public class RepositoryConfigurationPars
 
                 long syncDelay = Long.parseLong(replaceVariables(getAttribute(
                         element, SYNC_DELAY_ATTRIBUTE, DEFAULT_SYNC_DELAY)));
+                long stopDelay = Long.parseLong(replaceVariables(getAttribute(
+                        element, STOP_DELAY_ATTRIBUTE, "-1")));
 
                 JournalFactory jf = getJournalFactory(element, home, id);
-                return new ClusterConfig(id, syncDelay, jf);
+                return new ClusterConfig(id, syncDelay, stopDelay, jf);
             }
         }
         return null;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd?rev=1414093&r1=1414092&r2=1414093&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd
Tue Nov 27 10:28:00 2012
@@ -161,11 +161,14 @@
     repository in a clustered environment. a literal id may be
     specified that uniquely identifies this node in a cluster, as well
     as the delay in milliseconds before changes to the journal are
-    automatically detected.
+    automatically detected. The stopDelay in milliseconds controls how long
+    the repository waits for the journal thread to terminate. The stop delay
+    is implementation specific if no value is specified in the configuration.
 -->
 <!ELEMENT Cluster (Journal)>
 <!ATTLIST Cluster id        CDATA #IMPLIED
-                  syncDelay CDATA #IMPLIED>
+                  syncDelay CDATA #IMPLIED
+                  stopDelay CDATA #IMPLIED>
 
 <!--
     the Journal element configures the journal used in clustering; the



Mime
View raw message