[hornetq-commits] JBoss hornetq SVN: r9985 - in trunk: src/main/org/hornetq/api/core/client and 15 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 2 13:08:40 EST 2010


Author: ataylor
Date: 2010-12-02 13:08:38 -0500 (Thu, 02 Dec 2010)
New Revision: 9985

Modified:
   trunk/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java
   trunk/src/main/org/hornetq/api/core/client/HornetQClient.java
   trunk/src/main/org/hornetq/api/core/client/ServerLocator.java
   trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java
   trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
   trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java
   trunk/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
   trunk/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java
   trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
   trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
   trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
   trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
   trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
   trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
   trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
   trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
   trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
   trunk/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
   trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
   trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
Log:
use discoverygroupconfig everywhere

Modified: trunk/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java
===================================================================
--- trunk/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -23,6 +23,7 @@
 
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.common.example.HornetQExample;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.jms.server.impl.JMSFactoryType;
 
 /**
@@ -80,7 +81,9 @@
          // connection factory directly we avoid having to worry about a JNDI look-up.
          // In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without
          // having to know about a specific one.
-         ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA("231.7.7.7", 9876, JMSFactoryType.CF);
+         DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration("231.7.7.7", 9876);
+         
+         ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
 
          // We give a little while for each server to broadcast its whereabouts to the client
          Thread.sleep(2000);

Modified: trunk/src/main/org/hornetq/api/core/client/HornetQClient.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/client/HornetQClient.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/api/core/client/HornetQClient.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 import org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy;
 import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
 import org.hornetq.core.client.impl.ServerLocatorImpl;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 import java.util.List;
 
@@ -116,9 +117,9 @@
     * @param discoveryPort the UDP port to listen for updates
     * @return the ServerLocator
     */
-   public static ServerLocator createServerLocatorWithoutHA(String discoveryAddress, final int discoveryPort)
+   public static ServerLocator createServerLocatorWithoutHA(final DiscoveryGroupConfiguration groupConfiguration)
    {
-      return new ServerLocatorImpl(false, discoveryAddress, discoveryPort);
+      return new ServerLocatorImpl(false, groupConfiguration);
    }
    
    /**
@@ -145,9 +146,9 @@
     * @param discoveryPort the UDP port to listen for updates
     * @return the ServerLocator
     */
-   public static ServerLocator createServerLocatorWithHA(String discoveryAddress, final int discoveryPort)
+   public static ServerLocator createServerLocatorWithHA(final DiscoveryGroupConfiguration groupConfiguration)
    {
-      return new ServerLocatorImpl(true, discoveryAddress, discoveryPort);
+      return new ServerLocatorImpl(true, groupConfiguration);
    }
    
 

Modified: trunk/src/main/org/hornetq/api/core/client/ServerLocator.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/client/ServerLocator.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/api/core/client/ServerLocator.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 import org.hornetq.api.core.Interceptor;
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.loadbalance.ConnectionLoadBalancingPolicy;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A ServerLocator
@@ -358,39 +359,6 @@
    void setAckBatchSize(int ackBatchSize);
 
    /**
-    * Returns the local bind address to which the multicast socket is bound for discovery.
-    * 
-    * This is null if the multicast socket is not bound, or no discovery is being used
-    * 
-    * @return the local bind address to which the multicast socket is bound for discovery
-    */
-   String getLocalBindAddress();
-
-   /**
-    * Sets the local bind address to which the multicast socket is bound for discovery.
-    * 
-    * @param localBindAddress the local bind address
-    */
-   void setLocalBindAddress(String localBindAddress);
-   
-   /**
-    * Returns the address to listen to discover which connectors this factory can use.
-    * The discovery address must be set to enable this factory to discover HornetQ servers.
-    * 
-    * @return the address to listen to discover which connectors this factory can use
-    */
-   String getDiscoveryAddress();
-
-   /**
-    * Returns the port to listen to discover which connectors this factory can use.
-    * The discovery port must be set to enable this factory to discover HornetQ servers.
-    * 
-    * @return the port to listen to discover which connectors this factory can use
-    */   
-   int getDiscoveryPort();
-
-
-   /**
     * Returns an array of TransportConfigurations representing the static list of live servers used when
     * creating this object
     * @return
@@ -398,45 +366,11 @@
    TransportConfiguration[] getStaticTransportConfigurations();
 
    /**
-    * Returns the refresh timeout for discovered HornetQ servers.
-    * 
-    * If this factory uses discovery to find HornetQ servers, the list of discovered servers
-    * will be refreshed according to this timeout.
-    * 
-    * Value is in milliseconds, default value is {@link HornetQClient#DEFAULT_DISCOVERY_REFRESH_TIMEOUT}.
-    * 
-    * @return the refresh timeout for discovered HornetQ servers
+    * The discovery group configuration
     */
-   long getDiscoveryRefreshTimeout();
+   DiscoveryGroupConfiguration getDiscoveryGroupConfiguration();
 
    /**
-    * Sets the refresh timeout for discovered HornetQ servers.
-    * 
-    * Value must be greater than 0.
-    * 
-    * @param discoveryRefreshTimeout refresh timeout (in milliseconds) for discovered HornetQ servers
-    */
-   void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout);
-
-   /**
-    * Returns the initial wait timeout if this factory is configured to use discovery.
-    * 
-    * Value is in milliseconds, default value is  {@link HornetQClient#DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT}.
-    * 
-    * @return the initial wait timeout if this factory is configured to use discovery 
-    */
-   long getDiscoveryInitialWaitTimeout();
-
-   /**
-    * Sets the initial wait timeout if this factory is configured to use discovery.
-    * 
-    * Value is in milliseconds and must be greater than 0.
-    * 
-    * @param initialWaitTimeout initial wait timeout when using discovery 
-    */
-   void setDiscoveryInitialWaitTimeout(long initialWaitTimeout);
-
-   /**
     * Returns whether this factory will use global thread pools (shared among all the factories in the same JVM)
     * or its own pools.
     * 

Modified: trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/api/jms/HornetQJMSClient.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -16,6 +16,7 @@
 import javax.jms.Topic;
 
 import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQDestination;
@@ -46,32 +47,32 @@
     * @param discoveryPort the UDP port to listen for updates
     * @return the HornetQConnectionFactory
     */
