jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r617534 - in /jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: cluster/ClusterNode.java journal/FileRevision.java
Date Fri, 01 Feb 2008 16:06:41 GMT
Author: dpfister
Date: Fri Feb  1 08:06:39 2008
New Revision: 617534

URL: http://svn.apache.org/viewvc?rev=617534&view=rev
Log:
JCR-1358 - Cluster revision file not closed on repository shutdown

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java?rev=617534&r1=617533&r2=617534&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
Fri Feb  1 08:06:39 2008
@@ -316,6 +316,8 @@
             status = STOPPED;
 
             journal.close();
+            instanceRevision.close();
+            
             notifyAll();
         }
     }

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java?rev=617534&r1=617533&r2=617534&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java
Fri Feb  1 08:06:39 2008
@@ -42,6 +42,11 @@
      * Cached value.
      */
     private long value;
+    
+    /**
+     * Flag indicating whether this revision file is closed.
+     */
+    private boolean closed;
 
     /**
      * Creates a new file based revision counter.
@@ -72,6 +77,9 @@
      */
     public synchronized long get() throws JournalException {
         try {
+            if (closed) {
+                throw new JournalException("Revision file closed.");
+            }
             raf.seek(0L);
             value = raf.readLong();
             return value;
@@ -88,12 +96,27 @@
      */
     public synchronized void set(long value) throws JournalException {
         try {
+            if (closed) {
+                throw new JournalException("Revision file closed.");
+            }
             raf.seek(0L);
             raf.writeLong(value);
             raf.getFD().sync();
             this.value = value;
         } catch (IOException e) {
             throw new JournalException("I/O error occurred.", e);
+        }
+    }
+    
+    /**
+     * Close file revision. Closes underlying random access file.
+     */
+    public synchronized void close() {
+        try {
+            raf.close();
+            closed = true;
+        } catch (IOException e) {
+            log.warn("I/O error closing revision file.", e);
         }
     }
 }



Mime
View raw message