Author: gtully
Date: Thu Sep 10 15:00:13 2009
New Revision: 813467

URL: http://svn.apache.org/viewvc?rev=813467&view=rev
Log:
expose journal writeBatchSize

Modified:
    
activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java

Modified: 
activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java?rev=813467&r1=813466&r2=813467&view=diff
==============================================================================
--- 
activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
 (original)
+++ 
activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
 Thu Sep 10 15:00:13 2009
@@ -38,8 +38,6 @@
  */
 class DataFileAppender {
 
-    protected static final int DEFAULT_MAX_BATCH_SIZE = 1024 * 1024 * 4;
-
     protected final Journal journal;
     protected final Map<WriteKey, WriteCommand> inflightWrites;
     protected final Object enqueueMutex = new Object() {
@@ -49,7 +47,7 @@
     protected boolean shutdown;
     protected IOException firstAsyncException;
     protected final CountDownLatch shutdownDone = new CountDownLatch(1);
-    protected int maxWriteBatchSize = DEFAULT_MAX_BATCH_SIZE;
+    protected int maxWriteBatchSize;
 
     private boolean running;
     private Thread thread;
@@ -145,6 +143,7 @@
     public DataFileAppender(Journal dataManager) {
         this.journal = dataManager;
         this.inflightWrites = this.journal.getInflightWrites();
+        this.maxWriteBatchSize = this.journal.getWriteBatchSize();
     }
 
     /**

Modified: 
activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java?rev=813467&r1=813466&r2=813467&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java 
(original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java 
Thu Sep 10 15:00:13 2009
@@ -73,7 +73,8 @@
     public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32;
     public static final int DEFAULT_CLEANUP_INTERVAL = 1000 * 30;
     public static final int PREFERED_DIFF = 1024 * 512;
-
+    public static final int DEFAULT_MAX_WRITE_BATCH_SIZE = 1024 * 1024 * 4;
+    
     private static final Log LOG = LogFactory.getLog(Journal.class);
 
     protected final Map<WriteKey, WriteCommand> inflightWrites = new 
ConcurrentHashMap<WriteKey, WriteCommand>();
@@ -86,7 +87,8 @@
     
     protected int maxFileLength = DEFAULT_MAX_FILE_LENGTH;
     protected int preferedFileLength = DEFAULT_MAX_FILE_LENGTH - PREFERED_DIFF;
-
+    protected int writeBatchSize = DEFAULT_MAX_WRITE_BATCH_SIZE;
+    
     protected DataFileAppender appender;
     protected DataFileAccessorPool accessorPool;
 
@@ -102,6 +104,8 @@
     protected boolean checksum;
     protected boolean checkForCorruptionOnStartup;
 
+   
+
     public synchronized void start() throws IOException {
         if (started) {
             return;
@@ -175,9 +179,6 @@
        }
 
        protected Location recoveryCheck(DataFile dataFile) throws IOException {
-       byte controlRecord[] = new byte[BATCH_CONTROL_RECORD_SIZE];
-       DataByteArrayInputStream controlIs = new 
DataByteArrayInputStream(controlRecord);
-       
         Location location = new Location();
         location.setDataFileId(dataFile.getDataFileId());
         location.setOffset(0);
@@ -707,4 +708,12 @@
     public void setCheckForCorruptionOnStartup(boolean 
checkForCorruptionOnStartup) {
         this.checkForCorruptionOnStartup = checkForCorruptionOnStartup;
     }
+
+    public void setWriteBatchSize(int writeBatchSize) {
+        this.writeBatchSize = writeBatchSize;
+    }
+    
+    public int getWriteBatchSize() {
+        return writeBatchSize;
+    }
 }


Reply via email to