-   public static HornetQConnectionFactory createConnectionFactoryWithHA(final String discoveryAddress, final int discoveryPort, JMSFactoryType jmsFactoryType)
+   public static HornetQConnectionFactory createConnectionFactoryWithHA(final DiscoveryGroupConfiguration groupConfiguration, JMSFactoryType jmsFactoryType)
    {
       HornetQConnectionFactory factory = null;
       if (jmsFactoryType.equals(JMSFactoryType.CF))
       {
-         factory = new HornetQJMSConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQJMSConnectionFactory(true, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF))
       {
-         factory = new HornetQQueueConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQQueueConnectionFactory(true, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF))
       {
-         factory = new HornetQTopicConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQTopicConnectionFactory(true, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.XA_CF))
       {
-         factory = new HornetQXAConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQXAConnectionFactory(true, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF))
       {
-         factory = new HornetQXAQueueConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQXAQueueConnectionFactory(true, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF))
       {
-         factory = new HornetQXATopicConnectionFactory(true, discoveryAddress, discoveryPort);
+         factory = new HornetQXATopicConnectionFactory(true, groupConfiguration);
       }
       
       return factory;
@@ -86,32 +87,32 @@
     * @param discoveryPort the UDP port to listen for updates
     * @return the HornetQConnectionFactory
     */
-   public static HornetQConnectionFactory createConnectionFactoryWithoutHA(final String discoveryAddress, final int discoveryPort, JMSFactoryType jmsFactoryType)
+   public static HornetQConnectionFactory createConnectionFactoryWithoutHA(final DiscoveryGroupConfiguration groupConfiguration, JMSFactoryType jmsFactoryType)
    {
       HornetQConnectionFactory factory = null;
       if (jmsFactoryType.equals(JMSFactoryType.CF))
       {
-         factory = new HornetQJMSConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQJMSConnectionFactory(false, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_CF))
       {
-         factory = new HornetQQueueConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQQueueConnectionFactory(false, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_CF))
       {
-         factory = new HornetQTopicConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQTopicConnectionFactory(false, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.XA_CF))
       {
-         factory = new HornetQXAConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQXAConnectionFactory(false, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.QUEUE_XA_CF))
       {
-         factory = new HornetQXAQueueConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQXAQueueConnectionFactory(false, groupConfiguration);
       }
       else if (jmsFactoryType.equals(JMSFactoryType.TOPIC_XA_CF))
       {
-         factory = new HornetQXATopicConnectionFactory(false, discoveryAddress, discoveryPort);
+         factory = new HornetQXATopicConnectionFactory(false, groupConfiguration);
       }
       
       return factory;

Modified: trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.management.Operation;
 import org.hornetq.api.core.management.Parameter;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A ConnectionFactoryControl is used to manage a JMS ConnectionFactory.
@@ -42,6 +43,12 @@
    String[] getJNDIBindings();
 
    /**
+    * does ths cf support HA
+    * @return true if it supports HA
+    */
+   boolean isHA();
+
+   /**
     * Returns the Client ID of this connection factory (or {@code null} if it is not set.
     */
    String getClientID();
@@ -247,27 +254,8 @@
     */
    void setFailoverOnInitialConnection(boolean failoverOnInitialConnection);
 
-    /**
-    * @see org.hornetq.api.core.client.ClientSessionFactory#getDiscoveryRefreshTimeout()
-    */
-   long getDiscoveryRefreshTimeout();
 
     /**
-    * @see ClientSessionFactory#setDiscoveryRefreshTimeout(long)
-    */
-   void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout);
-
-    /**
-    * @see org.hornetq.api.core.client.ClientSessionFactory#getDiscoveryInitialWaitTimeout()
-    */
-   long getDiscoveryInitialWaitTimeout();
-
-    /**
-    * @see ClientSessionFactory#setDiscoveryInitialWaitTimeout(long)
-    */
-   void setDiscoveryInitialWaitTimeout(long discoveryInitialWaitTimeout);
-
-    /**
     * @see org.hornetq.api.core.client.ClientSessionFactory#getProducerWindowSize()
     */
    int getProducerWindowSize();
@@ -363,25 +351,10 @@
    TransportConfiguration[] getStaticConnectors();
 
    /**
-    * @see ClientSessionFactory#getLocalBindAddress()
+    * get the discovery group configuration
     */
-   String getLocalBindAddress();
+   DiscoveryGroupConfiguration getDiscoveryGroupConfiguration();
 
-    /**
-    * @see ClientSessionFactory#setLocalBindAddress(String)
-    */
-   void setLocalBindAddress(String localBindAddress);
-   
-    /**
-    * @see ClientSessionFactory#getDiscoveryAddress()
-    */
-   String getDiscoveryAddress();
-
-    /**
-    * @see ClientSessionFactory#getDiscoveryPort()
-    */
-   int getDiscoveryPort();
-
    /**
     * Add the JNDI binding to this destination
     */

Modified: trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/api/jms/management/JMSServerControl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -143,6 +143,7 @@
     */
    void createConnectionFactory(String name,
                                 boolean ha,
+                                boolean useDiscovery,
                                 @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
                                 String[] connectorNames,
                                 Object[] bindings) throws Exception;
@@ -156,43 +157,11 @@
    @Operation(desc = "Create a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    void createConnectionFactory(@Parameter(name = "name") String name,
                                 @Parameter(name = "ha") boolean ha,
+                                @Parameter(name = "useDiscovery", desc = "should we use discovery or a connector configuration") boolean useDiscovery,
                                 @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
-                                @Parameter(name = "connectorNames", desc = "comma-separated list of connectorNames") String connectors,
+                                @Parameter(name = "connectorNames", desc = "comma-separated list of connectorNames or the discovery group name") String connectors,
                                 @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use ',' if u need to use commas in your jndi name)") String jndiBindings) throws Exception;
 
-   /**
-    * Create a JMS ConnectionFactory with the specified name using a discovery group to discover HornetQ servers.
-    * <br>
-    * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
-    * <br>
-    * This factory listens to the specified {@code discoveryAddress} and {@code discoveryPort} to discover which servers it can connect to.
-    * 
-    * @see #createConnectionFactory(String, Object[], Object[], Object[], Object[])
-    */
-   void createConnectionFactoryDiscovery(String name,
-                                boolean ha,
-                                @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
-                                @Parameter(name = "discoveryGroupName", desc="Refereced at the main configuration, it's the name of the config with automatic discovery") String discoveryGroupName,
-                                @Parameter(name = "jndiBindings", desc="Comma separated JNDI Bindings") String bindings) throws Exception;
-
-   /**
-    * Create a JMS ConnectionFactory with the specified name using a discovery group to discover HornetQ servers.
-    * <br>
-    * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
-    * <br>
-    * This factory listens to the specified {@code discoveryAddress} and {@code discoveryPort} to discover which servers it can connect to.
-    * 
-    * @see #createConnectionFactory(String, Object[], Object[], Object[], Object[])
-    */
-   void createConnectionFactoryDiscovery(String name,
-                                boolean ha,
-                                @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
-                                @Parameter(name = "discoveryGroupName", desc="Refereced at the main configuration, it's the name of the config with automatic discovery") String discoveryGroupName,
-                                Object[] bindings) throws Exception;
-
-   /**
-    * Destroy the ConnectionFactory corresponding to the specified name.
-    */
    @Operation(desc = "Destroy a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    void destroyConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to destroy") String name) throws Exception;
 

Modified: trunk/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -33,6 +33,7 @@
 import org.hornetq.core.cluster.DiscoveryGroup;
 import org.hornetq.core.cluster.DiscoveryListener;
 import org.hornetq.core.cluster.impl.DiscoveryGroupImpl;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.utils.HornetQThreadFactory;
 import org.hornetq.utils.UUIDGenerator;
@@ -52,16 +53,14 @@
 
    private boolean clusterConnection;
 
-   private final String discoveryAddress;
-
-   private final int discoveryPort;
-
    private final Set<ClusterTopologyListener> topologyListeners = new HashSet<ClusterTopologyListener>();
 
    private Set<ClientSessionFactory> factories = new HashSet<ClientSessionFactory>();
 
    private TransportConfiguration[] initialConnectors;
 
+   private DiscoveryGroupConfiguration discoveryGroupConfiguration;
+
    private StaticConnector staticConnector = new StaticConnector();
 
    private Topology topology = new Topology();
@@ -84,12 +83,6 @@
 
    private boolean cacheLargeMessagesClient;
 
-   private String localBindAddress;
-
-   private long discoveryRefreshTimeout;
-
-   private long discoveryInitialWaitTimeout;
-
    private long clientFailureCheckPeriod;
 
    private long connectionTTL;
@@ -267,15 +260,15 @@
 
          instantiateLoadBalancingPolicy();
 
