jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r702921 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/cluster/ test/java/org/apache/jackrabbit/core/cluster/ test/java/org/apache/jackrabbit/core/journal/
Date Wed, 08 Oct 2008 16:28:15 GMT
Author: dpfister
Date: Wed Oct  8 09:28:14 2008
New Revision: 702921

URL: http://svn.apache.org/viewvc?rev=702921&view=rev
Log:
JCR-1789 - Provide access to cluster records
- removing repository directory requires stopping cluster node

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleClusterContext.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java

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=702921&r1=702920&r2=702921&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
Wed Oct  8 09:28:14 2008
@@ -281,12 +281,15 @@
      * Stops this cluster node.
      */
     public synchronized void stop() {
-        if (status == STARTED) {
+        if (status != STOPPED) {
             status = STOPPED;
 
-            journal.close();
-            instanceRevision.close();
-
+            if (journal != null) {
+                journal.close();
+            }
+            if (instanceRevision != null) {
+                instanceRevision.close();
+            }
             notifyAll();
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java?rev=702921&r1=702920&r2=702921&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
Wed Oct  8 09:28:14 2008
@@ -126,6 +126,9 @@
         if (master != null) {
             master.stop();
         }
+        if (slave != null) {
+            slave.stop();
+        }
         super.tearDown();
     }
 
@@ -316,7 +319,7 @@
         BeanConfig bc = new BeanConfig(MemoryJournal.class.getName(), new Properties());
         JournalConfig jc = new JournalConfig(bc);
         ClusterConfig cc = new ClusterConfig(id, SYNC_DELAY, jc);
-        SimpleClusterContext context = new SimpleClusterContext(cc, null);
+        SimpleClusterContext context = new SimpleClusterContext(cc);
 
         ClusterNode clusterNode = new ClusterNode();
         clusterNode.init(context);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleClusterContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleClusterContext.java?rev=702921&r1=702920&r2=702921&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleClusterContext.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleClusterContext.java
Wed Oct  8 09:28:14 2008
@@ -58,6 +58,16 @@
         nsResolver = new RegistryNamespaceResolver(new SimpleNamespaceRegistry());
     }
 
+    /**
+     * Create a new instance of this class. Equivalent to
+     * <blockquote>SimpleClusterContext(cc, <code>null</code>)</blockquote>
+     *
+     * @param cc cluster config
+     */
+    public SimpleClusterContext(ClusterConfig cc) {
+        this(cc, null);
+    }
+
     //----------------------------------------------------------- ClusterContext
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java?rev=702921&r1=702920&r2=702921&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/FileJournalTest.java
Wed Oct  8 09:28:14 2008
@@ -89,7 +89,11 @@
         ClusterNode clusterNode = new ClusterNode();
         clusterNode.init(context);
 
-        File revisionFile = new File(repositoryHome, FileJournal.DEFAULT_INSTANCE_FILE_NAME);
-        assertTrue(revisionFile.exists());
+        try {
+            File revisionFile = new File(repositoryHome, FileJournal.DEFAULT_INSTANCE_FILE_NAME);
+            assertTrue(revisionFile.exists());
+        } finally {
+            clusterNode.stop();
+        }
     }
 }



Mime
View raw message