Index: src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (revision 1414021) +++ src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (working copy) @@ -224,7 +224,7 @@ ClusterConfig cc = clusterContext.getClusterConfig(); clusterNodeId = cc.getId(); syncDelay = cc.getSyncDelay(); - stopDelay = syncDelay * 2; + stopDelay = cc.getStopDelay(); try { journal = cc.getJournal(clusterContext.getNamespaceResolver()); Index: src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (revision 1414021) +++ src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (working copy) @@ -38,6 +38,11 @@ private final long syncDelay; /** + * Stop delay. + */ + private final long stopDelay; + + /** * Journal factory. */ private final JournalFactory jf; @@ -50,8 +55,22 @@ * @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 @@ } /** + * @return stopDelay the stopDelay configuration attribute value. + */ + public long getStopDelay() { + return stopDelay; + } + + /** * Returns an initialized journal instance. * * @param resolver namespace resolver Index: src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (revision 1414021) +++ src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (working copy) @@ -181,6 +181,9 @@ /** 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 @@ /** 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 @@ 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; Index: src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd =================================================================== --- src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd (revision 1414021) +++ src/main/resources/org/apache/jackrabbit/core/config/repository-2.6-elements.dtd (working copy) @@ -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. --> + syncDelay CDATA #IMPLIED + stopDelay CDATA #IMPLIED>