-         if (discoveryAddress != null)
+         if (discoveryGroupConfiguration != null)
          {
-            InetAddress groupAddress = InetAddress.getByName(discoveryAddress);
+            InetAddress groupAddress = InetAddress.getByName(discoveryGroupConfiguration.getGroupAddress());
 
             InetAddress lbAddress;
 
-            if (localBindAddress != null)
+            if (discoveryGroupConfiguration.getLocalBindAddress() != null)
             {
-               lbAddress = InetAddress.getByName(localBindAddress);
+               lbAddress = InetAddress.getByName(discoveryGroupConfiguration.getLocalBindAddress());
             }
             else
             {
@@ -283,11 +276,11 @@
             }
 
             discoveryGroup = new DiscoveryGroupImpl(nodeID,
-                  discoveryAddress,
+                  discoveryGroupConfiguration.getName(),
                   lbAddress,
                   groupAddress,
-                  discoveryPort,
-                  discoveryRefreshTimeout);
+                  discoveryGroupConfiguration.getGroupPort(),
+                  discoveryGroupConfiguration.getRefreshTimeout());
 
             discoveryGroup.registerListener(this);
 
@@ -299,17 +292,14 @@
    }
 
    private ServerLocatorImpl(final boolean useHA,
-                             final String discoveryAddress,
-                             final int discoveryPort,
+                             final DiscoveryGroupConfiguration discoveryGroupConfiguration,
                              final TransportConfiguration[] transportConfigs)
    {
       e.fillInStackTrace();
       this.ha = useHA;
 
-      this.discoveryAddress = discoveryAddress;
+      this.discoveryGroupConfiguration = discoveryGroupConfiguration;
 
-      this.discoveryPort = discoveryPort;
-
       this.initialConnectors = transportConfigs;
 
       this.nodeID = UUIDGenerator.getInstance().generateStringUUID();
@@ -346,8 +336,6 @@
 
       connectionLoadBalancingPolicyClassName = HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
 
-      discoveryInitialWaitTimeout = HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT;
-
       useGlobalPools = HornetQClient.DEFAULT_USE_GLOBAL_POOLS;
 
       scheduledThreadPoolMaxSize = HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE;
@@ -381,9 +369,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public ServerLocatorImpl(final boolean useHA, final String discoveryAddress, final int discoveryPort)
+   public ServerLocatorImpl(final boolean useHA, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      this(useHA, discoveryAddress, discoveryPort, null);
+      this(useHA, groupConfiguration, null);
    }
 
    /**
@@ -393,7 +381,7 @@
     */
    public ServerLocatorImpl(final boolean useHA, final TransportConfiguration... transportConfigs)
    {
-      this(useHA, null, -1, transportConfigs);
+      this(useHA, null, transportConfigs);
    }
 
    private TransportConfiguration selectConnector()
@@ -493,7 +481,7 @@
       if (initialConnectors == null && discoveryGroup != null)
       {
          // Wait for an initial broadcast to give us at least one node in the cluster
-         long timeout = clusterConnection?0:discoveryInitialWaitTimeout;
+         long timeout = clusterConnection?0:discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout();
          boolean ok = discoveryGroup.waitForBroadcast(timeout);
 
          if (!ok)
@@ -777,17 +765,6 @@
       this.ackBatchSize = ackBatchSize;
    }
 
-   public synchronized long getDiscoveryInitialWaitTimeout()
-   {
-      return discoveryInitialWaitTimeout;
-   }
-
-   public synchronized void setDiscoveryInitialWaitTimeout(final long initialWaitTimeout)
-   {
-      checkWrite();
-      discoveryInitialWaitTimeout = initialWaitTimeout;
-   }
-
    public synchronized boolean isUseGlobalPools()
    {
       return useGlobalPools;
@@ -898,35 +875,14 @@
       connectionLoadBalancingPolicyClassName = loadBalancingPolicyClassName;
    }
 
-   public synchronized String getLocalBindAddress()
-   {
-      return localBindAddress;
-   }
-
-   public synchronized void setLocalBindAddress(final String localBindAddress)
-   {
-      checkWrite();
-      this.localBindAddress = localBindAddress;
-   }
-
-   public synchronized String getDiscoveryAddress()
-   {
-      return discoveryAddress;
-   }
-
-   public synchronized int getDiscoveryPort()
-   {
-      return discoveryPort;
-   }
-
    public TransportConfiguration[] getStaticTransportConfigurations()
    {
       return this.initialConnectors;
    }
 
-   public synchronized long getDiscoveryRefreshTimeout()
+   public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
    {
-      return discoveryRefreshTimeout;
+      return discoveryGroupConfiguration;
    }
 
    public void addInterceptor(final Interceptor interceptor)
@@ -939,12 +895,6 @@
       return interceptors.remove(interceptor);
    }
 
