Author: ataylor
Date: 2011-03-11 07:56:27 -0500 (Fri, 11 Mar 2011)
New Revision: 10318
Modified:
branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd
branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/Configuration.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
https://issues.jboss.org/browse/JBPAPP-6049 - added longer delay for failback and also
made it configurable
Modified: branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd 2011-03-11
05:11:27 UTC (rev 10317)
+++ branches/Branch_2_2_EAP/src/config/common/schema/hornetq-configuration.xsd 2011-03-11
12:56:27 UTC (rev 10318)
@@ -71,8 +71,10 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="allow-failback" type="xsd:boolean">
</xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0"
name="failover-on-shutdown" type="xsd:boolean">
+ <xsd:element maxOccurs="1" minOccurs="0"
name="failback-delay" type="xsd:long">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0"
name="failover-on-shutdown" type="xsd:boolean">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="shared-store" type="xsd:boolean">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="persist-delivery-count-before-delivery" type="xsd:boolean">
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/Configuration.java 2011-03-11
05:11:27 UTC (rev 10317)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/Configuration.java 2011-03-11
12:56:27 UTC (rev 10318)
@@ -863,4 +863,14 @@
* @return
*/
List<ConnectorServiceConfiguration> getConnectorServiceConfigurations();
+
+ /*
+ * how long to wait before failback occurs on restart
+ * */
+ long getFailbackDelay();
+
+ /*
+ * set the failback delay
+ * */
+ void setFailbackDelay(long delay);
}
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2011-03-11
05:11:27 UTC (rev 10317)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2011-03-11
12:56:27 UTC (rev 10318)
@@ -180,6 +180,8 @@
public static final long DEFAULT_MEMORY_MEASURE_INTERVAL = -1; // in milliseconds
+ public static final long DEFAULT_FAILBACK_DELAY = 5000; //in milliseconds
+
public static final String DEFAULT_LOG_DELEGATE_FACTORY_CLASS_NAME =
JULLogDelegateFactory.class.getCanonicalName();
// Attributes
-----------------------------------------------------------------------------
@@ -334,7 +336,9 @@
private Map<String, Set<Role>> securitySettings = new HashMap<String,
Set<Role>>();
protected List<ConnectorServiceConfiguration> connectorServiceConfigurations =
new ArrayList<ConnectorServiceConfiguration>();
-
+
+ private long failbackDelay = ConfigurationImpl.DEFAULT_FAILBACK_DELAY;
+
// Public -------------------------------------------------------------------------
public boolean isClustered()
@@ -1357,7 +1361,17 @@
{
return this.connectorServiceConfigurations;
}
-
+
+ public long getFailbackDelay()
+ {
+ return failbackDelay;
+ }
+
+ public void setFailbackDelay(long failbackDelay)
+ {
+ this.failbackDelay = failbackDelay;
+ }
+
public void setConnectorServiceConfigurations(final
List<ConnectorServiceConfiguration> configs)
{
this.connectorServiceConfigurations = configs;
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-03-11
05:11:27 UTC (rev 10317)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-03-11
12:56:27 UTC (rev 10318)
@@ -169,6 +169,8 @@
config.setAllowAutoFailBack(XMLConfigurationUtil.getBoolean(e,
"allow-failback", config.isClustered()));
+ config.setFailbackDelay(XMLConfigurationUtil.getLong(e, "failback-delay",
config.getFailbackDelay(), Validators.GT_ZERO));
+
config.setFailoverOnServerShutdown(XMLConfigurationUtil.getBoolean(e,
"failover-on-shutdown",
config.isFailoverOnServerShutdown()));
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-03-11
05:11:27 UTC (rev 10317)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-03-11
12:56:27 UTC (rev 10318)
@@ -346,7 +346,7 @@
// goes down they failover to us
clusterManager.announceBackup();
//
- Thread.sleep(2000);
+ Thread.sleep(configuration.getFailbackDelay());
}
nodeManager.startLiveNode();