activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r657734 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: kaha/impl/index/hash/HashIndex.java store/kahadaptor/KahaReferenceStoreAdapter.java
Date Mon, 19 May 2008 06:47:30 GMT
Author: rajdavies
Date: Sun May 18 23:47:30 2008
New Revision: 657734

URL: http://svn.apache.org/viewvc?rev=657734&view=rev
Log:
For https://issues.apache.org/activemq/browse/AMQ-1736

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashIndex.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.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=657734&r1=657733&r2=657734&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
Sun May 18 23:47:30 2008
@@ -55,6 +55,9 @@
     private int keySize = DEFAULT_KEY_SIZE;
     private int numberOfBins = DEFAULT_BIN_SIZE;
     private int keysPerPage = this.pageSize /this.keySize;
+    private DataByteArrayInputStream dataIn;
+    private DataByteArrayOutputStream dataOut;
+    private byte[] readBuffer;
     private HashBin[] bins;
     private Marshaller keyMarshaller;
     private long length;
@@ -239,6 +242,9 @@
             this.bins = new HashBin[capacity];
             threshold = calculateThreashold();
             keysPerPage = pageSize / keySize;
+            dataIn = new DataByteArrayInputStream();
+            dataOut = new DataByteArrayOutputStream(pageSize);
+            readBuffer = new byte[pageSize];
             try {
                 openIndexFile();
                 if (indexFile.length() > 0) {
@@ -369,7 +375,6 @@
     }
 
     void writeFullPage(HashPage page) throws IOException {
-        DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(pageSize);
         dataOut.reset();
         page.write(keyMarshaller, dataOut);
         if (dataOut.size() > pageSize) {
@@ -380,7 +385,6 @@
     }
 
     void writePageHeader(HashPage page) throws IOException {
-        DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(pageSize);
         dataOut.reset();
         page.writeHeader(dataOut);
         indexFile.seek(page.getId());
@@ -388,9 +392,6 @@
     }
 
     HashPage getFullPage(long id) throws IOException {
-        byte[] readBuffer = new byte[pageSize];
-        DataByteArrayInputStream dataIn = new DataByteArrayInputStream();
-        readBuffer = new byte[pageSize];
         indexFile.seek(id);
         indexFile.readFully(readBuffer, 0, pageSize);
         dataIn.restart(readBuffer);
@@ -401,8 +402,6 @@
     }
 
     HashPage getPageHeader(long id) throws IOException {
-        byte[] readBuffer = new byte[pageSize];
-        DataByteArrayInputStream dataIn = new DataByteArrayInputStream();
         indexFile.seek(id);
         indexFile.readFully(readBuffer, 0, HashPage.PAGE_HEADER_SIZE);
         dataIn.restart(readBuffer);
@@ -469,8 +468,6 @@
     }
     
     private void doLoad() throws IOException {
-        byte[] readBuffer = new byte[pageSize];
-        DataByteArrayInputStream dataIn = new DataByteArrayInputStream();
         long offset = 0;
         if (loaded.compareAndSet(false, true)) {
             while ((offset + pageSize) <= indexFile.length()) {
@@ -589,7 +586,7 @@
     }
 
     static {
-        DEFAULT_PAGE_SIZE = Integer.parseInt(System.getProperty("defaultPageSize", "16384"));
+        DEFAULT_PAGE_SIZE = Integer.parseInt(System.getProperty("defaultPageSize", "1024"));
         DEFAULT_KEY_SIZE = Integer.parseInt(System.getProperty("defaultKeySize", "96"));
         DEFAULT_BIN_SIZE= Integer.parseInt(System.getProperty("defaultBinSize", "1024"));
         MAXIMUM_CAPACITY = Integer.parseInt(System.getProperty("defaultPageSize", "16384"));

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java?rev=657734&r1=657733&r2=657734&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaReferenceStoreAdapter.java
Sun May 18 23:47:30 2008
@@ -59,7 +59,7 @@
     private static final Log LOG = LogFactory.getLog(KahaReferenceStoreAdapter.class);
     private static final String STORE_STATE = "store-state";
     private static final String INDEX_VERSION_NAME = "INDEX_VERSION";
-    private static final Integer INDEX_VERSION = new Integer(6);
+    private static final Integer INDEX_VERSION = new Integer(7);
     private static final String RECORD_REFERENCES = "record-references";
     private static final String TRANSACTIONS = "transactions-state";
     private MapContainer stateMap;



Mime
View raw message