activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r582575 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java
Date Sun, 07 Oct 2007 05:10:33 GMT
Author: rajdavies
Date: Sat Oct  6 22:10:28 2007
New Revision: 582575

URL: http://svn.apache.org/viewvc?rev=582575&view=rev
Log:
refresh entry for prev as well as next

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java?rev=582575&r1=582574&r2=582575&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/DiskIndexLinkedList.java
Sat Oct  6 22:10:28 2007
@@ -257,45 +257,50 @@
      * @return next entry
      */
     public synchronized IndexItem getNextEntry(IndexItem current) {
-        IndexItem result = null;
-        if (current != null ) {
-        	current = (IndexItem) refreshEntry(current);
-        	if(current.getNextItem() >= 0){
-            try {
-                result = indexManager.getIndex(current.getNextItem());
-            } catch (IOException e) {
-                throw new RuntimeException("Failed to get next index from " + indexManager
+ " for " + current, e);
-            }
-        	}
-        }
-        // essential last get's updated consistently
-        if (result != null && last != null && last.equals(result)) {
-            result = last;
-        }
-        return result;
-    }
+		IndexItem result = null;
+		if (current != null) {
+			current = (IndexItem) refreshEntry(current);
+			if (current.getNextItem() >= 0) {
+				try {
+					result = indexManager.getIndex(current.getNextItem());
+				} catch (IOException e) {
+					throw new RuntimeException("Failed to get next index from "
+							+ indexManager + " for " + current, e);
+				}
+			}
+		}
+		// essential last get's updated consistently
+		if (result != null && last != null && last.equals(result)) {
+			result = last;
+		}
+		return result;
+	}
 
     /**
-     * Retrive the prev entry after this entry
-     * 
-     * @param entry
-     * @return prev entry
-     */
+	 * Retrive the prev entry after this entry
+	 * 
+	 * @param entry
+	 * @return prev entry
+	 */
     public synchronized IndexItem getPrevEntry(IndexItem current) {
-        IndexItem result = null;
-        if (current != null && current.getPreviousItem() >= 0) {
-            try {
-                result = indexManager.getIndex(current.getPreviousItem());
-            } catch (IOException e) {
-                throw new RuntimeException("Failed to  get current index for " + current,
e);
-            }
-        }
-        // essential root get's updated consistently
-        if (result != null && root != null && root.equals(result)) {
-            return root;
-        }
-        return result;
-    }
+		IndexItem result = null;
+		if (current != null) {
+			if (current.getPreviousItem() >= 0) {
+				current = (IndexItem) refreshEntry(current);
+				try {
+					result = indexManager.getIndex(current.getPreviousItem());
+				} catch (IOException e) {
+					throw new RuntimeException(
+							"Failed to  get current index for " + current, e);
+				}
+			}
+		}
+		// essential root get's updated consistently
+		if (result != null && root != null && root.equals(result)) {
+			return root;
+		}
+		return result;
+	}
 
     public synchronized StoreEntry getEntry(StoreEntry current) {
         StoreEntry result = null;



Mime
View raw message