[hornetq-commits] JBoss hornetq SVN: r10010 - in trunk: examples/jms/multiple-failover/server1 and 18 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 8 01:54:03 EST 2010


Author: ataylor
Date: 2010-12-08 01:53:58 -0500 (Wed, 08 Dec 2010)
New Revision: 10010

Modified:
   trunk/examples/jms/multiple-failover-failback/server0/hornetq-configuration.xml
   trunk/examples/jms/multiple-failover-failback/server1/hornetq-configuration.xml
   trunk/examples/jms/multiple-failover-failback/server2/hornetq-configuration.xml
   trunk/examples/jms/multiple-failover/server0/hornetq-configuration.xml
   trunk/examples/jms/multiple-failover/server1/hornetq-configuration.xml
   trunk/examples/jms/multiple-failover/server2/hornetq-configuration.xml
   trunk/src/config/common/schema/hornetq-configuration.xsd
   trunk/src/config/trunk/clustered/hornetq-configuration.xml
   trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
   trunk/src/main/org/hornetq/core/config/Configuration.java
   trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
   trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
   trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
   trunk/src/main/org/hornetq/core/server/HornetQServer.java
   trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
   trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
Log:
added failoveronshutdown flag to configuration

Modified: trunk/examples/jms/multiple-failover/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover/server0/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover/server0/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -4,6 +4,9 @@
 
    <clustered>true</clustered>
 
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
    <shared-store>true</shared-store>
    <!-- Connectors -->
 

Modified: trunk/examples/jms/multiple-failover/server1/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover/server1/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover/server1/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -4,6 +4,9 @@
 
     <clustered>true</clustered>
 
+    <!--we kill the server process so don't need this set to true-->
+    <failover-on-shutdown>false</failover-on-shutdown>
+
     <backup>true</backup>
 
     <shared-store>true</shared-store>

Modified: trunk/examples/jms/multiple-failover/server2/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover/server2/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover/server2/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -20,6 +20,9 @@
 
     <backup>true</backup>
 
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
     <shared-store>true</shared-store>
     
    <connectors>

Modified: trunk/examples/jms/multiple-failover-failback/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover-failback/server0/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover-failback/server0/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -19,6 +19,9 @@
 
    <shared-store>true</shared-store>
 
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
    <allow-failback>true</allow-failback>
    <!-- Connectors -->
 

Modified: trunk/examples/jms/multiple-failover-failback/server1/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover-failback/server1/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover-failback/server1/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -19,6 +19,9 @@
 
    <backup>true</backup>
 
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
    <shared-store>true</shared-store>
 
    <allow-failback>true</allow-failback>

Modified: trunk/examples/jms/multiple-failover-failback/server2/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/multiple-failover-failback/server2/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/examples/jms/multiple-failover-failback/server2/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -20,6 +20,9 @@
 
    <backup>true</backup>
 
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
    <shared-store>true</shared-store>
 
    <allow-failback>true</allow-failback>

Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd	2010-12-08 06:53:58 UTC (rev 10010)
@@ -69,6 +69,8 @@
 				</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>
 				<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: trunk/src/config/trunk/clustered/hornetq-configuration.xml
===================================================================
--- trunk/src/config/trunk/clustered/hornetq-configuration.xml	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/config/trunk/clustered/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
@@ -4,6 +4,8 @@
 	
 	<clustered>true</clustered>
 
+    <failover-on-shutdown>false</failover-on-shutdown>
+
     <shared-store>true</shared-store>
 	
 	<journal-min-files>10</journal-min-files>

Modified: trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -589,4 +589,7 @@
 
    @Operation(desc= "Destroy a bridge", impact = MBeanOperationInfo.ACTION)
    void destroyBridge(@Parameter(name="name", desc="Name of the bridge") String name) throws Exception;
+
+   @Operation(desc = "force the server to stop and notify clients to failover", impact = MBeanOperationInfo.UNKNOWN)
+   void forceFailover() throws Exception;
 }

Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -400,6 +400,17 @@
    String getClusterPassword();
 
    /**
+    * should we notify any clients on close that they should failover
+    * @return true if clients should failover
+    */
+   boolean isFailoverOnServerShutdown();
+
+   /*
+   * set to allow clients to failover on server shutdown
+   * */
+   void setFailoverOnServerShutdown(boolean failoverOnServerShutdown);
+
+   /**
     * Sets the cluster password for this server.
     */
    void setClusterPassword(String password);

Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -174,6 +174,8 @@
 
    public static final long DEFAULT_SERVER_DUMP_INTERVAL = -1;
 
+   private static final boolean DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN = false;
+
    public static final int DEFAULT_MEMORY_WARNING_THRESHOLD = 25;
 
    public static final long DEFAULT_MEMORY_MEASURE_INTERVAL = -1; // in milliseconds
@@ -316,6 +318,8 @@
 
    protected long serverDumpInterval = ConfigurationImpl.DEFAULT_SERVER_DUMP_INTERVAL;
 
+   protected boolean failoverOnServerShutdown = ConfigurationImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN;
+
    // percentage of free memory which triggers warning from the memory manager
    protected int memoryWarningThreshold = ConfigurationImpl.DEFAULT_MEMORY_WARNING_THRESHOLD;
 
@@ -879,6 +883,16 @@
       return clusterPassword;
    }
 