-   public synchronized void setDiscoveryRefreshTimeout(final long discoveryRefreshTimeout)
-   {
-      checkWrite();
-      this.discoveryRefreshTimeout = discoveryRefreshTimeout;
-   }
-
    public synchronized int getInitialMessagePacketSize()
    {
       return initialMessagePacketSize;

Modified: trunk/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -15,7 +15,9 @@
 
 import java.io.Serializable;
 
+import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.core.logging.Logger;
+import org.hornetq.utils.UUIDGenerator;
 
 /**
  * A DiscoveryGroupConfiguration
@@ -60,6 +62,12 @@
       this.discoveryInitialWaitTimeout = discoveryInitialWaitTimeout;
    }
 
+   public DiscoveryGroupConfiguration(final String groupAddress,
+                                      final int groupPort)
+   {
+      this(UUIDGenerator.getInstance().generateStringUUID(), null, groupAddress, groupPort, HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT, HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
+   }
+
    public String getName()
    {
       return name;
@@ -140,6 +148,35 @@
    {
       this.discoveryInitialWaitTimeout = discoveryInitialWaitTimeout;
    }
-   
-   
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      DiscoveryGroupConfiguration that = (DiscoveryGroupConfiguration) o;
+
+      if (discoveryInitialWaitTimeout != that.discoveryInitialWaitTimeout) return false;
+      if (groupPort != that.groupPort) return false;
+      if (refreshTimeout != that.refreshTimeout) return false;
+      if (groupAddress != null ? !groupAddress.equals(that.groupAddress) : that.groupAddress != null) return false;
+      if (localBindAddress != null ? !localBindAddress.equals(that.localBindAddress) : that.localBindAddress != null)
+         return false;
+      if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result = name != null ? name.hashCode() : 0;
+      result = 31 * result + (localBindAddress != null ? localBindAddress.hashCode() : 0);
+      result = 31 * result + (groupAddress != null ? groupAddress.hashCode() : 0);
+      result = 31 * result + groupPort;
+      result = 31 * result + (int) (refreshTimeout ^ (refreshTimeout >>> 32));
+      result = 31 * result + (int) (discoveryInitialWaitTimeout ^ (discoveryInitialWaitTimeout >>> 32));
+      return result;
+   }
 }

Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -636,13 +636,11 @@
 
          if (config.isHA())
          {
-            serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(discoveryGroupConfiguration.getGroupAddress(),
-                                                                    discoveryGroupConfiguration.getGroupPort());
+            serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(discoveryGroupConfiguration);
          }
          else
          {
-            serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(discoveryGroupConfiguration.getGroupAddress(),
-                                                                       discoveryGroupConfiguration.getGroupPort());
+            serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(discoveryGroupConfiguration);
          }
 
       }
@@ -755,7 +753,7 @@
                                         "'. The cluster connection will not be deployed.");
          }
 
-         serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(dg.getGroupAddress(), dg.getGroupPort());
+         serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(dg);
          serverLocator.setNodeID(nodeUUID.toString());
          serverLocator.setReconnectAttempts(-1);
          clusterLocators.add(serverLocator);
@@ -818,9 +816,8 @@
                                         "'. The cluster connection will not be deployed.");
          }
 
-         backupServerLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(dg.getGroupAddress(), dg.getGroupPort());
+         backupServerLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(dg);
          backupServerLocator.setReconnectAttempts(-1);
-         backupServerLocator.setDiscoveryInitialWaitTimeout(0);
       }
       else
       {

Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnection.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnection.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -115,6 +115,8 @@
 
    private final Exception creationStack;
 
+   private HornetQConnectionFactory factoryReference;
+
    // Constructors ---------------------------------------------------------------------------------
 
    public HornetQConnection(final String username,
@@ -589,6 +591,11 @@
       }
    }
 
+   public void setReference(HornetQConnectionFactory factory)
+   {
+      this.factoryReference = factory;
+   }
+
    // Inner classes --------------------------------------------------------------------------------
 
    private static class JMSFailureListener implements SessionFailureListener

Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -30,6 +30,7 @@
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.jms.referenceable.ConnectionFactoryObjectFactory;
 import org.hornetq.jms.referenceable.SerializableObjectRefAddr;
@@ -75,15 +76,15 @@
       this.serverLocator = serverLocator;
    }
 
-   public HornetQConnectionFactory(final boolean ha, final String discoveryAddress, final int discoveryPort)
+   public HornetQConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
       if (ha)
       {
-         serverLocator = HornetQClient.createServerLocatorWithHA(discoveryAddress, discoveryPort);
+         serverLocator = HornetQClient.createServerLocatorWithHA(groupConfiguration);
       }
       else
       {
-         serverLocator = HornetQClient.createServerLocatorWithoutHA(discoveryAddress, discoveryPort);         
+         serverLocator = HornetQClient.createServerLocatorWithoutHA(groupConfiguration);
       }
    }
 
@@ -183,6 +184,11 @@
 
    // Public ---------------------------------------------------------------------------------------
 
+   public boolean isHA()
+   {
+      return serverLocator.isHA();
+   }
+
    public synchronized String getConnectionLoadBalancingPolicyClassName()
    {
       return serverLocator.getConnectionLoadBalancingPolicyClassName();
@@ -199,49 +205,11 @@
       return serverLocator.getStaticTransportConfigurations();
    }
 
-   public synchronized String getLocalBindAddress()
+   public synchronized DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
    {
-      return serverLocator.getLocalBindAddress();
+      return serverLocator.getDiscoveryGroupConfiguration();
    }
 
-   public synchronized void setLocalBindAddress(final String localBindAddress)
-   {
-      checkWrite();
-      serverLocator.setLocalBindAddress(localBindAddress);
-   }
-
-   public synchronized String getDiscoveryAddress()
-   {
-      return serverLocator.getDiscoveryAddress();
-   }
-
-   public synchronized int getDiscoveryPort()
-   {
-      return serverLocator.getDiscoveryPort();
-   }
-
-   public synchronized long getDiscoveryRefreshTimeout()
-   {
-      return serverLocator.getDiscoveryRefreshTimeout();
-   }
-
-   public synchronized void setDiscoveryRefreshTimeout(final long discoveryRefreshTimeout)
-   {
-      checkWrite();
-      serverLocator.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
-   }
-
-   public synchronized long getDiscoveryInitialWaitTimeout()
-   {
-      return serverLocator.getDiscoveryInitialWaitTimeout();
-   }
-
-   public synchronized void setDiscoveryInitialWaitTimeout(final long discoveryInitialWaitTimeout)
-   {
-      checkWrite();
-      serverLocator.setDiscoveryInitialWaitTimeout(discoveryInitialWaitTimeout);
-   }
-
    public synchronized String getClientID()
    {
       return clientID;
@@ -688,7 +656,7 @@
                                                     factory);
          }         
       }
-
+      connection.setReference(this);
       try
       {
          connection.authorize();
@@ -718,6 +686,18 @@
       }
    }
 
+   public void finalize() throws Throwable
+   {
+      try
+      {
+         serverLocator.close();
+      }
+      catch (Exception e)
+      {
+         //not much we can do here
+      }
+      super.finalize();
+   }
    // Inner classes --------------------------------------------------------------------------------
 
 }

Modified: trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -19,6 +19,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 
 /**
@@ -52,9 +53,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQJMSConnectionFactory(boolean ha, String discoveryAddress, int discoveryPort)
+   public HornetQJMSConnectionFactory(boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A class that represents a QueueConnectionFactory.
@@ -49,9 +50,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQQueueConnectionFactory(boolean ha, String discoveryAddress, int discoveryPort)
+   public HornetQQueueConnectionFactory(boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A class that represents a TopicConnectionFactory.
@@ -50,9 +51,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQTopicConnectionFactory(final boolean ha, final String discoveryAddress, final int discoveryPort)
+   public HornetQTopicConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -22,6 +22,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A class that represents a XAConnectionFactory.
@@ -55,9 +56,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQXAConnectionFactory(final boolean ha, final String discoveryAddress, final int discoveryPort)
+   public HornetQXAConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A class that represents a XAQueueConnectionFactory.
@@ -49,9 +50,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQXAQueueConnectionFactory(final boolean ha, final String discoveryAddress, final int discoveryPort)
+   public HornetQXAQueueConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -17,6 +17,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 
 /**
  * A class that represents a XATopicConnectionFactory.
@@ -49,9 +50,9 @@
     * @param discoveryAddress
     * @param discoveryPort
     */
-   public HornetQXATopicConnectionFactory(final boolean ha, final String discoveryAddress, final int discoveryPort)
+   public HornetQXATopicConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration)
    {
-      super(ha, discoveryAddress, discoveryPort);
+      super(ha, groupConfiguration);
    }
 
    /**

Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -20,6 +20,7 @@
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.management.Parameter;
 import org.hornetq.api.jms.management.ConnectionFactoryControl;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.management.impl.MBeanInfoHelper;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.server.JMSServerManager;
@@ -65,6 +66,11 @@
       return jmsManager.getJNDIOnConnectionFactory(name);
    }
 
+   public boolean isHA()
+   {
+      return cf.isHA();
+   }
+
    public String getClientID()
    {
       return cf.getClientID();
@@ -75,31 +81,11 @@
       return cf.getClientFailureCheckPeriod();
    }
 
-   public long getDiscoveryRefreshTimeout()
-   {
-      return cf.getDiscoveryRefreshTimeout();
-   }
-
    public String getConnectionLoadBalancingPolicyClassName()
    {
       return cf.getConnectionLoadBalancingPolicyClassName();
    }
 
-   public void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout)
-   {
-      cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
-   }
-
-   public long getDiscoveryInitialWaitTimeout()
-   {
-      return cf.getDiscoveryInitialWaitTimeout();
-   }
-
-   public void setDiscoveryInitialWaitTimeout(long discoveryInitialWaitTimeout)
-   {
-      cf.setDiscoveryInitialWaitTimeout(discoveryInitialWaitTimeout);
-   }
-
    public void setClientID(String clientID)
    {
       cf.setClientID(clientID);
@@ -290,26 +276,11 @@
       return cf.getStaticConnectors();
    }
 
-   public String getLocalBindAddress()
+   public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
    {
-      return cf.getLocalBindAddress();
+      return cf.getDiscoveryGroupConfiguration();
    }
 
-   public void setLocalBindAddress(String localBindAddress)
-   {
-      cf.setLocalBindAddress(localBindAddress);
-   }
-
-   public String getDiscoveryAddress()
-   {
-      return cf.getDiscoveryAddress();
-   }
-
-   public int getDiscoveryPort()
-   {
-      return cf.getDiscoveryPort();
-   }
-
    public void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception
    {
        jmsManager.addConnectionFactoryToJNDI(name, jndi);

Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -159,9 +159,10 @@
     */
    public void createConnectionFactory(String name,
                                        boolean ha,
+                                       boolean useDiscovery,
                                        int cfType,
                                        String[] connectorNames,
-                                       Object[] jndiBindings) throws Exception
+                                       Object[] bindings) throws Exception
    {
       checkStarted();
 
@@ -169,19 +170,35 @@
 
       try
       {
-         List<String> connectorList = new ArrayList<String>(connectorNames.length);
-
-         for (String str : connectorNames)
+         if(useDiscovery)
          {
-            connectorList.add(str);
-         }
-
-         server.createConnectionFactory(name,
+            if(connectorNames == null || connectorNames.length == 0)
+            {
+               throw new IllegalArgumentException("no discovery group name supplied");
+            }
+            server.createConnectionFactory(name,
                                         ha,
                                         JMSFactoryType.valueOf(cfType),
-                                        connectorList,
-                                        JMSServerControlImpl.convert(jndiBindings));
+                                        connectorNames[0],
+                                        JMSServerControlImpl.convert(bindings));
+         }
+         else
+         {
+            List<String> connectorList = new ArrayList<String>(connectorNames.length);
 
+            for (String str : connectorNames)
+            {
+               connectorList.add(str);
+            }
+
+            server.createConnectionFactory(name,
+                  ha,
+                  JMSFactoryType.valueOf(cfType),
+                  connectorList,
+                  JMSServerControlImpl.convert(bindings));
+         }
+
+
          sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
       }
       finally
