From 356c39dcfc1673410b3a7b7d2055586be3279ab8 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Thu, 10 Sep 2009 15:05:55 +0000 Subject: [PATCH] expose journal writeBatchSize and tidy up xbean annotations git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@813469 13f79535-47bb-0310-9956-ffa450edef68 --- .../broker/region/policy/PolicyEntry.java | 1 + .../plugin/DiscardingDLQBrokerPlugin.java | 2 +- .../plugin/ForcePersistencyModeBroker.java | 1 + .../store/amq/AMQPersistenceAdapter.java | 24 +++++--------- .../JournalPersistenceAdapterFactory.java | 2 +- .../kahadaptor/KahaPersistenceAdapter.java | 2 +- .../kahadb/KahaDBPersistenceAdapter.java | 31 +++++++++++++------ .../activemq/store/kahadb/KahaDBStore.java | 1 - .../store/kahadb/MessageDatabase.java | 10 ++++++ .../java/org/apache/activemq/usage/Usage.java | 4 +-- 10 files changed, 47 insertions(+), 31 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java index 43e1f28f81..fa74dca131 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java @@ -286,6 +286,7 @@ public class PolicyEntry extends DestinationMapEntry { } /** + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setMemoryLimit(long memoryLimit) { diff --git a/activemq-core/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java b/activemq-core/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java index 4359b2cea7..05c97c4668 100644 --- a/activemq-core/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java +++ b/activemq-core/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; /** * @author Filip Hanik - * @org.apache.xbean.XBean element="discardingDLQBrokerPlugin" + * @org.apache.xbean.XBean element="discardingDLQBrokerPlugin" * @version 1.0 */ public class DiscardingDLQBrokerPlugin implements BrokerPlugin { diff --git a/activemq-core/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBroker.java b/activemq-core/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBroker.java index 89d8892f60..43a807bf12 100644 --- a/activemq-core/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBroker.java @@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory; * * Useful, if you have set the broker usage policy to process ONLY persistent or ONLY non-persistent * messages. + * @org.apache.xbean.XBean element="forcePersistencyModeBroker" */ public class ForcePersistencyModeBroker extends BrokerFilter{ public static Log log = LogFactory.getLog(ForcePersistencyModeBroker.class); diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java index 1ad1dc5c7a..6e47e364ad 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java @@ -798,11 +798,9 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, return maxCheckpointMessageAddSize; } - /** - * When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" - * - * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" + /** + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used + * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryIntPropertyEditor" */ public void setMaxCheckpointMessageAddSize(int maxCheckpointMessageAddSize) { this.maxCheckpointMessageAddSize = maxCheckpointMessageAddSize; @@ -857,11 +855,9 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } /** - * When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" - * - * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" - */ + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used + * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" + */ public void setMaxFileLength(int maxFileLength) { this.maxFileLength = maxFileLength; } @@ -911,9 +907,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } /** - * When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" - * + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setIndexPageSize(int indexPageSize) { @@ -933,9 +927,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, } /** - * When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" - * + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setMaxReferenceFileLength(int maxReferenceFileLength) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java index d13d915325..309eb4b223 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapterFactory.java @@ -81,7 +81,7 @@ public class JournalPersistenceAdapterFactory extends DataSourceSupport implemen /** * Sets the size of the journal log files - * + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryIntPropertyEditor" */ public void setJournalLogFileSize(int journalLogFileSize) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java index cc1a5c0e6d..92269b2843 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/KahaPersistenceAdapter.java @@ -282,7 +282,7 @@ public class KahaPersistenceAdapter implements PersistenceAdapter { } /** - * @param maxDataFileLength the maxDataFileLength to set + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */ public void setMaxDataFileLength(long maxDataFileLength) { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java index 9ecedb710d..aafc14fe3d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java @@ -34,7 +34,7 @@ import java.util.Set; * {@link Journal} and then check pointing asynchronously on a timeout with some * other long term persistent storage. * - * @org.apache.xbean.XBean element="KahaDB" + * @org.apache.xbean.XBean element="kahaDB" * @version $Revision: 1.17 $ */ public class KahaDBPersistenceAdapter implements PersistenceAdapter { @@ -193,19 +193,16 @@ public class KahaDBPersistenceAdapter implements PersistenceAdapter { * Get the journalMaxFileLength * @return the journalMaxFileLength */ - public long getJournalMaxFileLength() { + public int getJournalMaxFileLength() { return this.letter.getJournalMaxFileLength(); } /** - * @param journalMaxFileLength which is rounded to an integer - * When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" - * - * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used + * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryIntPropertyEditor" */ - public void setJournalMaxFileLength(long journalMaxFileLength) { - this.letter.setJournalMaxFileLength(Long.valueOf(journalMaxFileLength).intValue()); + public void setJournalMaxFileLength(int journalMaxFileLength) { + this.letter.setJournalMaxFileLength(journalMaxFileLength); } /** @@ -256,6 +253,22 @@ public class KahaDBPersistenceAdapter implements PersistenceAdapter { this.letter.setIndexWriteBatchSize(indexWriteBatchSize); } + /** + * Get the journalMaxWriteBatchSize + * @return the journalMaxWriteBatchSize + */ + public int getJournalMaxWriteBatchSize() { + return this.letter.getJournalMaxWriteBatchSize(); + } + + /** + * Set the journalMaxWriteBatchSize + * @param journalMaxWriteBatchSize the journalMaxWriteBatchSize to set + */ + public void setJournalMaxWriteBatchSize(int journalMaxWriteBatchSize) { + this.letter.setJournalMaxWriteBatchSize(journalMaxWriteBatchSize); + } + /** * Get the enableIndexWriteAsync * @return the enableIndexWriteAsync diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java index 08312a99d8..020ce01f44 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; -import org.apache.activeio.journal.Journal; import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 35b296cc88..77cfca859c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -142,6 +142,7 @@ public class MessageDatabase { long checkpointInterval = 5*1000; long cleanupInterval = 30*1000; int journalMaxFileLength = Journal.DEFAULT_MAX_FILE_LENGTH; + int journalMaxWriteBatchSize = Journal.DEFAULT_MAX_WRITE_BATCH_SIZE; boolean enableIndexWriteAsync = false; int setIndexWriteBatchSize = PageFile.DEFAULT_WRITE_BATCH_SIZE; @@ -1337,9 +1338,18 @@ public class MessageDatabase { Journal manager = new Journal(); manager.setDirectory(directory); manager.setMaxFileLength(getJournalMaxFileLength()); + manager.setWriteBatchSize(getJournalMaxWriteBatchSize()); return manager; } + public int getJournalMaxWriteBatchSize() { + return journalMaxWriteBatchSize; + } + + public void setJournalMaxWriteBatchSize(int journalMaxWriteBatchSize) { + this.journalMaxWriteBatchSize = journalMaxWriteBatchSize; + } + public File getDirectory() { return directory; } diff --git a/activemq-core/src/main/java/org/apache/activemq/usage/Usage.java b/activemq-core/src/main/java/org/apache/activemq/usage/Usage.java index 95be793261..8a60e65194 100755 --- a/activemq-core/src/main/java/org/apache/activemq/usage/Usage.java +++ b/activemq-core/src/main/java/org/apache/activemq/usage/Usage.java @@ -134,8 +134,8 @@ public abstract class Usage implements Service { /** * Sets the memory limit in bytes. Setting the limit in bytes will set the * usagePortion to 0 since the UsageManager is not going to be portion based - * off the parent. When set using XBean, you can use values such as: "20 - * mb", "1024 kb", or "1 gb" + * off the parent. + * When set using Xbean, values of the form "20 Mb", "1024kb", and "1g" can be used * * @org.apache.xbean.Property propertyEditor="org.apache.activemq.util.MemoryPropertyEditor" */