activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r430351 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq: kaha/Store.java kaha/impl/DataManager.java kaha/impl/KahaStore.java store/kahadaptor/KahaPersistenceAdapter.java
Date Thu, 10 Aug 2006 10:38:32 GMT
Author: rajdavies
Date: Thu Aug 10 03:38:29 2006
New Revision: 430351

URL: http://svn.apache.org/viewvc?rev=430351&view=rev
Log:
fix for http://issues.apache.org/activemq/browse/AMQ-857

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java?rev=430351&r1=430350&r2=430351&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/Store.java
Thu Aug 10 03:38:29 2006
@@ -141,4 +141,14 @@
      * @throws IOException
      */
     public Set getListContainerIds() throws IOException;
+    
+    /**
+     * @return the maxDataFileLength
+     */
+    public long getMaxDataFileLength();
+
+    /**
+     * @param maxDataFileLength the maxDataFileLength to set
+     */
+    public void setMaxDataFileLength(long maxDataFileLength);
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java?rev=430351&r1=430350&r2=430351&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/DataManager.java
Thu Aug 10 03:38:29 2006
@@ -45,6 +45,7 @@
     private StoreDataReader reader;
     private StoreDataWriter writer;
     private DataFile currentWriteFile;
+    private long maxFileLength = MAX_FILE_LENGTH;
     Map fileMap=new HashMap();
 
     public static final int ITEM_HEAD_SIZE=5; // type + length
@@ -95,7 +96,7 @@
     }
 
     DataFile findSpaceForData(DataItem item) throws IOException{
-        if(currentWriteFile==null||((currentWriteFile.getLength()+item.getSize())>MAX_FILE_LENGTH)){
+        if(currentWriteFile==null||((currentWriteFile.getLength()+item.getSize())>maxFileLength)){
             int nextNum=currentWriteFile!=null?currentWriteFile.getNumber().intValue()+1:1;
             if(currentWriteFile!=null&&currentWriteFile.isUnused()){
                 removeDataFile(currentWriteFile);
@@ -259,5 +260,19 @@
 
     public void setRedoMarshaller(Marshaller redoMarshaller) {
         this.redoMarshaller = redoMarshaller;
+    }
+
+    /**
+     * @return the maxFileLength
+     */
+    public long getMaxFileLength(){
+        return maxFileLength;
+    }
+
+    /**
+     * @param maxFileLength the maxFileLength to set
+     */
+    public void setMaxFileLength(long maxFileLength){
+        this.maxFileLength=maxFileLength;
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java?rev=430351&r1=430350&r2=430351&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
Thu Aug 10 03:38:29 2006
@@ -54,6 +54,7 @@
     private String mode;
     private boolean initialized;
     private boolean logIndexChanges=false;
+    private long maxDataFileLength = DataManager.MAX_FILE_LENGTH;
 
     public KahaStore(String name,String mode) throws IOException{
         this.name=name;
@@ -279,6 +280,7 @@
         DataManager dm = (DataManager) dataManagers.get(name);
         if (dm == null){
             dm = new DataManager(directory,name);
+            dm.setMaxFileLength(maxDataFileLength);
             recover(dm);
             dataManagers.put(name,dm);
         }
@@ -311,6 +313,20 @@
 
     public void setLogIndexChanges(boolean logIndexChanges) {
         this.logIndexChanges = logIndexChanges;
+    }
+
+    /**
+     * @return the maxDataFileLength
+     */
+    public long getMaxDataFileLength(){
+        return maxDataFileLength;
+    }
+
+    /**
+     * @param maxDataFileLength the maxDataFileLength to set
+     */
+    public void setMaxDataFileLength(long maxDataFileLength){
+        this.maxDataFileLength=maxDataFileLength;
     }
 
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java?rev=430351&r1=430350&r2=430351&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java
Thu Aug 10 03:38:29 2006
@@ -53,6 +53,7 @@
     ConcurrentHashMap messageStores=new ConcurrentHashMap();
     private boolean useExternalMessageReferences;
     private OpenWireFormat wireFormat=new OpenWireFormat();
+    private long maxDataFileLength = 32 * 1024 * 1024;
     Store store;
 
     public KahaPersistenceAdapter(File dir) throws IOException{
@@ -61,6 +62,7 @@
         }
         String name=dir.getAbsolutePath()+File.separator+"kaha.db";
         store=StoreFactory.open(name,"rw");
+        store.setMaxDataFileLength(maxDataFileLength);
     }
 
     public Set getDestinations(){
@@ -176,4 +178,18 @@
      *            The UsageManager that is controlling the broker's memory usage.
      */
     public void setUsageManager(UsageManager usageManager){}
+
+    /**
+     * @return the maxDataFileLength
+     */
+    public long getMaxDataFileLength(){
+        return maxDataFileLength;
+    }
+
+    /**
+     * @param maxDataFileLength the maxDataFileLength to set
+     */
+    public void setMaxDataFileLength(long maxDataFileLength){
+        this.maxDataFileLength=maxDataFileLength;
+    }
 }



Mime
View raw message