@@ -196,55 +213,11 @@
     * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
     *  
     */
-   public void createConnectionFactory(String name, boolean ha, int cfType, String connectors, String jndiBindings) throws Exception
+   public void createConnectionFactory(String name, boolean ha, boolean useDiscovery, int cfType, String connectors, String jndiBindings) throws Exception
    {
-
-      createConnectionFactory(name, ha, cfType, toArray(connectors), toArray(jndiBindings));
-
+      createConnectionFactory(name, ha, useDiscovery, cfType, toArray(connectors), toArray(jndiBindings));
    }
 
-   /**
-    * Look at the iterface for the javadoc
-    */
-   public void createConnectionFactoryDiscovery(String name,
-                                                boolean ha,
-                                                int cfType,
-                                                String discoveryGroupName,
-                                                Object[] bindings) throws Exception
-   {
-      checkStarted();
-
-      clearIO();
-
-      try
-      {
-         server.createConnectionFactory(name,
-                                        ha,
-                                        JMSFactoryType.valueOf(cfType),
-                                        discoveryGroupName,
-                                        JMSServerControlImpl.convert(bindings));
-
-         sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
-      }
-      finally
-      {
-         blockOnIO();
-      }
-
-   }
-
-   /**
-    * Look at the iterface for the javadoc
-    */
-   public void createConnectionFactoryDiscovery(String name,
-                                                boolean ha,
-                                                int cfType,
-                                                String discoveryGroupName,
-                                                String jndiBindings) throws Exception
-   {
-      createConnectionFactoryDiscovery(name, ha, cfType, discoveryGroupName, toArray(jndiBindings));
-   }
-
    public boolean createQueue(final String name) throws Exception
    {
       return createQueue(name, null, null, true);

Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -1012,19 +1012,12 @@
 
             if (cfConfig.isHA())
             {
-               cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig.getGroupAddress(), 
-                                                                   groupConfig.getGroupPort(), 
-                                                                   cfConfig.getFactoryType());
+               cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
             }
             else
             {
-               cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig.getGroupAddress(), 
-                                                                      groupConfig.getGroupPort(), 
-                                                                      cfConfig.getFactoryType());
+               cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
             }
-            cf.setLocalBindAddress(groupConfig.getLocalBindAddress());
-            cf.setDiscoveryRefreshTimeout(groupConfig.getRefreshTimeout());
-            cf.setDiscoveryInitialWaitTimeout(groupConfig.getDiscoveryInitialWaitTimeout());
          }
          else
          {

Modified: trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/src/main/org/hornetq/ra/HornetQResourceAdapter.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -35,6 +35,7 @@
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.jms.HornetQJMSClient;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.server.impl.JMSFactoryType;
@@ -1404,14 +1405,26 @@
       {
          Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort()
                                                                               : getDiscoveryPort();
-         
+
+         DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(discoveryAddress, discoveryPort);
+
+         long refreshTimeout = overrideProperties.getDiscoveryRefreshTimeout() != null ? overrideProperties.getDiscoveryRefreshTimeout()
+                                                                    : raProperties.getDiscoveryRefreshTimeout();
+
+         long initialTimeout = overrideProperties.getDiscoveryInitialWaitTimeout() != null ? overrideProperties.getDiscoveryInitialWaitTimeout()
+                                                                        : raProperties.getDiscoveryInitialWaitTimeout();
+
+         groupConfiguration.setDiscoveryInitialWaitTimeout(initialTimeout);
+
+         groupConfiguration.setRefreshTimeout(refreshTimeout);
+
          if (ha)
          {
-            cf = HornetQJMSClient.createConnectionFactoryWithHA(discoveryAddress, discoveryPort, JMSFactoryType.XA_CF);
+            cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.XA_CF);
          }
          else
          {
-            cf = HornetQJMSClient.createConnectionFactoryWithoutHA(discoveryAddress, discoveryPort, JMSFactoryType.XA_CF);
+            cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.XA_CF);
          }
       }
       else
@@ -1583,18 +1596,7 @@
       {
          cf.setConnectionTTL(val3);
       }
