[hornetq-commits] JBoss hornetq SVN: r9142 - in trunk: src/main/org/hornetq/core/deployers/impl and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Apr 21 06:12:04 EDT 2010
Author: timfox
Date: 2010-04-21 06:12:02 -0400 (Wed, 21 Apr 2010)
New Revision: 9142
Modified:
trunk/docs/user-manual/en/ha.xml
trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-295 and a small tweak to docs
Modified: trunk/docs/user-manual/en/ha.xml
===================================================================
--- trunk/docs/user-manual/en/ha.xml 2010-04-21 08:14:01 UTC (rev 9141)
+++ trunk/docs/user-manual/en/ha.xml 2010-04-21 10:12:02 UTC (rev 9142)
@@ -317,7 +317,7 @@
>HornetQException.TRANSACTION_ROLLED_BACK</literal> if using the core
API.</para>
<para>It is up to the user to catch the exception, and perform any client side local
- rollback code as necessary. The user can then just retry the transactional
+ rollback code as necessary. There is no need to manually rollback the session - it is already rolled back. The user can then just retry the transactional
operations again on the same session.</para>
<para>HornetQ ships with a fully functioning example demonstrating how to do this,
please see <xref linkend="examples.transaction-failover"/></para>
Modified: trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-04-21 08:14:01 UTC (rev 9141)
+++ trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-04-21 10:12:02 UTC (rev 9142)
@@ -37,7 +37,9 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.config.impl.FileConfiguration;
import org.hornetq.core.config.impl.Validators;
+import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.logging.Logger;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.JournalType;
import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
@@ -53,6 +55,8 @@
/**
* This class will parse the XML associated with the File Configuration XSD
*
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
* @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
*
*
@@ -125,22 +129,22 @@
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
-
+
public Configuration parseMainConfig(final InputStream input) throws Exception
{
-
+
Reader reader = new InputStreamReader(input);
String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
xml = XMLUtil.replaceSystemProps(xml);
Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);
-
+
Configuration config = new ConfigurationImpl();
-
+
parseMainConfig(e, config);
-
+
return config;
}
-
+
public void parseMainConfig(final Element e, final Configuration config) throws Exception
{
XMLUtil.validate(e, FileConfigurationParser.CONFIGURATION_SCHEMA_URL);
@@ -415,7 +419,22 @@
}
else if (s.equals(JournalType.ASYNCIO.toString()))
{
- config.setJournalType(JournalType.ASYNCIO);
+ // https://jira.jboss.org/jira/browse/HORNETQ-295
+ // We do the check here to see if AIO is supported so we can use the correct defaults and/or use
+ // correct settings in xml
+ // If we fall back later on these settings can be ignored
+ boolean supportsAIO = AIOSequentialFileFactory.isSupported();
+
+ if (supportsAIO)
+ {
+ config.setJournalType(JournalType.ASYNCIO);
+ }
+ else
+ {
+ log.warn("AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal");
+
+ config.setJournalType(JournalType.NIO);
+ }
}
config.setJournalSyncTransactional(XMLConfigurationUtil.getBoolean(e,
@@ -430,7 +449,7 @@
"journal-file-size",
config.getJournalFileSize(),
Validators.GT_ZERO));
-
+
int journalBufferTimeout = XMLConfigurationUtil.getInteger(e,
"journal-buffer-timeout",
config.getJournalType() == JournalType.ASYNCIO ? ConfigurationImpl.DEFAULT_JOURNAL_BUFFER_TIMEOUT_AIO
@@ -461,7 +480,7 @@
config.setJournalBufferSize_NIO(journalBufferSize);
config.setJournalMaxIO_NIO(journalMaxIO);
}
-
+
config.setJournalMinFiles(XMLConfigurationUtil.getInteger(e,
"journal-min-files",
config.getJournalMinFiles(),
@@ -521,15 +540,13 @@
"memory-measure-interval",
config.getMemoryMeasureInterval(),
Validators.MINUS_ONE_OR_GT_ZERO)); // in
-
+
parseAddressSettings(e, config);
-
+
parseQueues(e, config);
-
+
parseSecurity(e, config);
-
-
}
/**
@@ -539,12 +556,12 @@
private void parseSecurity(final Element e, final Configuration config)
{
NodeList elements = e.getElementsByTagName("security-settings");
-
+
if (elements.getLength() != 0)
{
Element node = (Element)elements.item(0);
NodeList list = node.getElementsByTagName("security-setting");
- for (int i = 0 ; i < list.getLength(); i++)
+ for (int i = 0; i < list.getLength(); i++)
{
Pair<String, Set<Role>> securityItem = parseSecurityRoles(list.item(i));
config.getSecurityRoles().put(securityItem.a, securityItem.b);
@@ -559,12 +576,12 @@
private void parseQueues(final Element e, final Configuration config)
{
NodeList elements = e.getElementsByTagName("queues");
-
+
if (elements.getLength() != 0)
{
Element node = (Element)elements.item(0);
NodeList list = node.getElementsByTagName("queue");
- for (int i = 0 ; i < list.getLength(); i++)
+ for (int i = 0; i < list.getLength(); i++)
{
CoreQueueConfiguration queueConfig = parseQueueConfiguration(list.item(i));
config.getQueueConfigurations().add(queueConfig);
@@ -579,12 +596,12 @@
private void parseAddressSettings(final Element e, final Configuration config)
{
NodeList elements = e.getElementsByTagName("address-settings");
-
+
if (elements.getLength() != 0)
{
Element node = (Element)elements.item(0);
NodeList list = node.getElementsByTagName("address-setting");
- for (int i = 0 ; i < list.getLength(); i++)
+ for (int i = 0; i < list.getLength(); i++)
{
Pair<String, AddressSettings> addressSettings = parseAddressSettings(list.item(i));
config.getAddressesSettings().put(addressSettings.a, addressSettings.b);
@@ -895,7 +912,7 @@
String name = e.getAttribute("name");
String localBindAddress = XMLConfigurationUtil.getString(e, "local-bind-address", null, Validators.NO_CHECK);
-
+
String groupAddress = XMLConfigurationUtil.getString(e, "group-address", null, Validators.NOT_NULL_OR_EMPTY);
int groupPort = XMLConfigurationUtil.getInteger(e, "group-port", -1, Validators.MINUS_ONE_OR_GT_ZERO);
@@ -1036,10 +1053,7 @@
String queueName = XMLConfigurationUtil.getString(brNode, "queue-name", null, Validators.NOT_NULL_OR_EMPTY);
- String forwardingAddress = XMLConfigurationUtil.getString(brNode,
- "forwarding-address",
- null,
- Validators.NO_CHECK);
+ String forwardingAddress = XMLConfigurationUtil.getString(brNode, "forwarding-address", null, Validators.NO_CHECK);
String transformerClassName = XMLConfigurationUtil.getString(brNode,
"transformer-class-name",
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-04-21 08:14:01 UTC (rev 9141)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-04-21 10:12:02 UTC (rev 9142)
@@ -238,17 +238,8 @@
SequentialFileFactory journalFF = null;
- JournalType journalTypeToUse = config.getJournalType();
-
- if (config.getJournalType() == JournalType.ASYNCIO && !AIOSequentialFileFactory.isSupported())
+ if (config.getJournalType() == JournalType.ASYNCIO)
{
- JournalStorageManager.log.warn("AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal");
-
- journalTypeToUse = JournalType.NIO;
- }
-
- if (journalTypeToUse == JournalType.ASYNCIO)
- {
JournalStorageManager.log.info("Using AIO Journal");
journalFF = new AIOSequentialFileFactory(journalDir,
@@ -256,7 +247,7 @@
config.getJournalBufferTimeout_AIO(),
config.isLogJournalWriteRate());
}
- else if (journalTypeToUse == JournalType.NIO)
+ else if (config.getJournalType() == JournalType.NIO)
{
JournalStorageManager.log.info("Using NIO Journal");
journalFF = new NIOSequentialFileFactory(journalDir,
More information about the hornetq-commits
mailing list