+   public boolean isFailoverOnServerShutdown()
+   {
+      return failoverOnServerShutdown;
+   }
+
+   public void setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
+   {
+      this.failoverOnServerShutdown = failoverOnServerShutdown;
+   }
+
    public void setClusterPassword(final String theclusterPassword)
    {
       clusterPassword = theclusterPassword;
@@ -1189,6 +1203,10 @@
       {
          return false;
       }
+      if (failoverOnServerShutdown != other.isFailoverOnServerShutdown())
+      {
+         return false;
+      }
       if (clusterPassword == null)
       {
          if (other.clusterPassword != null)

Modified: trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -164,6 +164,8 @@
       config.setClustered(XMLConfigurationUtil.getBoolean(e, "clustered", config.isClustered()));
 
       config.setAllowAutoFailBack(XMLConfigurationUtil.getBoolean(e, "allow-failback", config.isClustered()));
+      
+      config.setFailoverOnServerShutdown(XMLConfigurationUtil.getBoolean(e, "failover-on-shutdown", config.isFailoverOnServerShutdown()));
 
       config.setBackup(XMLConfigurationUtil.getBoolean(e, "backup", config.isBackup()));
 

Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -1715,6 +1715,21 @@
       }
    }
 
+   public void forceFailover() throws Exception
+   {
+      checkStarted();
+
+      clearIO();
+
+      try
+      {
+         server.stop(true);
+      }
+      finally
+      {
+         blockOnIO();
+      }
+   }
    // NotificationEmitter implementation ----------------------------
 
    public void removeNotificationListener(final NotificationListener listener,

Modified: trunk/src/main/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/HornetQServer.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/server/HornetQServer.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -162,5 +162,5 @@
 
    ServerSession getSessionByID(String sessionID);
 
-   void kill() throws Exception;
+   void stop(boolean failoverOnServerShutdown) throws Exception;
 }

Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -581,14 +581,9 @@
       super.finalize();
    }
 
-   public void kill() throws Exception
-   {
-      stop(true);
-   }
-
    public void stop() throws Exception
    {
-      stop(false);
+      stop(configuration.isFailoverOnServerShutdown());
    }
 
    public void stop(boolean failoverOnServerShutdown) throws Exception

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -155,10 +155,7 @@
 
          BridgeReconnectTest.log.info("** failing connection");
          // Now we will simulate a failure of the bridge connection between server0 and server1
-         /*Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
-           RemotingConnection forwardingConnection = getForwardingConnection(bridge);
-           forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));*/
-         server0.kill();
+         server0.stop(true);
 
          waitForServerStart(service2);
 
@@ -300,7 +297,7 @@
          server1.start();
          server0.start();
          // Now we will simulate a failure of the bridge connection between server0 and server1
-         server0.kill();
+         server0.stop(true);
 
 
          locator = HornetQClient.createServerLocatorWithHA(server2tc);

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -348,9 +348,8 @@
 
       ClusterManagerImpl clusterManager = (ClusterManagerImpl) server.getClusterManager();
       clusterManager.clear();
-      //FailoverManagerImpl.failAllConnectionsForConnector(serverTC);
 
-      server.kill();
+      server.stop(true);
    }
 
    public void testFailAllNodes() throws Exception

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -87,7 +87,7 @@
 
          closeSessionFactory(0);
 
-         servers[0].kill();
+         servers[0].stop(true);
          
          waitForServerRestart(2);
 
@@ -176,7 +176,7 @@
 
          closeSessionFactory(0);
 
-         servers[0].kill();
+         servers[0].stop(true);
 
          waitForServerRestart(2);
 

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -97,16 +97,10 @@
       {
          session.addFailureListener(new MyListener());
       }
-      /*Set<RemotingConnection> connections = server.getRemotingService().getConnections();
-      for (RemotingConnection remotingConnection : connections)
-      {
-         remotingConnection.destroy();
-         server.getRemotingService().removeConnection(remotingConnection.getID());
-      }*/
 
       ClusterManagerImpl clusterManager = (ClusterManagerImpl) server.getClusterManager();
       clusterManager.clear();
-      server.kill();
+      server.stop(true);
 
 
       // Wait to be informed of failure

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSUtil.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSUtil.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSUtil.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -235,16 +235,10 @@
       {
          session.addFailureListener(new MyListener());
       }
-      /*Set<RemotingConnection> connections = server.getRemotingService().getConnections();
-      for (RemotingConnection remotingConnection : connections)
-      {
-         remotingConnection.destroy();
-         server.getRemotingService().removeConnection(remotingConnection.getID());
-      }*/
 
       ClusterManagerImpl clusterManager = (ClusterManagerImpl)server.getClusterManager();
       clusterManager.clear();
-      server.kill();
+      server.stop(true);
 
       // Wait to be informed of failure
       boolean ok = latch.await(10000, TimeUnit.MILLISECONDS);

Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java	2010-12-07 22:24:31 UTC (rev 10009)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java	2010-12-08 06:53:58 UTC (rev 10010)
@@ -562,6 +562,11 @@
 
          }
 
+         public void forceFailover() throws Exception
+         {
+            proxy.invokeOperation("forceFailover");
+         }
+
          public String getLiveConnectorName() throws Exception
          {
             return (String)proxy.retrieveAttributeValue("liveConnectorName");



More information about the hornetq-commits mailing list