activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r634490 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java
Date Fri, 07 Mar 2008 01:01:19 GMT
Author: rajdavies
Date: Thu Mar  6 17:01:18 2008
New Revision: 634490

URL: http://svn.apache.org/viewvc?rev=634490&view=rev
Log:
dump an index

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java?rev=634490&r1=634489&r2=634490&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java
Thu Mar  6 17:01:18 2008
@@ -17,12 +17,11 @@
 package org.apache.activemq.kaha.impl.index.hash;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
-import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.activemq.kaha.Marshaller;
 import org.apache.activemq.kaha.StoreEntry;
 import org.apache.activemq.kaha.impl.index.Index;
@@ -210,6 +209,26 @@
         }
     }
     
+    public void dump() throws IOException {   
+        long offset = 0;
+        readBuffer = new byte[pageSize];
+        dataIn = new DataByteArrayInputStream();
+        dataOut = new DataByteArrayOutputStream(pageSize);
+        int count = 0;
+        while ((offset + pageSize) <= indexFile.length()) {
+            indexFile.seek(offset);
+            HashPage page = getFullPage(offset);
+            if (page.isActive()) {
+               
+                for (HashEntry entry : page.getEntries()) {
+                    count++;
+                    System.out.println("PAGE( " + count + ") " + page.getId() + ": " + entry);
+                }
+            }
+            offset += pageSize;
+        }
+    }
+    
     
 
     public synchronized void unload() throws IOException {
@@ -454,6 +473,7 @@
                     backIndex.size++;
                 }
             }
+            page=null;
             offset += pageSize;
         }
         backIndex.unload();



Mime
View raw message