-      val3 = overrideProperties.getDiscoveryInitialWaitTimeout() != null ? overrideProperties.getDiscoveryInitialWaitTimeout()
-                                                                        : raProperties.getDiscoveryInitialWaitTimeout();
-      if (val3 != null)
-      {
-         cf.setDiscoveryInitialWaitTimeout(val3);
-      }
-      val3 = overrideProperties.getDiscoveryRefreshTimeout() != null ? overrideProperties.getDiscoveryRefreshTimeout()
-                                                                    : raProperties.getDiscoveryRefreshTimeout();
-      if (val3 != null)
-      {
-         cf.setDiscoveryRefreshTimeout(val3);
-      }
+
       val3 = overrideProperties.getRetryInterval() != null ? overrideProperties.getRetryInterval()
                                                           : raProperties.getRetryInterval();
       if (val3 != null)

Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -29,6 +29,7 @@
 import org.hornetq.api.core.client.ServerLocator;
 import org.hornetq.core.config.BroadcastGroupConfiguration;
 import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -50,10 +51,8 @@
 {
    private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
 
-   private final String groupAddress = getUDPDiscoveryAddress();
+   private DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
 
-   private final int groupPort = getUDPDiscoveryPort();
-
    private HornetQServer liveService;
 
    private TransportConfiguration liveTC;
@@ -113,13 +112,11 @@
 
    public void testDiscoveryConstructor() throws Exception
    {
-      ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(groupAddress, groupPort);
+      ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(groupConfiguration);
 
       assertFactoryParams(locator,
                           null,
-                          groupAddress,
-                          groupPort,
-                          0,
+                          groupConfiguration,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
                           HornetQClient.DEFAULT_CALL_TIMEOUT,
@@ -135,7 +132,6 @@
                           HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
                           HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                           HornetQClient.DEFAULT_ACK_BATCH_SIZE,
-                          HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
                           HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
                           HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
                           HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
@@ -160,8 +156,6 @@
       assertFactoryParams(locator,
                           tc,
                           null,
-                          -1,
-                          0,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
                           HornetQClient.DEFAULT_CALL_TIMEOUT,
@@ -177,7 +171,6 @@
                           HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
                           HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
                           HornetQClient.DEFAULT_ACK_BATCH_SIZE,
-                          HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
                           HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
                           HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
                           HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
@@ -200,7 +193,6 @@
       TransportConfiguration[] tc = new TransportConfiguration[] { liveTC };
       ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(tc);
 
-      long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
       long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
       long connectionTTL = RandomUtil.randomPositiveLong();
       long callTimeout = RandomUtil.randomPositiveLong();
@@ -216,7 +208,6 @@
       boolean preAcknowledge = RandomUtil.randomBoolean();
       String loadBalancingPolicyClassName = RandomUtil.randomString();
       int ackBatchSize = RandomUtil.randomPositiveInt();
-      long initialWaitTimeout = RandomUtil.randomPositiveLong();
       boolean useGlobalPools = RandomUtil.randomBoolean();
       int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
       int threadPoolMaxSize = RandomUtil.randomPositiveInt();
@@ -224,7 +215,6 @@
       double retryIntervalMultiplier = RandomUtil.randomDouble();
       int reconnectAttempts = RandomUtil.randomPositiveInt();
 
-      locator.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
       locator.setClientFailureCheckPeriod(clientFailureCheckPeriod);
       locator.setConnectionTTL(connectionTTL);
       locator.setCallTimeout(callTimeout);
@@ -240,7 +230,6 @@
       locator.setPreAcknowledge(preAcknowledge);
       locator.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
       locator.setAckBatchSize(ackBatchSize);
-      locator.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
       locator.setUseGlobalPools(useGlobalPools);
       locator.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
       locator.setThreadPoolMaxSize(threadPoolMaxSize);
@@ -249,9 +238,6 @@
       locator.setReconnectAttempts(reconnectAttempts);
 
       assertEqualsTransportConfigurations(tc, locator.getStaticTransportConfigurations());
-      Assert.assertEquals(null, locator.getDiscoveryAddress());
-      Assert.assertEquals(-1, locator.getDiscoveryPort());
-      Assert.assertEquals(discoveryRefreshTimeout, locator.getDiscoveryRefreshTimeout());
       Assert.assertEquals(clientFailureCheckPeriod, locator.getClientFailureCheckPeriod());
       Assert.assertEquals(connectionTTL, locator.getConnectionTTL());
       Assert.assertEquals(callTimeout, locator.getCallTimeout());
@@ -268,7 +254,6 @@
       Assert.assertEquals(loadBalancingPolicyClassName, locator
                                                           .getConnectionLoadBalancingPolicyClassName());
       Assert.assertEquals(ackBatchSize, locator.getAckBatchSize());
-      Assert.assertEquals(initialWaitTimeout, locator.getDiscoveryInitialWaitTimeout());
       Assert.assertEquals(useGlobalPools, locator.isUseGlobalPools());
       Assert.assertEquals(scheduledThreadPoolMaxSize, locator.getScheduledThreadPoolMaxSize());
       Assert.assertEquals(threadPoolMaxSize, locator.getThreadPoolMaxSize());
@@ -280,7 +265,6 @@
 
    private void testSettersThrowException(final ClientSessionFactory cf)
    {
-      long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
       long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
       long connectionTTL = RandomUtil.randomPositiveLong();
       long callTimeout = RandomUtil.randomPositiveLong();
@@ -296,7 +280,6 @@
       boolean preAcknowledge = RandomUtil.randomBoolean();
       String loadBalancingPolicyClassName = RandomUtil.randomString();
       int ackBatchSize = RandomUtil.randomPositiveInt();
-      long initialWaitTimeout = RandomUtil.randomPositiveLong();
       boolean useGlobalPools = RandomUtil.randomBoolean();
       int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
       int threadPoolMaxSize = RandomUtil.randomPositiveInt();
@@ -306,15 +289,6 @@
 
       try
       {
-         cf.getServerLocator().setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
-         Assert.fail("Should throw exception");
-      }
-      catch (IllegalStateException e)
-      {
-         // OK
-      }
-      try
-      {
          cf.getServerLocator().setClientFailureCheckPeriod(clientFailureCheckPeriod);
          Assert.fail("Should throw exception");
       }
@@ -450,15 +424,6 @@
       }
       try
       {
-         cf.getServerLocator().setDiscoveryInitialWaitTimeout(initialWaitTimeout);
-         Assert.fail("Should throw exception");
-      }
-      catch (IllegalStateException e)
-      {
-         // OK
-      }
-      try
-      {
          cf.getServerLocator().setUseGlobalPools(useGlobalPools);
          Assert.fail("Should throw exception");
       }
@@ -513,9 +478,6 @@
       }
 
       cf.getServerLocator().getStaticTransportConfigurations();
-      cf.getServerLocator().getDiscoveryAddress();
-      cf.getServerLocator().getDiscoveryPort();
-      cf.getServerLocator().getDiscoveryRefreshTimeout();
       cf.getServerLocator().getClientFailureCheckPeriod();
       cf.getServerLocator().getConnectionTTL();
       cf.getServerLocator().getCallTimeout();
@@ -531,7 +493,6 @@
       cf.getServerLocator().isPreAcknowledge();
       cf.getServerLocator().getConnectionLoadBalancingPolicyClassName();
       cf.getServerLocator().getAckBatchSize();
-      cf.getServerLocator().getDiscoveryInitialWaitTimeout();
       cf.getServerLocator().isUseGlobalPools();
       cf.getServerLocator().getScheduledThreadPoolMaxSize();
       cf.getServerLocator().getThreadPoolMaxSize();
@@ -543,9 +504,7 @@
 
    private void assertFactoryParams(final ServerLocator locator,
                                     final TransportConfiguration[] staticConnectors,
-                                    final String discoveryAddress,
-                                    final int discoveryPort,
-                                    final long discoveryRefreshTimeout,
+                                    final DiscoveryGroupConfiguration discoveryGroupConfiguration,
                                     final long clientFailureCheckPeriod,
                                     final long connectionTTL,
                                     final long callTimeout,
@@ -561,7 +520,6 @@
                                     final boolean preAcknowledge,
                                     final String loadBalancingPolicyClassName,
                                     final int ackBatchSize,
-                                    final long initialWaitTimeout,
                                     final boolean useGlobalPools,
                                     final int scheduledThreadPoolMaxSize,
                                     final int threadPoolMaxSize,
@@ -577,9 +535,7 @@
       {
          assertEqualsTransportConfigurations(staticConnectors, locator.getStaticTransportConfigurations());
       }
-      Assert.assertEquals(locator.getDiscoveryAddress(), discoveryAddress);
-      Assert.assertEquals(locator.getDiscoveryPort(), discoveryPort);
-      Assert.assertEquals(locator.getDiscoveryRefreshTimeout(), discoveryRefreshTimeout);
+      Assert.assertEquals(locator.getDiscoveryGroupConfiguration(), discoveryGroupConfiguration);
       Assert.assertEquals(locator.getClientFailureCheckPeriod(), clientFailureCheckPeriod);
       Assert.assertEquals(locator.getConnectionTTL(), connectionTTL);
       Assert.assertEquals(locator.getCallTimeout(), callTimeout);
@@ -596,7 +552,6 @@
       Assert.assertEquals(locator.getConnectionLoadBalancingPolicyClassName(),
                           loadBalancingPolicyClassName);
       Assert.assertEquals(locator.getAckBatchSize(), ackBatchSize);
-      Assert.assertEquals(locator.getDiscoveryInitialWaitTimeout(), initialWaitTimeout);
       Assert.assertEquals(locator.isUseGlobalPools(), useGlobalPools);
       Assert.assertEquals(locator.getScheduledThreadPoolMaxSize(), scheduledThreadPoolMaxSize);
       Assert.assertEquals(locator.getThreadPoolMaxSize(), threadPoolMaxSize);
@@ -624,8 +579,8 @@
       BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration(bcGroupName,
                                                                               null,
                                                                               localBindPort,
-                                                                              groupAddress,
-                                                                              groupPort,
+                                                                              getUDPDiscoveryAddress(),
+                                                                              getUDPDiscoveryPort(),
                                                                               broadcastPeriod,
                                                                               Arrays.asList(liveTC.getName()));
 

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -15,6 +15,7 @@
 
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.core.logging.Logger;
 
 /**
@@ -59,7 +60,7 @@
    @Override
    protected ServerLocator createHAServerLocator()
    {
-      ServerLocator locator = HornetQClient.createServerLocatorWithHA(groupAddress, groupPort);
+      ServerLocator locator = HornetQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration(groupAddress, groupPort));
       locator.setBlockOnNonDurableSend(true);
       locator.setBlockOnDurableSend(true);
       return locator;

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -25,6 +25,7 @@
 
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
 import org.hornetq.jms.server.impl.JMSFactoryType;
 import org.hornetq.api.jms.HornetQJMSClient;
 import org.hornetq.core.config.BroadcastGroupConfiguration;
@@ -63,8 +64,6 @@
       assertFactoryParams(cf,
                           null,
                           null,
-                          -1,
-                          0,
                           null,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -121,8 +120,6 @@
       assertFactoryParams(cf,
                           new TransportConfiguration[]{liveTC},
                           null,
-                          -1,
-                          0,
                           null,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -159,12 +156,11 @@
 
    public void testDiscoveryConstructor() throws Exception
    {
-      HornetQConnectionFactory cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(groupAddress, groupPort, JMSFactoryType.CF);
+      DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration("test", "foo", "192.168.5.4", 3456, 5000, 1000);
+      HornetQConnectionFactory cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
       assertFactoryParams(cf,
                           null,
-                          groupAddress,
-                          groupPort,
-                          0,
+                          groupConfiguration,
                           null,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -204,8 +200,6 @@
       assertFactoryParams(cf,
                           new TransportConfiguration[]{liveTC},
                           null,
-                          -1,
-                          0,
                           null,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -246,8 +240,6 @@
       assertFactoryParams(cf,
                           new TransportConfiguration[]{liveTC},
                           null,
-                          -1,
-                          0,
                           null,
                           HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
                           HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -288,7 +280,6 @@
    {
       HornetQConnectionFactory cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, liveTC);
 
-      long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
       long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
       long connectionTTL = RandomUtil.randomPositiveLong();
       long callTimeout = RandomUtil.randomPositiveLong();
@@ -303,16 +294,12 @@
       boolean autoGroup = RandomUtil.randomBoolean();
       boolean preAcknowledge = RandomUtil.randomBoolean();
       String loadBalancingPolicyClassName = RandomUtil.randomString();
-      long initialWaitTimeout = RandomUtil.randomPositiveLong();
       boolean useGlobalPools = RandomUtil.randomBoolean();
       int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
       int threadPoolMaxSize = RandomUtil.randomPositiveInt();
       long retryInterval = RandomUtil.randomPositiveLong();
       double retryIntervalMultiplier = RandomUtil.randomDouble();
       int reconnectAttempts = RandomUtil.randomPositiveInt();
-      boolean failoverOnServerShutdown = RandomUtil.randomBoolean();
-
-      cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
       cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
       cf.setConnectionTTL(connectionTTL);
       cf.setCallTimeout(callTimeout);
@@ -327,17 +314,12 @@
       cf.setAutoGroup(autoGroup);
       cf.setPreAcknowledge(preAcknowledge);
       cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
-      cf.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
       cf.setUseGlobalPools(useGlobalPools);
       cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
       cf.setThreadPoolMaxSize(threadPoolMaxSize);
       cf.setRetryInterval(retryInterval);
       cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
       cf.setReconnectAttempts(reconnectAttempts);
-
-      Assert.assertEquals(null, cf.getDiscoveryAddress());
-      Assert.assertEquals(-1, cf.getDiscoveryPort());
-      Assert.assertEquals(discoveryRefreshTimeout, cf.getDiscoveryRefreshTimeout());
       Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod());
       Assert.assertEquals(connectionTTL, cf.getConnectionTTL());
       Assert.assertEquals(callTimeout, cf.getCallTimeout());
@@ -352,7 +334,6 @@
       Assert.assertEquals(autoGroup, cf.isAutoGroup());
       Assert.assertEquals(preAcknowledge, cf.isPreAcknowledge());
       Assert.assertEquals(loadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
-      Assert.assertEquals(initialWaitTimeout, cf.getDiscoveryInitialWaitTimeout());
       Assert.assertEquals(useGlobalPools, cf.isUseGlobalPools());
       Assert.assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize());
       Assert.assertEquals(threadPoolMaxSize, cf.getThreadPoolMaxSize());
@@ -397,15 +378,6 @@
 
       try
       {
-         cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
-         Assert.fail("Should throw exception");
-      }
-      catch (IllegalStateException e)
-      {
-         // OK
-      }
-      try
-      {
          cf.setClientID(clientID);
          Assert.fail("Should throw exception");
       }
@@ -559,15 +531,6 @@
       }
       try
       {
-         cf.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
-         Assert.fail("Should throw exception");
-      }
-      catch (IllegalStateException e)
-      {
-         // OK
-      }
-      try
-      {
          cf.setUseGlobalPools(useGlobalPools);
          Assert.fail("Should throw exception");
       }
@@ -622,9 +585,6 @@
       }
 
       cf.getStaticConnectors();
-      cf.getDiscoveryAddress();
-      cf.getDiscoveryPort();
-      cf.getDiscoveryRefreshTimeout();
       cf.getClientID();
       cf.getClientFailureCheckPeriod();
       cf.getConnectionTTL();
@@ -642,7 +602,6 @@
       cf.getConnectionLoadBalancingPolicyClassName();
       cf.getDupsOKBatchSize();
       cf.getTransactionBatchSize();
-      cf.getDiscoveryInitialWaitTimeout();
       cf.isUseGlobalPools();
       cf.getScheduledThreadPoolMaxSize();
       cf.getThreadPoolMaxSize();
@@ -655,9 +614,7 @@
 
    private void assertFactoryParams(final HornetQConnectionFactory cf,
                                     final TransportConfiguration[] staticConnectors,
-                                    final String discoveryAddress,
-                                    final int discoveryPort,
-                                    final long discoveryRefreshTimeout,
+                                    final DiscoveryGroupConfiguration discoveryGroupConfiguration,
                                     final String clientID,
                                     final long clientFailureCheckPeriod,
                                     final long connectionTTL,
@@ -697,9 +654,6 @@
             Assert.assertEquals(staticConnectors[i], cfStaticConnectors[i]);
          }
       }
-      Assert.assertEquals(cf.getDiscoveryAddress(), discoveryAddress);
-      Assert.assertEquals(cf.getDiscoveryPort(), discoveryPort);
-      Assert.assertEquals(cf.getDiscoveryRefreshTimeout(), discoveryRefreshTimeout);
       Assert.assertEquals(cf.getClientID(), clientID);
       Assert.assertEquals(cf.getClientFailureCheckPeriod(), clientFailureCheckPeriod);
       Assert.assertEquals(cf.getConnectionTTL(), connectionTTL);
@@ -717,7 +671,6 @@
       Assert.assertEquals(cf.getConnectionLoadBalancingPolicyClassName(), loadBalancingPolicyClassName);
       Assert.assertEquals(cf.getDupsOKBatchSize(), dupsOKBatchSize);
       Assert.assertEquals(cf.getTransactionBatchSize(), transactionBatchSize);
-      Assert.assertEquals(cf.getDiscoveryInitialWaitTimeout(), initialWaitTimeout);
       Assert.assertEquals(cf.isUseGlobalPools(), useGlobalPools);
       Assert.assertEquals(cf.getScheduledThreadPoolMaxSize(), scheduledThreadPoolMaxSize);
       Assert.assertEquals(cf.getThreadPoolMaxSize(), threadPoolMaxSize);

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -309,11 +309,6 @@
          Assert.assertEquals(5, cf.getRetryInterval());
          Assert.assertEquals(6.0, cf.getRetryIntervalMultiplier());
          Assert.assertEquals(true, cf.isCacheLargeMessagesClient());
-         
-         assertEquals("243.7.7.7", cf.getDiscoveryAddress());
-         assertEquals("172.16.8.10", cf.getLocalBindAddress());
-         assertEquals(12345, cf.getDiscoveryPort());
-         assertEquals(5432, cf.getDiscoveryRefreshTimeout());
       }
 
       for (String binding : queueBindings)

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -62,6 +62,7 @@
  * 
  * Created 14 nov. 2008 13:35:10
  *
+ * 
  *
  */
 public class JMSServerControl2Test extends ManagementTestBase

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -420,6 +420,7 @@
 
             control.createConnectionFactory(cfName,
                                             false,
+                                            false,
                                             0,
                                             "tst",
                                             jndiBindings);
@@ -437,7 +438,7 @@
       
       server.getConfiguration().getConnectorConfigurations().put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
 
-      control.createConnectionFactory(cfName, false, 0, "tst", cfJNDIBinding);
+      control.createConnectionFactory(cfName, false, false, 0, "tst", cfJNDIBinding);
 
       control.createQueue("q", "/q");
 
@@ -480,7 +481,7 @@
       
       server.getConfiguration().getConnectorConfigurations().put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
 
-      control.createConnectionFactory(cfName, false, 0, "tst", cfJNDIBinding);
+      control.createConnectionFactory(cfName, false, false,  0, "tst", cfJNDIBinding);
 
       control.createQueue("q", "/q");
 

Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -247,38 +247,21 @@
 
          public void createConnectionFactory(String name,
                                              boolean ha,
+                                             boolean useDiscovery,
                                              int cfType,
                                              String[] connectorNames,
                                              Object[] bindings) throws Exception
          {
-            proxy.invokeOperation("createConnectionFactory", name, ha, cfType, connectorNames, bindings);
+            proxy.invokeOperation("createConnectionFactory", name, ha, useDiscovery, cfType, connectorNames, bindings);
             
          }
 
-         public void createConnectionFactory(String name, boolean ha, int cfType, String connectors, String jndiBindings) throws Exception
+         public void createConnectionFactory(String name, boolean ha, boolean useDiscovery, int cfType, String connectors, String jndiBindings) throws Exception
          {
-            proxy.invokeOperation("createConnectionFactory", name, ha, cfType, connectors, jndiBindings);
+            proxy.invokeOperation("createConnectionFactory", name, ha, useDiscovery, cfType, connectors, jndiBindings);
          }
 
-         public void createConnectionFactoryDiscovery(String name,
-                                                      boolean ha,
-                                                      int cfType,
-                                                      String discoveryGroupName,
-                                                      String bindings) throws Exception
-         {
-            proxy.invokeOperation("createConnectionFactory", name, ha, cfType, discoveryGroupName, bindings);
-         }
 
-         public void createConnectionFactoryDiscovery(String name,
-                                                      boolean ha,
-                                                      int cfType,
-                                                      String discoveryGroupName,
-                                                      Object[] bindings) throws Exception
-         {
-            // TODO Auto-generated method stub
-            
-         }
-
       };
    }
    // Public --------------------------------------------------------

Modified: trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java	2010-12-02 09:37:21 UTC (rev 9984)
+++ trunk/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java	2010-12-02 18:08:38 UTC (rev 9985)
@@ -82,10 +82,6 @@
       Assert.assertEquals(factory.getConnectionTTL(), HornetQClient.DEFAULT_CONNECTION_TTL);
       Assert.assertEquals(factory.getConsumerMaxRate(), HornetQClient.DEFAULT_CONSUMER_MAX_RATE);
       Assert.assertEquals(factory.getConsumerWindowSize(), HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE);
-      Assert.assertEquals(factory.getDiscoveryAddress(), null);
-      Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(),
-                          HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
-      Assert.assertEquals(factory.getDiscoveryPort(), -1);
       Assert.assertEquals(factory.getDupsOKBatchSize(), HornetQClient.DEFAULT_ACK_BATCH_SIZE);
       Assert.assertEquals(factory.getMinLargeMessageSize(), HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
       Assert.assertEquals(factory.getProducerMaxRate(), HornetQClient.DEFAULT_PRODUCER_MAX_RATE);
@@ -132,10 +128,6 @@
       Assert.assertEquals(factory.getConnectionTTL(), HornetQClient.DEFAULT_CONNECTION_TTL);
       Assert.assertEquals(factory.getConsumerMaxRate(), HornetQClient.DEFAULT_CONSUMER_MAX_RATE);
       Assert.assertEquals(factory.getConsumerWindowSize(), HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE);
-      Assert.assertEquals(factory.getDiscoveryAddress(), null);
-      Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(),
-                          HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
-      Assert.assertEquals(factory.getDiscoveryPort(), -1);
       Assert.assertEquals(factory.getDupsOKBatchSize(), HornetQClient.DEFAULT_ACK_BATCH_SIZE);
       Assert.assertEquals(factory.getMinLargeMessageSize(), HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
       Assert.assertEquals(factory.getProducerMaxRate(), HornetQClient.DEFAULT_PRODUCER_MAX_RATE);
@@ -196,10 +188,6 @@
       Assert.assertEquals(factory.getConnectionTTL(), 3);
       Assert.assertEquals(factory.getConsumerMaxRate(), 4);
       Assert.assertEquals(factory.getConsumerWindowSize(), 5);
-      Assert.assertEquals(factory.getDiscoveryAddress(), null);
-      Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(), 6);
-      Assert.assertEquals(factory.getDiscoveryPort(), -1);
-      Assert.assertEquals(factory.getDiscoveryRefreshTimeout(), 7);
       Assert.assertEquals(factory.getDupsOKBatchSize(), 8);
       Assert.assertEquals(factory.getMinLargeMessageSize(), 10);
       Assert.assertEquals(factory.getProducerMaxRate(), 11);
@@ -257,10 +245,6 @@
       Assert.assertEquals(factory.getConnectionTTL(), 3);
       Assert.assertEquals(factory.getConsumerMaxRate(), 4);
       Assert.assertEquals(factory.getConsumerWindowSize(), 5);
-      Assert.assertEquals(factory.getDiscoveryAddress(), null);
-      Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(), 6);
-      Assert.assertEquals(factory.getDiscoveryPort(), -1);
-      Assert.assertEquals(factory.getDiscoveryRefreshTimeout(), 7);
       Assert.assertEquals(factory.getDupsOKBatchSize(), 8);
       Assert.assertEquals(factory.getMinLargeMessageSize(), 10);
       Assert.assertEquals(factory.getProducerMaxRate(), 11);



More information about the hornetq-commits mailing list