JBoss hornetq SVN: r10239 - in branches/HORNETQ-316/tests/src/org/hornetq/tests: util and 1 other directory.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-02-22 01:31:16 -0500 (Tue, 22 Feb 2011)
New Revision: 10239
Modified:
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
fixed easy NPE
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-21 22:05:26 UTC (rev 10238)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-22 06:31:16 UTC (rev 10239)
@@ -1642,8 +1642,8 @@
pairs = new ArrayList<TransportConfiguration>();
pairs.add(serverTotc);
}
-
- DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs!=null ? pairs.toArray(new TransportConfiguration[0]) : null);
serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-21 22:05:26 UTC (rev 10238)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-22 06:31:16 UTC (rev 10239)
@@ -265,7 +265,7 @@
protected static DiscoveryGroupConfiguration createStaticDiscoveryGroupConfiguration(TransportConfiguration... connectors)
{
Map<String,Object> params = new HashMap<String,Object>();
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, Arrays.asList(connectors));
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectors != null ? Arrays.asList(connectors) : null);
return new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(),
params,
UUIDGenerator.getInstance().generateStringUUID());
13 years, 11 months
JBoss hornetq SVN: r10238 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-21 17:05:26 -0500 (Mon, 21 Feb 2011)
New Revision: 10238
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
Log:
organize imports
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java 2011-02-21 21:59:42 UTC (rev 10237)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java 2011-02-21 22:05:26 UTC (rev 10238)
@@ -17,7 +17,6 @@
import org.hornetq.api.jms.management.ConnectionFactoryControl;
import org.hornetq.api.jms.management.JMSServerControl;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
13 years, 11 months
JBoss hornetq SVN: r10237 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/management/impl and 8 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-21 16:59:42 -0500 (Mon, 21 Feb 2011)
New Revision: 10237
Added:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/JMSServerManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/JMSManagementService.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java
Log:
HORNETQ-647 - Persisting changes on ConnectinFactoryControl
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -63,6 +63,10 @@
* Sets the Client ID for this connection factory.
*/
void setClientID(String clientID);
+
+ boolean isCompressLargeMessages();
+
+ void setCompressLargeMessages(boolean compress);
/**
* @see ClientSessionFactory#getClientFailureCheckPeriod()
@@ -327,11 +331,6 @@
int getInitialMessagePacketSize();
/**
- * @see ClientSessionFactory#setInitialMessagePacketSize(int)
- */
- void setInitialMessagePacketSize(int size);
-
- /**
* @see ClientSessionFactory#isUseGlobalPools()
*/
boolean isUseGlobalPools();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -24,6 +24,7 @@
import org.hornetq.core.management.impl.MBeanInfoHelper;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -37,7 +38,9 @@
// Attributes ----------------------------------------------------
- private final HornetQConnectionFactory cf;
+ private final ConnectionFactoryConfiguration cfConfig;
+
+ private HornetQConnectionFactory cf;
private final String name;
@@ -47,11 +50,13 @@
// Constructors --------------------------------------------------
- public JMSConnectionFactoryControlImpl(final HornetQConnectionFactory cf,
+ public JMSConnectionFactoryControlImpl(final ConnectionFactoryConfiguration cfConfig,
+ final HornetQConnectionFactory cf,
final JMSServerManager jmsManager,
final String name) throws NotCompliantMBeanException
{
super(ConnectionFactoryControl.class);
+ this.cfConfig = cfConfig;
this.cf = cf;
this.name = name;
this.jmsManager = jmsManager;
@@ -65,170 +70,200 @@
{
return jmsManager.getJNDIOnConnectionFactory(name);
}
+
+ public boolean isCompressLargeMessages()
+ {
+ return cf.isCompressLargeMessage();
+ }
+
+ public void setCompressLargeMessages(final boolean compress)
+ {
+ cfConfig.setCompressLargeMessages(compress);
+ recreateCF();
+ }
public boolean isHA()
{
- return cf.isHA();
+ return cfConfig.isHA();
}
public int getFactoryType()
{
- return cf.getFactoryType();
+ return cfConfig.getFactoryType().intValue();
}
public String getClientID()
{
- return cf.getClientID();
+ return cfConfig.getClientID();
}
public long getClientFailureCheckPeriod()
{
- return cf.getClientFailureCheckPeriod();
+ return cfConfig.getClientFailureCheckPeriod();
}
- public String getConnectionLoadBalancingPolicyClassName()
- {
- return cf.getConnectionLoadBalancingPolicyClassName();
- }
-
public void setClientID(String clientID)
{
- cf.setClientID(clientID);
+ cfConfig.setClientID(clientID);
+ recreateCF();
}
public void setDupsOKBatchSize(int dupsOKBatchSize)
{
- cf.setDupsOKBatchSize(dupsOKBatchSize);
+ cfConfig.setDupsOKBatchSize(dupsOKBatchSize);
+ recreateCF();
}
public void setTransactionBatchSize(int transactionBatchSize)
{
- cf.setTransactionBatchSize(transactionBatchSize);
+ cfConfig.setTransactionBatchSize(transactionBatchSize);
+ recreateCF();
}
public void setClientFailureCheckPeriod(long clientFailureCheckPeriod)
{
- cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ cfConfig.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ recreateCF();
}
public void setConnectionTTL(long connectionTTL)
{
- cf.setConnectionTTL(connectionTTL);
+ cfConfig.setConnectionTTL(connectionTTL);
+ recreateCF();
}
public void setCallTimeout(long callTimeout)
{
- cf.setCallTimeout(callTimeout);
+ cfConfig.setCallTimeout(callTimeout);
+ recreateCF();
}
public void setConsumerWindowSize(int consumerWindowSize)
{
- cf.setConsumerWindowSize(consumerWindowSize);
+ cfConfig.setConsumerWindowSize(consumerWindowSize);
+ recreateCF();
}
public void setConsumerMaxRate(int consumerMaxRate)
{
- cf.setConsumerMaxRate(consumerMaxRate);
+ cfConfig.setConsumerMaxRate(consumerMaxRate);
+ recreateCF();
}
public void setConfirmationWindowSize(int confirmationWindowSize)
{
- cf.setConfirmationWindowSize(confirmationWindowSize);
+ cfConfig.setConfirmationWindowSize(confirmationWindowSize);
+ recreateCF();
}
public void setProducerMaxRate(int producerMaxRate)
{
- cf.setProducerMaxRate(producerMaxRate);
+ cfConfig.setProducerMaxRate(producerMaxRate);
+ recreateCF();
}
public int getProducerWindowSize()
{
- return cf.getProducerWindowSize();
+ return cfConfig.getProducerWindowSize();
}
public void setProducerWindowSize(int producerWindowSize)
{
- cf.setProducerWindowSize(producerWindowSize);
+ cfConfig.setProducerWindowSize(producerWindowSize);
+ recreateCF();
}
public void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
{
- cf.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ cfConfig.setCacheLargeMessagesClient(cacheLargeMessagesClient);
+ recreateCF();
}
public boolean isCacheLargeMessagesClient()
{
- return cf.isCacheLargeMessagesClient();
+ return cfConfig.isCacheLargeMessagesClient();
}
public void setMinLargeMessageSize(int minLargeMessageSize)
{
- cf.setMinLargeMessageSize(minLargeMessageSize);
+ cfConfig.setMinLargeMessageSize(minLargeMessageSize);
+ recreateCF();
}
public void setBlockOnNonDurableSend(boolean blockOnNonDurableSend)
{
- cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ cfConfig.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ recreateCF();
}
public void setBlockOnAcknowledge(boolean blockOnAcknowledge)
{
- cf.setBlockOnAcknowledge(blockOnAcknowledge);
+ cfConfig.setBlockOnAcknowledge(blockOnAcknowledge);
+ recreateCF();
}
public void setBlockOnDurableSend(boolean blockOnDurableSend)
{
- cf.setBlockOnDurableSend(blockOnDurableSend);
+ cfConfig.setBlockOnDurableSend(blockOnDurableSend);
+ recreateCF();
}
public void setAutoGroup(boolean autoGroup)
{
- cf.setAutoGroup(autoGroup);
+ cfConfig.setAutoGroup(autoGroup);
+ recreateCF();
}
public void setPreAcknowledge(boolean preAcknowledge)
{
- cf.setPreAcknowledge(preAcknowledge);
+ cfConfig.setPreAcknowledge(preAcknowledge);
+ recreateCF();
}
public void setMaxRetryInterval(long retryInterval)
{
- cf.setMaxRetryInterval(retryInterval);
+ cfConfig.setMaxRetryInterval(retryInterval);
+ recreateCF();
}
public void setRetryIntervalMultiplier(double retryIntervalMultiplier)
{
- cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ cfConfig.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ recreateCF();
}
public void setReconnectAttempts(int reconnectAttempts)
{
- cf.setReconnectAttempts(reconnectAttempts);
+ cfConfig.setReconnectAttempts(reconnectAttempts);
+ recreateCF();
}
public void setFailoverOnInitialConnection(boolean failover)
{
- cf.setFailoverOnInitialConnection(failover);
+ cfConfig.setFailoverOnInitialConnection(failover);
+ recreateCF();
}
public boolean isUseGlobalPools()
{
- return cf.isUseGlobalPools();
+ return cfConfig.isUseGlobalPools();
}
public void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
{
- cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ cfConfig.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ recreateCF();
}
public int getThreadPoolMaxSize()
{
- return cf.getThreadPoolMaxSize();
+ return cfConfig.getThreadPoolMaxSize();
}
public void setThreadPoolMaxSize(int threadPoolMaxSize)
{
- cf.setThreadPoolMaxSize(threadPoolMaxSize);
+ cfConfig.setThreadPoolMaxSize(threadPoolMaxSize);
+ recreateCF();
}
public int getInitialMessagePacketSize()
@@ -238,43 +273,47 @@
public void setGroupID(String groupID)
{
- cf.setGroupID(groupID);
+ cfConfig.setGroupID(groupID);
+ recreateCF();
}
public String getGroupID()
{
- return cf.getGroupID();
+ return cfConfig.getGroupID();
}
- public void setInitialMessagePacketSize(int size)
- {
- cf.setInitialMessagePacketSize(size);
- }
-
public void setUseGlobalPools(boolean useGlobalPools)
{
- cf.setUseGlobalPools(useGlobalPools);
+ cfConfig.setUseGlobalPools(useGlobalPools);
+ recreateCF();
}
public int getScheduledThreadPoolMaxSize()
{
- return cf.getScheduledThreadPoolMaxSize();
+ return cfConfig.getScheduledThreadPoolMaxSize();
}
public void setRetryInterval(long retryInterval)
{
- cf.setRetryInterval(retryInterval);
+ cfConfig.setRetryInterval(retryInterval);
+ recreateCF();
}
public long getMaxRetryInterval()
{
- return cf.getMaxRetryInterval();
+ return cfConfig.getMaxRetryInterval();
}
- public void setConnectionLoadBalancingPolicyClassName(String connectionLoadBalancingPolicyClassName)
+ public String getConnectionLoadBalancingPolicyClassName()
{
- cf.setConnectionLoadBalancingPolicyClassName(connectionLoadBalancingPolicyClassName);
+ return cfConfig.getLoadBalancingPolicyClassName();
}
+
+ public void setConnectionLoadBalancingPolicyClassName(String name)
+ {
+ cfConfig.setLoadBalancingPolicyClassName(name);
+ recreateCF();
+ }
public TransportConfiguration[] getStaticConnectors()
{
@@ -293,52 +332,52 @@
public long getCallTimeout()
{
- return cf.getCallTimeout();
+ return cfConfig.getCallTimeout();
}
public int getConsumerMaxRate()
{
- return cf.getConsumerMaxRate();
+ return cfConfig.getConsumerMaxRate();
}
public int getConsumerWindowSize()
{
- return cf.getConsumerWindowSize();
+ return cfConfig.getConsumerWindowSize();
}
public int getProducerMaxRate()
{
- return cf.getProducerMaxRate();
+ return cfConfig.getProducerMaxRate();
}
public int getConfirmationWindowSize()
{
- return cf.getConfirmationWindowSize();
+ return cfConfig.getConfirmationWindowSize();
}
public int getDupsOKBatchSize()
{
- return cf.getDupsOKBatchSize();
+ return cfConfig.getDupsOKBatchSize();
}
public boolean isBlockOnAcknowledge()
{
- return cf.isBlockOnAcknowledge();
+ return cfConfig.isBlockOnAcknowledge();
}
public boolean isBlockOnNonDurableSend()
{
- return cf.isBlockOnNonDurableSend();
+ return cfConfig.isBlockOnNonDurableSend();
}
public boolean isBlockOnDurableSend()
{
- return cf.isBlockOnDurableSend();
+ return cfConfig.isBlockOnDurableSend();
}
public boolean isPreAcknowledge()
{
- return cf.isPreAcknowledge();
+ return cfConfig.isPreAcknowledge();
}
public String getName()
@@ -348,42 +387,42 @@
public long getConnectionTTL()
{
- return cf.getConnectionTTL();
+ return cfConfig.getConnectionTTL();
}
public int getReconnectAttempts()
{
- return cf.getReconnectAttempts();
+ return cfConfig.getReconnectAttempts();
}
public boolean isFailoverOnInitialConnection()
{
- return cf.isFailoverOnInitialConnection();
+ return cfConfig.isFailoverOnInitialConnection();
}
public int getMinLargeMessageSize()
{
- return cf.getMinLargeMessageSize();
+ return cfConfig.getMinLargeMessageSize();
}
public long getRetryInterval()
{
- return cf.getRetryInterval();
+ return cfConfig.getRetryInterval();
}
public double getRetryIntervalMultiplier()
{
- return cf.getRetryIntervalMultiplier();
+ return cfConfig.getRetryIntervalMultiplier();
}
public int getTransactionBatchSize()
{
- return cf.getTransactionBatchSize();
+ return cfConfig.getTransactionBatchSize();
}
public boolean isAutoGroup()
{
- return cf.isAutoGroup();
+ return cfConfig.isAutoGroup();
}
@Override
@@ -402,6 +441,18 @@
// Protected -----------------------------------------------------
+ private void recreateCF()
+ {
+ try
+ {
+ this.cf = jmsManager.recreateCF(this.name, this.cfConfig);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException (e.getMessage(), e);
+ }
+ }
+
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/JMSServerManager.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/JMSServerManager.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -24,6 +24,7 @@
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.spi.core.naming.BindingRegistry;
@@ -158,6 +159,10 @@
* if a problem occurred destroying the topic
*/
boolean destroyTopic(String name) throws Exception;
+
+ /** Call this method to have a CF rebound to JNDI and stored on the Journal
+ * @throws Exception */
+ HornetQConnectionFactory recreateCF(String name, ConnectionFactoryConfiguration cf) throws Exception;
void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String discoveryGroupName, String ... jndiBindings) throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -15,7 +15,6 @@
import java.util.List;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.journal.EncodingSupport;
@@ -28,6 +27,9 @@
*/
public interface ConnectionFactoryConfiguration extends EncodingSupport
{
+
+ boolean isPersisted();
+
String getName();
String[] getBindings();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -42,6 +42,8 @@
// Attributes ----------------------------------------------------
private String name;
+
+ private boolean persisted;
private String[] bindings;
@@ -155,6 +157,11 @@
{
return name;
}
+
+ public boolean isPersisted()
+ {
+ return persisted;
+ }
/**
* @return the discoveryGroupName
@@ -499,6 +506,8 @@
*/
public void decode(final HornetQBuffer buffer)
{
+ persisted = true;
+
name = buffer.readSimpleString().toString();
discoveryGroupName = BufferHelper.readNullableSimpleStringAsString(buffer);
@@ -587,6 +596,8 @@
*/
public void encode(final HornetQBuffer buffer)
{
+ persisted = true;
+
BufferHelper.writeAsSimpleString(buffer, name);
BufferHelper.writeAsNullableSimpleString(buffer, discoveryGroupName);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -13,8 +13,16 @@
package org.hornetq.jms.server.impl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -214,13 +222,13 @@
{
deploy();
}
-
- for (Runnable run: cachedCommands)
+
+ for (Runnable run : cachedCommands)
{
log.info("Running cached command for " + run);
run.run();
}
-
+
cachedCommands.clear();
}
@@ -401,7 +409,7 @@
{
return "createQueue for " + queueName;
}
-
+
public void runException() throws Exception
{
if (internalCreateQueue(queueName, selectorString, durable))
@@ -429,7 +437,10 @@
if (storeConfig && durable)
{
- storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
+ storage.storeDestination(new PersistedDestination(PersistedType.Queue,
+ queueName,
+ selectorString,
+ durable));
storage.addJNDI(PersistedType.Queue, queueName, usedJNDI);
}
}
@@ -452,7 +463,7 @@
{
return "createTopic for " + topicName;
}
-
+
public void runException() throws Exception
{
if (internalCreateTopic(topicName))
@@ -914,23 +925,49 @@
}
}
+ public synchronized HornetQConnectionFactory recreateCF(String name, ConnectionFactoryConfiguration cf) throws Exception
+ {
+ List<String> jndi = connectionFactoryJNDI.get(name);
+
+ if (jndi == null)
+ {
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "Connection Factory " + name + " doesn't exist");
+ }
+
+ String[] usedJNDI = jndi.toArray(new String[jndi.size()]);
+
+ HornetQConnectionFactory realCF = internalCreateCFPOJO(cf);
+
+ if (cf.isPersisted())
+ {
+ storage.storeConnectionFactory(new PersistedConnectionFactory(cf));
+ storage.addJNDI(PersistedType.ConnectionFactory, cf.getName(), usedJNDI);
+ }
+
+ for (String jndiElement : usedJNDI)
+ {
+ this.bindToJndi(jndiElement, realCF);
+ }
+
+ return realCF;
+ }
+
public synchronized void createConnectionFactory(final boolean storeConfig,
final ConnectionFactoryConfiguration cfConfig,
final String... jndi) throws Exception
{
runAfterActive(new RunnableException()
{
-
+
public String toString()
{
return "createConnectionFactory for " + cfConfig.getName();
}
-
public void runException() throws Exception
{
- HornetQConnectionFactory cf = internalCreateCF(cfConfig);
+ HornetQConnectionFactory cf = internalCreateCF(storeConfig, cfConfig);
ArrayList<String> bindings = new ArrayList<String>();
@@ -1053,7 +1090,8 @@
* @throws HornetQException
* @throws Exception
*/
- private HornetQConnectionFactory internalCreateCF(final ConnectionFactoryConfiguration cfConfig) throws HornetQException,
+ private HornetQConnectionFactory internalCreateCF(final boolean persisted,
+ final ConnectionFactoryConfiguration cfConfig) throws HornetQException,
Exception
{
checkInitialised();
@@ -1062,95 +1100,107 @@
if (cf == null)
{
- if (cfConfig.getDiscoveryGroupName() != null)
- {
- DiscoveryGroupConfiguration groupConfig = server.getConfiguration()
- .getDiscoveryGroupConfigurations()
- .get(cfConfig.getDiscoveryGroupName());
+ cf = internalCreateCFPOJO(cfConfig);
+ }
- if (groupConfig == null)
- {
- throw new HornetQException(HornetQException.ILLEGAL_STATE,
- "Discovery Group '" + cfConfig.getDiscoveryGroupName() +
- "' doesn't exist on maing config");
- }
+ connectionFactories.put(cfConfig.getName(), cf);
- if (cfConfig.isHA())
- {
- cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
- }
- else
- {
- cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
- }
+ jmsManagementService.registerConnectionFactory(cfConfig.getName(), cfConfig, cf);
+
+ return cf;
+ }
+
+ /**
+ * @param cfConfig
+ * @return
+ * @throws HornetQException
+ */
+ protected HornetQConnectionFactory internalCreateCFPOJO(final ConnectionFactoryConfiguration cfConfig) throws HornetQException
+ {
+ HornetQConnectionFactory cf;
+ if (cfConfig.getDiscoveryGroupName() != null)
+ {
+ DiscoveryGroupConfiguration groupConfig = server.getConfiguration()
+ .getDiscoveryGroupConfigurations()
+ .get(cfConfig.getDiscoveryGroupName());
+
+ if (groupConfig == null)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "Discovery Group '" + cfConfig.getDiscoveryGroupName() +
+ "' doesn't exist on maing config");
}
+
+ if (cfConfig.isHA())
+ {
+ cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
+ }
else
{
- if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0)
- {
- throw new HornetQException(HornetQException.ILLEGAL_STATE,
- "Null Connector name passed to create ConnectionFactory");
- }
+ cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
+ }
+ }
+ else
+ {
+ if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
+ "Null Connector name passed to create ConnectionFactory");
+ }
- TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];
+ TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];
- int count = 0;
- for (String name : cfConfig.getConnectorNames())
+ int count = 0;
+ for (String name : cfConfig.getConnectorNames())
+ {
+ TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
+ if (connector == null)
{
- TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
- if (connector == null)
- {
- throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connector '" + name +
- "' not found on the main configuration file");
- }
- configs[count++] = connector;
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connector '" + name +
+ "' not found on the main configuration file");
}
+ configs[count++] = connector;
+ }
- if (cfConfig.isHA())
- {
- cf = HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
- }
- else
- {
- cf = HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
- }
+ if (cfConfig.isHA())
+ {
+ cf = HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
}
-
- cf.setClientID(cfConfig.getClientID());
- cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
- cf.setConnectionTTL(cfConfig.getConnectionTTL());
- cf.setCallTimeout(cfConfig.getCallTimeout());
- cf.setCacheLargeMessagesClient(cfConfig.isCacheLargeMessagesClient());
- cf.setMinLargeMessageSize(cfConfig.getMinLargeMessageSize());
- cf.setConsumerWindowSize(cfConfig.getConsumerWindowSize());
- cf.setConsumerMaxRate(cfConfig.getConsumerMaxRate());
- cf.setConfirmationWindowSize(cfConfig.getConfirmationWindowSize());
- cf.setProducerWindowSize(cfConfig.getProducerWindowSize());
- cf.setProducerMaxRate(cfConfig.getProducerMaxRate());
- cf.setBlockOnAcknowledge(cfConfig.isBlockOnAcknowledge());
- cf.setBlockOnDurableSend(cfConfig.isBlockOnDurableSend());
- cf.setBlockOnNonDurableSend(cfConfig.isBlockOnNonDurableSend());
- cf.setAutoGroup(cfConfig.isAutoGroup());
- cf.setPreAcknowledge(cfConfig.isPreAcknowledge());
- cf.setConnectionLoadBalancingPolicyClassName(cfConfig.getLoadBalancingPolicyClassName());
- cf.setTransactionBatchSize(cfConfig.getTransactionBatchSize());
- cf.setDupsOKBatchSize(cfConfig.getDupsOKBatchSize());
- cf.setUseGlobalPools(cfConfig.isUseGlobalPools());
- cf.setScheduledThreadPoolMaxSize(cfConfig.getScheduledThreadPoolMaxSize());
- cf.setThreadPoolMaxSize(cfConfig.getThreadPoolMaxSize());
- cf.setRetryInterval(cfConfig.getRetryInterval());
- cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier());
- cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval());
- cf.setReconnectAttempts(cfConfig.getReconnectAttempts());
- cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection());
- cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
- cf.setGroupID(cfConfig.getGroupID());
+ else
+ {
+ cf = HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
+ }
}
- connectionFactories.put(cfConfig.getName(), cf);
-
- jmsManagementService.registerConnectionFactory(cfConfig.getName(), cf);
-
+ cf.setClientID(cfConfig.getClientID());
+ cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
+ cf.setConnectionTTL(cfConfig.getConnectionTTL());
+ cf.setCallTimeout(cfConfig.getCallTimeout());
+ cf.setCacheLargeMessagesClient(cfConfig.isCacheLargeMessagesClient());
+ cf.setMinLargeMessageSize(cfConfig.getMinLargeMessageSize());
+ cf.setConsumerWindowSize(cfConfig.getConsumerWindowSize());
+ cf.setConsumerMaxRate(cfConfig.getConsumerMaxRate());
+ cf.setConfirmationWindowSize(cfConfig.getConfirmationWindowSize());
+ cf.setProducerWindowSize(cfConfig.getProducerWindowSize());
+ cf.setProducerMaxRate(cfConfig.getProducerMaxRate());
+ cf.setBlockOnAcknowledge(cfConfig.isBlockOnAcknowledge());
+ cf.setBlockOnDurableSend(cfConfig.isBlockOnDurableSend());
+ cf.setBlockOnNonDurableSend(cfConfig.isBlockOnNonDurableSend());
+ cf.setAutoGroup(cfConfig.isAutoGroup());
+ cf.setPreAcknowledge(cfConfig.isPreAcknowledge());
+ cf.setConnectionLoadBalancingPolicyClassName(cfConfig.getLoadBalancingPolicyClassName());
+ cf.setTransactionBatchSize(cfConfig.getTransactionBatchSize());
+ cf.setDupsOKBatchSize(cfConfig.getDupsOKBatchSize());
+ cf.setUseGlobalPools(cfConfig.isUseGlobalPools());
+ cf.setScheduledThreadPoolMaxSize(cfConfig.getScheduledThreadPoolMaxSize());
+ cf.setThreadPoolMaxSize(cfConfig.getThreadPoolMaxSize());
+ cf.setRetryInterval(cfConfig.getRetryInterval());
+ cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier());
+ cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval());
+ cf.setReconnectAttempts(cfConfig.getReconnectAttempts());
+ cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection());
+ cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
+ cf.setGroupID(cfConfig.getGroupID());
return cf;
}
@@ -1360,6 +1410,7 @@
{
if (registry != null)
{
+ registry.unbind(jndiName);
registry.bind(jndiName, objectToBind);
}
return true;
@@ -1437,7 +1488,7 @@
for (PersistedConnectionFactory cf : cfs)
{
- internalCreateCF(cf.getConfig());
+ internalCreateCF(true, cf.getConfig());
}
List<PersistedDestination> destinations = storage.recoverDestinations();
@@ -1576,7 +1627,7 @@
return false;
}
}
-
+
private boolean runAfterActive(RunnableException runnable) throws Exception
{
if (active)
@@ -1592,8 +1643,6 @@
}
}
-
-
private abstract class RunnableException implements Runnable
{
public void run()
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/JMSManagementService.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -18,6 +18,7 @@
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQTopic;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -39,7 +40,7 @@
void unregisterTopic(String name) throws Exception;
- void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory) throws Exception;
+ void registerConnectionFactory(String name, ConnectionFactoryConfiguration config, HornetQConnectionFactory connectionFactory) throws Exception;
void unregisterConnectionFactory(String name) throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -34,6 +34,7 @@
import org.hornetq.jms.management.impl.JMSServerControlImpl;
import org.hornetq.jms.management.impl.JMSTopicControlImpl;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.management.JMSManagementService;
/*
@@ -121,10 +122,11 @@
}
public synchronized void registerConnectionFactory(final String name,
+ final ConnectionFactoryConfiguration cfConfig,
final HornetQConnectionFactory connectionFactory) throws Exception
{
ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
- JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, jmsServerManager, name);
+ JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(cfConfig, connectionFactory, jmsServerManager, name);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name, control);
}
Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.jms.server.management;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.jms.management.ConnectionFactoryControl;
+import org.hornetq.api.jms.management.JMSServerControl;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.jms.client.HornetQConnectionFactory;
+import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.tests.integration.management.ManagementControlHelper;
+import org.hornetq.tests.integration.management.ManagementTestBase;
+import org.hornetq.tests.unit.util.InVMContext;
+
+/**
+ * A Connection Factory Control Test
+ *
+ * @author <a href="csuconic(a)redhat.com">Clebert Suconic</a>
+ *
+ * Created 13 nov. 2008 16:50:53
+ *
+ *
+ */
+public class ConnectionFactoryControlTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private HornetQServer server;
+
+ private JMSServerManagerImpl serverManager;
+
+ private InVMContext ctx;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testCreateCF() throws Exception
+ {
+ JMSServerControl control = createJMSControl();
+ control.createConnectionFactory("test", false, false, 0, "invm", "test");
+
+ ConnectionFactoryControl controlCF = createCFControl("test");
+
+ HornetQConnectionFactory cf = (HornetQConnectionFactory)ctx.lookup("test");
+
+ assertFalse(cf.isCompressLargeMessage());
+
+ controlCF.setCompressLargeMessages(true);
+
+ cf = (HornetQConnectionFactory)ctx.lookup("test");
+ assertTrue(cf.isCompressLargeMessage());
+
+ stopServer();
+
+ Thread.sleep(500);
+
+ startServer();
+
+ cf = (HornetQConnectionFactory)ctx.lookup("test");
+ assertTrue(cf.isCompressLargeMessage());
+
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ startServer();
+
+ }
+
+ /**
+ * @throws Exception
+ */
+ protected void startServer() throws Exception
+ {
+ Configuration conf = createDefaultConfig(false);
+ conf.setClustered(false);
+ conf.getConnectorConfigurations().put("invm", new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setSharedStore(false);
+ conf.getAcceptorConfigurations()
+ .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+ server = HornetQServers.newHornetQServer(conf, mbeanServer, true);
+ server.start();
+
+ serverManager = new JMSServerManagerImpl(server);
+ serverManager.start();
+
+ ctx = new InVMContext();
+
+ serverManager.setContext(ctx);
+ serverManager.activated();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ stopServer();
+
+ super.tearDown();
+ }
+
+ /**
+ * @throws Exception
+ */
+ protected void stopServer() throws Exception
+ {
+ serverManager.stop();
+
+ server.stop();
+
+ serverManager = null;
+
+ server = null;
+ }
+
+ protected ConnectionFactoryControl createCFControl(String name) throws Exception
+ {
+ return ManagementControlHelper.createConnectionFactoryControl(name, mbeanServer);
+ }
+
+ protected JMSServerControl createJMSControl() throws Exception
+ {
+ return ManagementControlHelper.createJMSServerControl(mbeanServer);
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java 2011-02-21 17:33:22 UTC (rev 10236)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java 2011-02-21 21:59:42 UTC (rev 10237)
@@ -15,14 +15,12 @@
import junit.framework.Assert;
-import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.DivertControl;
import org.hornetq.api.core.management.ObjectNameBuilder;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.DivertConfiguration;
import org.hornetq.core.config.CoreQueueConfiguration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.config.DivertConfiguration;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
13 years, 11 months
JBoss hornetq SVN: r10236 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-21 12:33:22 -0500 (Mon, 21 Feb 2011)
New Revision: 10236
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
Log:
oops
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-21 17:29:52 UTC (rev 10235)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-21 17:33:22 UTC (rev 10236)
@@ -93,7 +93,7 @@
T cacheResult = cache.get(match);
if (cacheResult != null)
{
- return cache.get(match);
+ return cacheResult;
}
T actualMatch;
HashMap<String, Match<T>> possibleMatches = getPossibleMatches(match);
13 years, 11 months
JBoss hornetq SVN: r10235 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-21 12:29:52 -0500 (Mon, 21 Feb 2011)
New Revision: 10235
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
Log:
Making getMatch more atomic
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-21 16:51:47 UTC (rev 10234)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-21 17:29:52 UTC (rev 10235)
@@ -90,7 +90,8 @@
*/
public T getMatch(final String match)
{
- if (cache.get(match) != null)
+ T cacheResult = cache.get(match);
+ if (cacheResult != null)
{
return cache.get(match);
}
13 years, 11 months
JBoss hornetq SVN: r10234 - branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-02-21 11:51:47 -0500 (Mon, 21 Feb 2011)
New Revision: 10234
Modified:
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
Log:
BroadcastGroupImpl was broken when localBindAddress was null in config
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-21 16:51:47 UTC (rev 10234)
@@ -107,8 +107,13 @@
Map<String,Object> params = this.broadcastGroupConfiguration.getParams();
int localPort = Integer.parseInt((String)params.get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
String localAddr = (String)params.get(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME);
- InetAddress localAddress = InetAddress.getByName(localAddr);
+ InetAddress localAddress = null;
+ if(localAddr!=null)
+ {
+ localAddress = InetAddress.getByName(localAddr);
+ }
+
if (localPort != -1)
{
socket = new DatagramSocket(localPort, localAddress);
13 years, 11 months
JBoss hornetq SVN: r10233 - in branches/HORNETQ-316: src/main/org/hornetq/api/core and 16 other directories.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-02-20 09:34:41 -0500 (Sun, 20 Feb 2011)
New Revision: 10233
Modified:
branches/HORNETQ-316/src/config/common/schema/hornetq-configuration.xsd
branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java
branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java
branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java
branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java
branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/HORNETQ-316/tests/config/ConfigurationTest-full-config.xml
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
fixed some bugs to pass the unit tests
Modified: branches/HORNETQ-316/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- branches/HORNETQ-316/src/config/common/schema/hornetq-configuration.xsd 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/config/common/schema/hornetq-configuration.xsd 2011-02-20 14:34:41 UTC (rev 10233)
@@ -216,18 +216,12 @@
<xsd:element name="broadcast-group">
<xsd:complexType>
<xsd:sequence>
- <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-address">
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-port">
+ <xsd:element maxOccurs="1" minOccurs="1" name="broadcast-group-class" type="xsd:string">
</xsd:element>
- <xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0" ref="broadcast-period">
- </xsd:element>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="connector-ref" type="xsd:string">
</xsd:element>
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
+ </xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:ID" use="required"/>
</xsd:complexType>
@@ -240,16 +234,10 @@
<xsd:element name="discovery-group">
<xsd:complexType>
<xsd:sequence>
- <xsd:element maxOccurs="1" minOccurs="0" ref="local-bind-address">
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="1" ref="group-address">
+ <xsd:element maxOccurs="1" minOccurs="1" name="server-locator-class" type="xsd:string">
</xsd:element>
- <xsd:element maxOccurs="1" minOccurs="1" ref="group-port">
+ <xsd:element maxOccurs="unbounded" minOccurs="0" name="param" type="paramType">
</xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0" ref="refresh-timeout">
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0" ref="initial-wait-timeout">
- </xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:ID" use="required"/>
</xsd:complexType>
@@ -327,21 +315,12 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="password" type="xsd:string">
</xsd:element>
- <xsd:choice>
- <xsd:element maxOccurs="1" minOccurs="1" name="static-connectors">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element maxOccurs="unbounded" minOccurs="1" name="connector-ref" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
- <xsd:complexType>
- <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
+ <xsd:element maxOccurs="1" minOccurs="1" name="discovery-group-ref">
+ <xsd:complexType>
+ <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
@@ -362,22 +341,12 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="confirmation-window-size" type="xsd:int">
</xsd:element>
- <xsd:choice>
- <xsd:element maxOccurs="1" minOccurs="0" name="static-connectors">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element maxOccurs="unbounded" minOccurs="0" name="connector-ref" type="xsd:string"/>
- </xsd:sequence>
- <xsd:attribute name="allow-direct-connections-only" type="xsd:boolean" use="optional"/>
- </xsd:complexType>
- </xsd:element>
- <xsd:element maxOccurs="1" minOccurs="0" name="discovery-group-ref">
- <xsd:complexType>
- <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
+ <xsd:element maxOccurs="1" minOccurs="0" name="discovery-group-ref">
+ <xsd:complexType>
+ <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/DiscoveryGroupConstants.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -22,7 +22,7 @@
public class DiscoveryGroupConstants
{
// for static discovery
- public static final String STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME = "static-connector-ref-list";
+ public static final String STATIC_CONNECTORS_CONNECTOR_NAMES_NAME = "static-connector-names";
public static final String STATIC_CONNECTORS_LIST_NAME = "static-connector-list";
// for simple UDP discovery
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/client/HornetQClient.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -18,8 +18,11 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy;
import org.hornetq.core.client.impl.StaticServerLocatorImpl;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.utils.UUIDGenerator;
import java.lang.reflect.Constructor;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -34,6 +37,8 @@
*/
public class HornetQClient
{
+ private static final Logger log = Logger.getLogger(HornetQClient.class);
+
public static final String DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME = RoundRobinConnectionLoadBalancingPolicy.class.getCanonicalName();
public static final long DEFAULT_CLIENT_FAILURE_CHECK_PERIOD = 30000;
@@ -110,8 +115,8 @@
public static ServerLocator createServerLocatorWithoutHA(TransportConfiguration... transportConfigurations)
{
Map<String,Object> params = new HashMap<String,Object>();
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, transportConfigurations);
- DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, null);
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, Arrays.asList(transportConfigurations));
+ DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, UUIDGenerator.getInstance().generateStringUUID());
return createServerLocatorWithoutHA(config);
}
@@ -129,14 +134,16 @@
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class<?> clazz = loader.loadClass(className);
- Constructor<?> constructor = clazz.getConstructor(Boolean.class, DiscoveryGroupConfiguration.class);
+ Constructor<?> constructor = clazz.getConstructor(boolean.class, DiscoveryGroupConfiguration.class);
serverLocator = (ServerLocator)constructor.newInstance(Boolean.FALSE, groupConfiguration);
}
catch(Exception e)
{
- new HornetQException(HornetQException.INTERNAL_ERROR, "Could not instantiate ServerLocator implementation class: " + className, e);
+ log.fatal("Could not instantiate ServerLocator implementation class: ", e);
+ return null;
}
- return serverLocator;
+
+ return serverLocator;
}
/**
@@ -151,8 +158,8 @@
public static ServerLocator createServerLocatorWithHA(TransportConfiguration... initialServers)
{
Map<String,Object> params = new HashMap<String,Object>();
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, initialServers);
- DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, null);
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, Arrays.asList(initialServers));
+ DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, UUIDGenerator.getInstance().generateStringUUID());
return createServerLocatorWithHA(config);
}
@@ -170,17 +177,19 @@
{
ServerLocator serverLocator = null;
String className = groupConfiguration.getServerLocatorClassName();
- try
- {
+
+ try{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class<?> clazz = loader.loadClass(className);
- Constructor<?> constructor = clazz.getConstructor(Boolean.class, DiscoveryGroupConfiguration.class);
+ Constructor<?> constructor = clazz.getConstructor(boolean.class, DiscoveryGroupConfiguration.class);
serverLocator = (ServerLocator)constructor.newInstance(Boolean.TRUE, groupConfiguration);
}
catch(Exception e)
{
- new HornetQException(HornetQException.INTERNAL_ERROR, "Could not instantiate ServerLocator implementation class: " + className, e);
+ log.fatal("Could not instantiate ServerLocator implementation class", e);
+ return null;
}
+
return serverLocator;
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -55,10 +55,6 @@
instantiateLoadBalancingPolicy();
- Map<String,Object> params = getDiscoveryGroupConfiguration().getParams();
- TransportConfiguration[] initialConnectors = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
- setInitialConnectors(initialConnectors);
-
setReadOnly(true);
}
}
@@ -68,6 +64,10 @@
{
super(useHA, discoveryGroupConfiguration);
+ Map<String,Object> params = discoveryGroupConfiguration.getParams();
+ List<TransportConfiguration> initialConnectors = (List<TransportConfiguration>)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ setInitialConnectors(initialConnectors.toArray(new TransportConfiguration[0]));
+
e.fillInStackTrace();
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -14,9 +14,11 @@
package org.hornetq.core.config;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.logging.Logger;
/**
@@ -33,21 +35,24 @@
private static final Logger log = Logger.getLogger(BroadcastGroupConfiguration.class);
- private String broadcastGroupClassName;
+ private final String broadcastGroupClassName;
- private Map<String,Object> params;
+ private final Map<String,Object> params;
- private String name;
+ private final String name;
+ private final List<TransportConfiguration> connectorList;
+
public BroadcastGroupConfiguration(final String clazz,
final Map<String,Object> params,
- final String name)
+ final String name,
+ final List<TransportConfiguration> connectorList)
{
super();
this.broadcastGroupClassName = clazz;
this.params = params;
this.name = name;
-
+ this.connectorList = connectorList;
}
public String getBroadcastGroupClassName()
@@ -65,11 +70,9 @@
return name;
}
- /**
- * @param name the name to set
- */
- public void setName(final String name)
+ public List<TransportConfiguration> getConnectorList()
{
- this.name = name;
+ return connectorList;
}
+
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/config/BroadcastGroupConstants.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -28,7 +28,4 @@
public static final String GROUP_ADDRESS_NAME = "group-address";
public static final String GROUP_PORT_NAME = "group-port";
public static final String BROADCAST_PERIOD_NAME = "broadcast-period";
- public static final String CONNECTOR_REF_LIST_NAME = "connector-ref-list";
- public static final String CONNECTOR_LIST_NAME = "connector-list";
-
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -896,6 +896,25 @@
String clazz = XMLConfigurationUtil.getString(e, "broadcast-group-class", null, Validators.NOT_NULL_OR_EMPTY);
+ NodeList children = e.getChildNodes();
+
+ List<TransportConfiguration> connectorList = new ArrayList<TransportConfiguration>();
+
+ for (int j = 0; j < children.getLength(); j++)
+ {
+ Node child = children.item(j);
+
+ if (child.getNodeName().equals("connector-ref"))
+ {
+ String connectorName = XMLConfigurationUtil.getString(e,
+ "connector-ref",
+ null,
+ Validators.NOT_NULL_OR_EMPTY);
+
+ connectorList.add(mainConfig.getConnectorConfigurations().get(connectorName));
+ }
+ }
+
Map<String, Object> params = new HashMap<String, Object>();
NodeList paramsNodes = e.getElementsByTagName("param");
@@ -915,19 +934,7 @@
params.put(key, nValue.getTextContent());
}
- String connectorList = (String)params.get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME);
- if(connectorList != null)
- {
- List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
- StringTokenizer token = new StringTokenizer(connectorList, ",", false);
- while(token.hasMoreElements())
- {
- connectors.add(mainConfig.getConnectorConfigurations().get(token.nextElement()));
- }
- params.put(BroadcastGroupConstants.CONNECTOR_LIST_NAME, connectors.toArray(new TransportConfiguration[0]));
- }
-
- BroadcastGroupConfiguration config = new BroadcastGroupConfiguration(clazz, params, name);
+ BroadcastGroupConfiguration config = new BroadcastGroupConfiguration(clazz, params, name, connectorList);
mainConfig.getBroadcastGroupConfigurations().add(config);
}
@@ -957,7 +964,7 @@
params.put(key, nValue.getTextContent());
}
- String connectorList = (String)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME);
+ String connectorList = (String)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_NAMES_NAME);
if(connectorList != null)
{
List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
@@ -966,7 +973,7 @@
{
connectors.add(mainConfig.getConnectorConfigurations().get(token.nextElement()));
}
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectors.toArray(new TransportConfiguration[0]));
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectors);
}
DiscoveryGroupConfiguration config = new DiscoveryGroupConfiguration(clazz, params, name);
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BridgeControlImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -13,6 +13,7 @@
package org.hornetq.core.management.impl;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanOperationInfo;
@@ -63,16 +64,16 @@
try
{
Map<String,Object> params = configuration.getDiscoveryGroupConfiguration().getParams();
- TransportConfiguration[] staticConnectors = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ List<TransportConfiguration> staticConnectors = (List<TransportConfiguration>)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
if(staticConnectors == null)
{
return null;
}
- String[] staticConnectorNames = new String[staticConnectors.length];
- for(int i=0; i<staticConnectors.length; i++)
+ String[] staticConnectorNames = new String[staticConnectors.size()];
+ for(int i=0; i<staticConnectors.size(); i++)
{
- staticConnectorNames[i] = staticConnectors[i].getName();
+ staticConnectorNames[i] = staticConnectors.get(i).getName();
}
return staticConnectorNames;
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -13,6 +13,7 @@
package org.hornetq.core.management.impl;
+import java.util.List;
import java.util.Map;
import javax.management.MBeanOperationInfo;
@@ -98,10 +99,9 @@
clearIO();
try
{
- Map<String,Object> params = configuration.getParams();
- TransportConfiguration[] connectors = (TransportConfiguration[])params.get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
+ List<TransportConfiguration> connectors = configuration.getConnectorList();
- Object[] ret = new Object[connectors.length];
+ Object[] ret = new Object[connectors.size()];
int i = 0;
for (TransportConfiguration conn : connectors)
@@ -124,8 +124,7 @@
{
JSONArray array = new JSONArray();
- Map<String,Object> params = configuration.getParams();
- TransportConfiguration[] connectors = (TransportConfiguration[])params.get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
+ List<TransportConfiguration> connectors = configuration.getConnectorList();
for (TransportConfiguration conn : connectors)
{
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -146,16 +146,16 @@
try
{
Map<String,Object> params = configuration.getDiscoveryGroupConfiguration().getParams();
- TransportConfiguration[] staticConnectors = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ List<TransportConfiguration> staticConnectors = (List<TransportConfiguration>)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
if(staticConnectors == null)
{
return null;
}
- String[] staticConnectorNames = new String[staticConnectors.length];
- for(int i=0; i<staticConnectors.length; i++)
+ String[] staticConnectorNames = new String[staticConnectors.size()];
+ for(int i=0; i<staticConnectors.size(); i++)
{
- staticConnectorNames[i] = staticConnectors[i].getName();
+ staticConnectorNames[i] = staticConnectors.get(i).getName();
}
return staticConnectorNames;
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -1916,8 +1916,8 @@
}
Map<String,Object> params = new HashMap<String,Object>();
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME, connectors);
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectorConfigs.toArray(new TransportConfiguration[0]));
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_NAMES_NAME, connectors);
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectorConfigs);
DiscoveryGroupConfiguration groupConf = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, name);
configuration.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -57,7 +57,7 @@
private DatagramSocket socket;
- private final List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ private final List<TransportConfiguration> connectors;
private boolean started;
@@ -88,6 +88,8 @@
this.broadcastGroupConfiguration = config;
uniqueID = UUIDGenerator.getInstance().generateStringUUID();
+
+ this.connectors = config.getConnectorList();
}
public void setNotificationService(final NotificationService notificationService)
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -310,9 +310,8 @@
if(this.allowableConnectionsOnly)
{
Map<String,Object> params = discoveryGroupConfiguration.getParams();
- TransportConfiguration[] sc = (TransportConfiguration[])params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
- List<TransportConfiguration> staticConnectors = java.util.Arrays.asList(sc);
- this.allowableConnections.addAll(staticConnectors);
+ List<TransportConfiguration> sc = (List<TransportConfiguration>)params.get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ this.allowableConnections.addAll(sc);
}
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -504,7 +504,7 @@
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class<?> clazz = loader.loadClass(className);
- Constructor<?> constructor = clazz.getConstructor(String.class, String.class, Boolean.class, DiscoveryGroupConfiguration.class);
+ Constructor<?> constructor = clazz.getConstructor(String.class, String.class, boolean.class, BroadcastGroupConfiguration.class);
BroadcastGroup group = (BroadcastGroup)constructor.newInstance(nodeUUID.toString(), config.getName(), !backup, config);
if (group.size() == 0)
Modified: branches/HORNETQ-316/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- branches/HORNETQ-316/tests/config/ConfigurationTest-full-config.xml 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/config/ConfigurationTest-full-config.xml 2011-02-20 14:34:41 UTC (rev 10233)
@@ -83,33 +83,45 @@
</acceptors>
<broadcast-groups>
<broadcast-group name="bg1">
- <local-bind-port>10999</local-bind-port>
- <group-address>192.168.0.120</group-address>
- <group-port>11999</group-port>
- <broadcast-period>12345</broadcast-period>
+ <broadcast-group-class>org.hornetq.core.server.cluster.impl.BroadcastGroupImpl</broadcast-group-class>
<connector-ref>connector1</connector-ref>
+ <param key="local-bind-port" value="10999"/>
+ <param key="group-address" value="192.168.0.120"/>
+ <param key="group-port" value="11999"/>
+ <param key="broadcast-period" value="12345"/>
</broadcast-group>
<broadcast-group name="bg2">
- <local-bind-port>12999</local-bind-port>
- <group-address>192.168.0.121</group-address>
- <group-port>13999</group-port>
- <broadcast-period>23456</broadcast-period>
+ <broadcast-group-class>org.hornetq.core.server.cluster.impl.BroadcastGroupImpl</broadcast-group-class>
<connector-ref>connector2</connector-ref>
+ <param key="local-bind-port" value="12999"/>
+ <param key="group-address" value="192.168.0.121"/>
+ <param key="group-port" value="13999"/>
+ <param key="broadcast-period" value="23456"/>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg1">
- <local-bind-address>172.16.8.10</local-bind-address>
- <group-address>192.168.0.120</group-address>
- <group-port>11999</group-port>
- <refresh-timeout>12345</refresh-timeout>
+ <server-locator-class>org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl</server-locator-class>
+ <param key="local-bind-address" value="172.16.8.10"/>
+ <param key="group-address" value="192.168.0.120"/>
+ <param key="group-port" value="11999"/>
+ <param key="refresh-timeout" value="12345"/>
</discovery-group>
<discovery-group name="dg2">
- <local-bind-address>172.16.8.11</local-bind-address>
- <group-address>192.168.0.121</group-address>
- <group-port>12999</group-port>
- <refresh-timeout>23456</refresh-timeout>
+ <server-locator-class>org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl</server-locator-class>
+ <param key="local-bind-address" value="172.16.8.11"/>
+ <param key="group-address" value="192.168.0.121"/>
+ <param key="group-port" value="12999"/>
+ <param key="refresh-timeout" value="23456"/>
</discovery-group>
+ <discovery-group name="sdg1">
+ <server-locator-class>org.hornetq.core.client.impl.StaticServerLocatorImpl</server-locator-class>
+ <param key="static-connector-names" value="connector1"/>
+ </discovery-group>
+ <discovery-group name="sdg12">
+ <server-locator-class>org.hornetq.core.client.impl.StaticServerLocatorImpl</server-locator-class>
+ <param key="static-connector-names" value="connector1,connector2"/>
+ </discovery-group>
</discovery-groups>
<diverts>
<divert name="divert1">
@@ -152,9 +164,7 @@
<reconnect-attempts>2</reconnect-attempts>
<failover-on-server-shutdown>false</failover-on-server-shutdown>
<use-duplicate-detection>true</use-duplicate-detection>
- <static-connectors>
- <connector-ref>connector1</connector-ref>
- </static-connectors>
+ <discovery-group-ref discovery-group-name="sdg1"/>
</bridge>
<bridge name="bridge2">
<queue-name>queue2</queue-name>
@@ -170,10 +180,7 @@
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>false</forward-when-no-consumers>
<max-hops>1</max-hops>
- <static-connectors>
- <connector-ref>connector1</connector-ref>
- <connector-ref>connector2</connector-ref>
- </static-connectors>
+ <discovery-group-ref discovery-group-name="sdg12"/>
</cluster-connection>
<cluster-connection name="cluster-connection2">
<address>queues2</address>
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -160,7 +160,7 @@
assertFactoryParams(locator,
tc,
- null,
+ locator.getDiscoveryGroupConfiguration(),
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
HornetQClient.DEFAULT_CALL_TIMEOUT,
@@ -587,7 +587,7 @@
getUDPDiscoveryAddress(),
getUDPDiscoveryPort(),
broadcastPeriod,
- Arrays.asList(liveTC.getName()));
+ Arrays.asList(liveTC));
List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
bcConfigs1.add(bcConfig1);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -115,7 +115,7 @@
}
public void testCrashClient2() throws Exception
- {
+ {
assertActiveConnections(1);
ClientSession session = sf.createSession(false, true, true);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -91,8 +91,8 @@
final int port = getUDPDiscoveryPort();
- ArrayList<String> list = new ArrayList<String>();
- list.add(server1tc.getName());
+ ArrayList<TransportConfiguration> list = new ArrayList<TransportConfiguration>();
+ list.add(server1tc);
BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
null,
-1,
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -1462,8 +1462,8 @@
TransportConfiguration connector = createTransportConfiguration(netty, false, params);
configuration.getConnectorConfigurations().put(connector.getName(), connector);
- List<String> connectorPairs = new ArrayList<String>();
- connectorPairs.add(connector.getName());
+ List<TransportConfiguration> connectorPairs = new ArrayList<TransportConfiguration>();
+ connectorPairs.add(connector);
BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
null,
@@ -1549,8 +1549,8 @@
TransportConfiguration connector = createTransportConfiguration(netty, false, params);
configuration.getConnectorConfigurations().put(connector.getName(), connector);
- List<String> connectorPairs = new ArrayList<String>();
- connectorPairs.add(connector.getName());
+ List<TransportConfiguration> connectorPairs = new ArrayList<TransportConfiguration>();
+ connectorPairs.add(connector);
BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
null,
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -77,15 +77,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -163,15 +162,14 @@
params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, 6552);
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
localAddress,
@@ -207,16 +205,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
-
- bg.addConnector(live1);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -264,16 +260,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
-
- bg.addConnector(live1);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(nodeID, RandomUtil.randomString(), null, groupAddress, groupPort, timeout);
dg.start();
@@ -347,15 +341,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
final int port2 = getUDPDiscoveryPort(1);
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
@@ -387,15 +380,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
final int port2 = getUDPDiscoveryPort(1);
@@ -441,34 +433,33 @@
Map<String,Object> params1 = new HashMap<String,Object>();
params1.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress1);
params1.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort1);
- BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params1, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors1 = new ArrayList<TransportConfiguration>();
+ connectors1.add(live1);
+ BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params1, RandomUtil.randomString(), connectors1);
BroadcastGroup bg1 = new BroadcastGroupImpl(node1, broadcastConf1.getName(), true, broadcastConf1);
bg1.start();
Map<String,Object> params2 = new HashMap<String,Object>();
params2.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress2);
params2.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort2);
- BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params2, RandomUtil.randomString());
+ TransportConfiguration live2 = generateTC();
+ List<TransportConfiguration> connectors2 = new ArrayList<TransportConfiguration>();
+ connectors2.add(live2);
+ BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params2, RandomUtil.randomString(), connectors2);
BroadcastGroup bg2 = new BroadcastGroupImpl(node2, broadcastConf2.getName(), true, broadcastConf2);
bg2.start();
Map<String,Object> params3 = new HashMap<String,Object>();
params3.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress3);
params3.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort3);
- BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params3, RandomUtil.randomString());
+ TransportConfiguration live3 = generateTC();
+ List<TransportConfiguration> connectors3 = new ArrayList<TransportConfiguration>();
+ connectors3.add(live3);
+ BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params3, RandomUtil.randomString(), connectors3);
BroadcastGroup bg3 = new BroadcastGroupImpl(node3, broadcastConf3.getName(), true, broadcastConf3);
bg3.start();
- TransportConfiguration live1 = generateTC();
-
- TransportConfiguration live2 = generateTC();
-
- TransportConfiguration live3 = generateTC();
-
- bg1.addConnector(live1);
- bg2.addConnector(live2);
- bg3.addConnector(live3);
-
DiscoveryGroup dg1 = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -577,15 +568,14 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -642,27 +632,28 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors1 = new ArrayList<TransportConfiguration>();
+ connectors1.add(live1);
+ BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors1);
BroadcastGroup bg1 = new BroadcastGroupImpl(node1, broadcastConf1.getName(), true, broadcastConf1);
bg1.start();
- BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live2 = generateTC();
+ List<TransportConfiguration> connectors2 = new ArrayList<TransportConfiguration>();
+ connectors2.add(live2);
+ BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors2);
BroadcastGroup bg2 = new BroadcastGroupImpl(node2, broadcastConf2.getName(), true, broadcastConf2);
bg2.start();
- BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live3 = generateTC();
+ List<TransportConfiguration> connectors3 = new ArrayList<TransportConfiguration>();
+ connectors3.add(live3);
+ BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors3);
BroadcastGroup bg3 = new BroadcastGroupImpl(node3, broadcastConf3.getName(), true, broadcastConf3);
bg3.start();
- TransportConfiguration live1 = generateTC();
- bg1.addConnector(live1);
-
- TransportConfiguration live2 = generateTC();
- bg2.addConnector(live2);
-
- TransportConfiguration live3 = generateTC();
- bg3.addConnector(live3);
-
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -818,14 +809,13 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ TransportConfiguration live1 = generateTC();
+ List<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>();
+ connectors.add(live1);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), connectors);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
- TransportConfiguration live1 = generateTC();
-
- bg.addConnector(live1);
-
DiscoveryGroup dg1 = new DiscoveryGroupImpl(RandomUtil.randomString(),
RandomUtil.randomString(),
null,
@@ -926,7 +916,7 @@
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
- BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString(), new ArrayList<TransportConfiguration>());
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.setNotificationService(notifService);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -715,8 +715,8 @@
liveConf.setSharedStore(true);
liveConf.setClustered(true);
- List<String> connectorNames = new ArrayList<String>();
- connectorNames.add(liveTC.getName());
+ List<TransportConfiguration> connectorNames = new ArrayList<TransportConfiguration>();
+ connectorNames.add(liveTC);
final long broadcastPeriod = 250;
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -86,8 +86,8 @@
Assert.assertEquals(bridgeConfig.isUseDuplicateDetection(), bridgeControl.isUseDuplicateDetection());
String[] connectorPairData = bridgeControl.getStaticConnectors();
- TransportConfiguration[] connectors = (TransportConfiguration[])bridgeConfig.getDiscoveryGroupConfiguration().getParams().get((DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME));
- Assert.assertEquals(connectors[0].getName(), connectorPairData[0]);
+ List<TransportConfiguration> connectors = (List<TransportConfiguration>)bridgeConfig.getDiscoveryGroupConfiguration().getParams().get((DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME));
+ Assert.assertEquals(connectors.get(0).getName(), connectorPairData[0]);
Assert.assertTrue(bridgeControl.isStarted());
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -92,8 +92,8 @@
((Boolean)proxy.retrieveAttributeValue("useDuplicateDetection")).booleanValue());
Object[] data = (Object[])proxy.retrieveAttributeValue("staticConnectors");
- TransportConfiguration[] connectors = (TransportConfiguration[])bridgeConfig.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
- Assert.assertEquals(connectors[0].getName(), data[0]);
+ List<TransportConfiguration> connectors = (List<TransportConfiguration>)bridgeConfig.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ Assert.assertEquals(connectors.get(0).getName(), data[0]);
Assert.assertTrue((Boolean)proxy.retrieveAttributeValue("started"));
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -53,7 +53,7 @@
// Static --------------------------------------------------------
- public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final List<String> connectorInfos)
+ public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final List<TransportConfiguration> connectorList)
{
return createBroadcastGroupConfiguration(RandomUtil.randomString(),
null,
@@ -61,7 +61,7 @@
"231.7.7.7",
1199,
RandomUtil.randomPositiveInt(),
- connectorInfos);
+ connectorList);
}
public static Pair<String, String> randomPair()
@@ -76,9 +76,9 @@
public void testAttributes() throws Exception
{
TransportConfiguration connectorConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add(connectorConfiguration.getName());
- BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
+ List<TransportConfiguration> connectorList = new ArrayList<TransportConfiguration>();
+ connectorList.add(connectorConfiguration);
+ BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorList);
Configuration conf = createBasicConfig();
conf.setSecurityEnabled(false);
@@ -102,13 +102,13 @@
Assert.assertEquals(1, connectorPairs.length);
System.out.println(connectorPairs);
String connectorPairData = (String)connectorPairs[0];
- TransportConfiguration[] connectors = (TransportConfiguration[])broadcastGroupConfig.getParams().get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
- Assert.assertEquals(connectors[0].getName(), connectorPairData);
+ List<TransportConfiguration> connectors = broadcastGroupConfig.getConnectorList();
+ Assert.assertEquals(connectors.get(0).getName(), connectorPairData);
String jsonString = broadcastGroupControl.getConnectorPairsAsJSON();
Assert.assertNotNull(jsonString);
JSONArray array = new JSONArray(jsonString);
Assert.assertEquals(1, array.length());
- Assert.assertEquals(connectors[0].getName(), array.getString(0));
+ Assert.assertEquals(connectors.get(0).getName(), array.getString(0));
Assert.assertTrue(broadcastGroupControl.isStarted());
}
@@ -116,9 +116,9 @@
public void testStartStop() throws Exception
{
TransportConfiguration connectorConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add(connectorConfiguration.getName());
- BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
+ List<TransportConfiguration> connectorList = new ArrayList<TransportConfiguration>();
+ connectorList.add(connectorConfiguration);
+ BroadcastGroupConfiguration broadcastGroupConfig = BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorList);
Configuration conf = createBasicConfig();
conf.setSecurityEnabled(false);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -147,15 +147,15 @@
1024,
discoveryGroupConfig,
false);
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add("netty");
+ List<TransportConfiguration> connectorList = new ArrayList<TransportConfiguration>();
+ connectorList.add(connectorConfig_0);
BroadcastGroupConfiguration broadcastGroupConfig = createBroadcastGroupConfiguration(discoveryName,
null,
-1,
groupAddress,
groupPort,
250,
- connectorInfos);
+ connectorList);
Configuration conf_1 = createBasicConfig();
conf_1.setSecurityEnabled(false);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -94,14 +94,14 @@
Object[] connectors = clusterConnectionControl.getStaticConnectors();
Assert.assertEquals(1, connectors.length);
String connector = (String)connectors[0];
- TransportConfiguration[] clusterConnectors = (TransportConfiguration[])clusterConnectionConfig1.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
- Assert.assertEquals(clusterConnectors[0].getName(), connector);
+ List<TransportConfiguration> clusterConnectors = (List<TransportConfiguration>)clusterConnectionConfig1.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ Assert.assertEquals(clusterConnectors.get(0).getName(), connector);
String jsonString = clusterConnectionControl.getStaticConnectorsAsJSON();
Assert.assertNotNull(jsonString);
JSONArray array = new JSONArray(jsonString);
Assert.assertEquals(1, array.length());
- Assert.assertEquals(clusterConnectors[0].getName(), array.getString(0));
+ Assert.assertEquals(clusterConnectors.get(0).getName(), array.getString(0));
Assert.assertNull(clusterConnectionControl.getDiscoveryGroupName());
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -139,38 +139,49 @@
if (bc.getName().equals("bg1"))
{
Assert.assertEquals("bg1", bc.getName());
- Assert.assertEquals(10999, bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
+ Assert.assertEquals(10999, new Integer((String)bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME)).intValue());
Assert.assertEquals("192.168.0.120", bc.getParams().get(BroadcastGroupConstants.GROUP_ADDRESS_NAME));
- Assert.assertEquals(11999, bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME));
- Assert.assertEquals(12345, bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME));
- Assert.assertEquals("connector1", ((List<String>)bc.getParams().get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME)).get(0));
+ Assert.assertEquals(11999, new Integer((String)bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME)).intValue());
+ Assert.assertEquals(12345, new Long((String)bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME)).longValue());
+ Assert.assertEquals("connector1", bc.getConnectorList().get(0).getName());
}
else
{
Assert.assertEquals("bg2", bc.getName());
- Assert.assertEquals(12999, bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
+ Assert.assertEquals(12999, new Integer((String)bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME)).intValue());
Assert.assertEquals("192.168.0.121", bc.getParams().get(BroadcastGroupConstants.GROUP_ADDRESS_NAME));
- Assert.assertEquals(13999, bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME));
- Assert.assertEquals(23456, bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME));
- Assert.assertEquals("connector2", ((List<String>)bc.getParams().get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME)).get(0));
+ Assert.assertEquals(13999, new Integer((String)bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME)).intValue());
+ Assert.assertEquals(23456, new Long((String)bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME)).longValue());
+ Assert.assertEquals("connector2", bc.getConnectorList().get(0).getName());
}
}
- Assert.assertEquals(2, conf.getDiscoveryGroupConfigurations().size());
+ Assert.assertEquals(4, conf.getDiscoveryGroupConfigurations().size());
DiscoveryGroupConfiguration dc = conf.getDiscoveryGroupConfigurations().get("dg1");
Assert.assertEquals("dg1", dc.getName());
Assert.assertEquals("192.168.0.120", dc.getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME));
assertEquals("172.16.8.10", dc.getParams().get(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME));
- Assert.assertEquals(11999, dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME));
- Assert.assertEquals(12345, dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
+ Assert.assertEquals(11999, new Integer((String)dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME)).intValue());
+ Assert.assertEquals(12345, new Long((String)dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME)).longValue());
dc = conf.getDiscoveryGroupConfigurations().get("dg2");
Assert.assertEquals("dg2", dc.getName());
Assert.assertEquals("192.168.0.121", dc.getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME));
assertEquals("172.16.8.11", dc.getParams().get(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME));
- Assert.assertEquals(12999, dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME));
- Assert.assertEquals(23456, dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
+ Assert.assertEquals(12999, new Integer((String)dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME)).intValue());
+ Assert.assertEquals(23456, new Long((String)dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME)).longValue());
+ dc = conf.getDiscoveryGroupConfigurations().get("sdg1");
+ Assert.assertEquals("sdg1", dc.getName());
+ Assert.assertEquals("connector1", dc.getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_NAMES_NAME));
+ Assert.assertEquals("connector1", ((List<TransportConfiguration>)dc.getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(0).getName());
+
+ dc = conf.getDiscoveryGroupConfigurations().get("sdg12");
+ Assert.assertEquals("sdg12", dc.getName());
+ Assert.assertEquals("connector1,connector2", dc.getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_NAMES_NAME));
+ Assert.assertEquals("connector1", ((List<TransportConfiguration>)dc.getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(0).getName());
+ Assert.assertEquals("connector2", ((List<TransportConfiguration>)dc.getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(1).getName());
+
Assert.assertEquals(2, conf.getDivertConfigurations().size());
for (DivertConfiguration dic : conf.getDivertConfigurations())
{
@@ -210,7 +221,7 @@
Assert.assertEquals(0.2, bc.getRetryIntervalMultiplier());
Assert.assertEquals(2, bc.getReconnectAttempts());
Assert.assertEquals(true, bc.isUseDuplicateDetection());
- Assert.assertEquals("connector1", ((TransportConfiguration[])bc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[0].getName());
+ Assert.assertEquals("connector1", ((List<TransportConfiguration>)bc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(0).getName());
}
else
{
@@ -234,8 +245,8 @@
Assert.assertEquals(true, ccc.isDuplicateDetection());
Assert.assertEquals(false, ccc.isForwardWhenNoConsumers());
Assert.assertEquals(1, ccc.getMaxHops());
- Assert.assertEquals("connector1", ((TransportConfiguration[])ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[0].getName());
- Assert.assertEquals("connector2", ((TransportConfiguration[])ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[1].getName());
+ Assert.assertEquals("connector1", ((List<TransportConfiguration>)ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(0).getName());
+ Assert.assertEquals("connector2", ((List<TransportConfiguration>)ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME)).get(1).getName());
}
else
{
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-20 05:37:37 UTC (rev 10232)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-20 14:34:41 UTC (rev 10233)
@@ -31,6 +31,7 @@
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -264,7 +265,7 @@
protected static DiscoveryGroupConfiguration createStaticDiscoveryGroupConfiguration(TransportConfiguration... connectors)
{
Map<String,Object> params = new HashMap<String,Object>();
- params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectors);
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, Arrays.asList(connectors));
return new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(),
params,
UUIDGenerator.getInstance().generateStringUUID());
@@ -276,16 +277,15 @@
String groupAddress,
int groupPort,
long broadcastPeriod,
- List<String> connectorInfos)
+ List<TransportConfiguration> connectorList)
{
Map<String,Object> params = new HashMap<String,Object>();
params.put(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME, localBindAddress);
- params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, localBindPort);
+ params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, Integer.toString(localBindPort));
params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
- params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
- params.put(BroadcastGroupConstants.BROADCAST_PERIOD_NAME, broadcastPeriod);
- params.put(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME, connectorInfos);
- return new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, name);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, Integer.toString(groupPort));
+ params.put(BroadcastGroupConstants.BROADCAST_PERIOD_NAME, Long.toString(broadcastPeriod));
+ return new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, name, connectorList);
}
public static int getUDPDiscoveryPort()
13 years, 11 months
JBoss hornetq SVN: r10232 - in branches/Branch_2_2_EAP: hornetq-rest and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-20 00:37:37 -0500 (Sun, 20 Feb 2011)
New Revision: 10232
Modified:
branches/Branch_2_2_EAP/build-maven.xml
branches/Branch_2_2_EAP/hornetq-rest/pom.xml
branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties
Log:
new build
Modified: branches/Branch_2_2_EAP/build-maven.xml
===================================================================
--- branches/Branch_2_2_EAP/build-maven.xml 2011-02-20 05:03:54 UTC (rev 10231)
+++ branches/Branch_2_2_EAP/build-maven.xml 2011-02-20 05:37:37 UTC (rev 10232)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.2.0.EAP-QA-10227"/>
+ <property name="hornetq.version" value="2.2.0.EAP-QA-10231"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
Modified: branches/Branch_2_2_EAP/hornetq-rest/pom.xml
===================================================================
--- branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-02-20 05:03:54 UTC (rev 10231)
+++ branches/Branch_2_2_EAP/hornetq-rest/pom.xml 2011-02-20 05:37:37 UTC (rev 10232)
@@ -10,7 +10,7 @@
<properties>
<resteasy.version>2.0.1.GA</resteasy.version>
- <hornetq.version>2.2.0.EAP-QA-10227</hornetq.version>
+ <hornetq.version>2.2.0.EAP-QA-10231</hornetq.version>
</properties>
<licenses>
Modified: branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties
===================================================================
--- branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties 2011-02-20 05:03:54 UTC (rev 10231)
+++ branches/Branch_2_2_EAP/src/config/common/hornetq-version.properties 2011-02-20 05:37:37 UTC (rev 10232)
@@ -1,4 +1,4 @@
-hornetq.version.versionName=QA_10227
+hornetq.version.versionName=QA_10231
hornetq.version.majorVersion=2
hornetq.version.minorVersion=2
hornetq.version.microVersion=0
13 years, 11 months
JBoss hornetq SVN: r10231 - in branches/Branch_2_2_EAP: src/main/org/hornetq/core/paging/cursor/impl and 8 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-20 00:03:54 -0500 (Sun, 20 Feb 2011)
New Revision: 10231
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
Log:
https://issues.jboss.org/browse/JBPAPP-5949 - Improving thread usage
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/journal/impl/SimpleWaitIOCallback.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -35,6 +35,11 @@
private volatile String errorMessage;
private volatile int errorCode = 0;
+
+ public String toString()
+ {
+ return "simpleWaitIOCallback";
+ }
public void done()
{
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -233,7 +233,15 @@
{
public void run()
{
- cleanup();
+ storageManager.setContext(storageManager.newSingleThreadContext());
+ try
+ {
+ cleanup();
+ }
+ finally
+ {
+ storageManager.clearContext();
+ }
}
});
}
@@ -285,24 +293,8 @@
Page currentPage = pagingStore.getCurrentPage();
- try
- {
- // First step: Move every cursor to the next bookmarked page (that was just created)
- for (PageSubscription cursor : cursorList)
- {
- cursor.confirmPosition(new PagePositionImpl(currentPage.getPageId(), -1));
- }
+ storePositions(cursorList, currentPage);
- storageManager.waitOnOperations();
- }
- finally
- {
- for (PageSubscription cursor : cursorList)
- {
- cursor.enableAutoCleanup();
- }
- }
-
pagingStore.stopPaging();
// This has to be called after we stopped paging
@@ -360,6 +352,35 @@
}
+ /**
+ * @param cursorList
+ * @param currentPage
+ * @throws Exception
+ */
+ protected void storePositions(ArrayList<PageSubscription> cursorList, Page currentPage) throws Exception
+ {
+ try
+ {
+ // First step: Move every cursor to the next bookmarked page (that was just created)
+ for (PageSubscription cursor : cursorList)
+ {
+ cursor.confirmPosition(new PagePositionImpl(currentPage.getPageId(), -1));
+ }
+
+ while (!storageManager.waitOnOperations(5000))
+ {
+ log.warn("Couldn't complete operations on IO context " + storageManager.getContext());
+ }
+ }
+ finally
+ {
+ for (PageSubscription cursor : cursorList)
+ {
+ cursor.enableAutoCleanup();
+ }
+ }
+ }
+
public void printDebug()
{
System.out.println("Debug information for PageCursorProviderImpl:");
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/StorageManager.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -57,6 +57,8 @@
/** It just creates an OperationContext without associating it */
OperationContext newContext(Executor executor);
+
+ OperationContext newSingleThreadContext();
/** Set the context back to the thread */
void setContext(OperationContext context);
@@ -74,10 +76,14 @@
void afterCompleteOperations(IOAsyncTask run);
/** Block until the operations are done.
+ * Warning: Don't use it inside an ordered executor, otherwise the system may lock up
+ * in case of the pools are full
* @throws Exception */
- void waitOnOperations(long timeout) throws Exception;
+ boolean waitOnOperations(long timeout) throws Exception;
/** Block until the operations are done.
+ * Warning: Don't use it inside an ordered executor, otherwise the system may lock up
+ * in case of the pools are full
* @throws Exception */
void waitOnOperations() throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -15,6 +15,8 @@
import java.io.File;
import java.nio.ByteBuffer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -23,6 +25,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import javax.transaction.xa.Xid;
@@ -52,10 +56,8 @@
import org.hornetq.core.paging.PagedMessage;
import org.hornetq.core.paging.PagingManager;
import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.paging.cursor.PageCursorProvider;
import org.hornetq.core.paging.cursor.PagePosition;
import org.hornetq.core.paging.cursor.PageSubscription;
-import org.hornetq.core.paging.cursor.PageSubscriptionCounter;
import org.hornetq.core.paging.cursor.PagedReferenceImpl;
import org.hornetq.core.paging.cursor.impl.PagePositionImpl;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
@@ -85,6 +87,7 @@
import org.hornetq.core.transaction.impl.TransactionImpl;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.ExecutorFactory;
+import org.hornetq.utils.HornetQThreadFactory;
import org.hornetq.utils.UUID;
import org.hornetq.utils.XidCodecSupport;
@@ -165,6 +168,8 @@
private final ExecutorFactory executorFactory;
private final Executor executor;
+
+ private ExecutorService singleThreadExecutor;
private final boolean syncTransactional;
@@ -333,17 +338,14 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#blockOnReplication()
*/
- public void waitOnOperations(final long timeout) throws Exception
+ public boolean waitOnOperations(final long timeout) throws Exception
{
if (!started)
{
JournalStorageManager.log.warn("Server is stopped");
throw new IllegalStateException("Server is stopped");
}
- if (!getContext().waitCompletion(timeout))
- {
- throw new HornetQException(HornetQException.IO_ERROR, "Timeout on waiting I/O completion");
- }
+ return getContext().waitCompletion(timeout);
}
/*
@@ -393,6 +395,16 @@
{
OperationContextImpl.setContext(context);
}
+
+ public Executor getSingleThreadExecutor()
+ {
+ return singleThreadExecutor;
+ }
+
+ public OperationContext newSingleThreadContext()
+ {
+ return newContext(singleThreadExecutor);
+ }
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#newContext()
@@ -1390,6 +1402,8 @@
checkAndCreateDir(largeMessagesDirectory, createJournalDir);
cleanupIncompleteFiles();
+
+ singleThreadExecutor = Executors.newSingleThreadExecutor(new HornetQThreadFactory("HornetQ-IO-SingleThread", true, getThisClassLoader()));
bindingsJournal.start();
@@ -1398,6 +1412,7 @@
started = true;
}
+
public synchronized void stop() throws Exception
{
if (!started)
@@ -1414,6 +1429,8 @@
bindingsJournal.stop();
messageJournal.stop();
+
+ singleThreadExecutor.shutdown();
journalLoaded = false;
@@ -1834,6 +1851,19 @@
}
}
+
+ private static ClassLoader getThisClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return JournalStorageManager.class.getClassLoader();
+ }
+ });
+ }
+
+
// Inner Classes
// ----------------------------------------------------------------------------
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/OperationContextImpl.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -232,10 +232,16 @@
{
public void run()
{
- // If any IO is done inside the callback, it needs to be done on a new context
- OperationContextImpl.clearContext();
- task.done();
- executorsPending.decrementAndGet();
+ try
+ {
+ // If any IO is done inside the callback, it needs to be done on a new context
+ OperationContextImpl.clearContext();
+ task.done();
+ }
+ finally
+ {
+ executorsPending.decrementAndGet();
+ }
}
});
}
@@ -277,6 +283,25 @@
class TaskHolder
{
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "TaskHolder [storeLined=" + storeLined +
+ ", replicationLined=" +
+ replicationLined +
+ ", pageLined=" +
+ pageLined +
+ ", task=" +
+ task +
+ "]";
+ }
+
int storeLined;
int replicationLined;
@@ -327,19 +352,39 @@
@Override
public String toString()
{
- return "OperationContextImpl [storeLineUp=" + storeLineUp +
+ StringBuffer buffer = new StringBuffer();
+ for (TaskHolder hold : tasks)
+ {
+ buffer.append("Task = " + hold + "\n");
+ }
+
+ return "OperationContextImpl [minimalStore=" + minimalStore +
+ ", storeLineUp=" +
+ storeLineUp +
", stored=" +
stored +
+ ", minimalReplicated=" +
+ minimalReplicated +
", replicationLineUp=" +
replicationLineUp +
", replicated=" +
replicated +
+ ", paged=" +
+ paged +
+ ", minimalPage=" +
+ minimalPage +
", pageLineUp=" +
pageLineUp +
- ", paged=" +
- paged +
- "]";
+ ", errorCode=" +
+ errorCode +
+ ", errorMessage=" +
+ errorMessage +
+ ", executorsPending=" +
+ executorsPending +
+ ", executor=" + this.executor +
+ "]" + buffer.toString();
}
+
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -364,8 +364,9 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
*/
- public void waitOnOperations(final long timeout) throws Exception
+ public boolean waitOnOperations(final long timeout) throws Exception
{
+ return true;
}
/* (non-Javadoc)
@@ -406,7 +407,14 @@
{
return dummyContext;
}
+
+
+ public OperationContext newSingleThreadContext()
+ {
+ return dummyContext;
+ }
+
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#setContext(org.hornetq.core.persistence.OperationContext)
*/
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -159,7 +159,7 @@
void resetAllIterators();
- void blockOnExecutorFuture();
+ boolean blockOnExecutorFuture();
void close() throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -16,10 +16,12 @@
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.management.ManagementHelper;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.logging.Logger;
+import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.BindingType;
import org.hornetq.core.server.group.GroupingHandler;
@@ -70,30 +72,45 @@
public Response propose(final Proposal proposal) throws Exception
{
- if (proposal.getClusterName() == null)
+ OperationContext originalCtx = storageManager.getContext();
+
+ try
{
- GroupBinding original = map.get(proposal.getGroupId());
- return original == null ? null : new Response(proposal.getGroupId(), original.getClusterName());
- }
- GroupBinding groupBinding = new GroupBinding(proposal.getGroupId(), proposal.getClusterName());
- if (map.putIfAbsent(groupBinding.getGroupId(), groupBinding) == null)
- {
- groupBinding.setId(storageManager.generateUniqueID());
- List<GroupBinding> newList = new ArrayList<GroupBinding>();
- List<GroupBinding> oldList = groupMap.putIfAbsent(groupBinding.getClusterName(), newList);
- if (oldList != null)
+ // the waitCompletion cannot be done inside an ordered executor or we would starve when the thread pool is full
+ storageManager.setContext(storageManager.newSingleThreadContext());
+
+ if (proposal.getClusterName() == null)
{
- newList = oldList;
+ GroupBinding original = map.get(proposal.getGroupId());
+ return original == null ? null : new Response(proposal.getGroupId(), original.getClusterName());
}
- newList.add(groupBinding);
- storageManager.addGrouping(groupBinding);
- storageManager.waitOnOperations(timeout);
- return new Response(groupBinding.getGroupId(), groupBinding.getClusterName());
+ GroupBinding groupBinding = new GroupBinding(proposal.getGroupId(), proposal.getClusterName());
+ if (map.putIfAbsent(groupBinding.getGroupId(), groupBinding) == null)
+ {
+ groupBinding.setId(storageManager.generateUniqueID());
+ List<GroupBinding> newList = new ArrayList<GroupBinding>();
+ List<GroupBinding> oldList = groupMap.putIfAbsent(groupBinding.getClusterName(), newList);
+ if (oldList != null)
+ {
+ newList = oldList;
+ }
+ newList.add(groupBinding);
+ storageManager.addGrouping(groupBinding);
+ if (!storageManager.waitOnOperations(timeout))
+ {
+ throw new HornetQException(HornetQException.IO_ERROR, "Timeout on waiting I/O completion");
+ }
+ return new Response(groupBinding.getGroupId(), groupBinding.getClusterName());
+ }
+ else
+ {
+ groupBinding = map.get(proposal.getGroupId());
+ return new Response(groupBinding.getGroupId(), proposal.getClusterName(), groupBinding.getClusterName());
+ }
}
- else
+ finally
{
- groupBinding = map.get(proposal.getGroupId());
- return new Response(groupBinding.getGroupId(), proposal.getClusterName(), groupBinding.getClusterName());
+ storageManager.setContext(originalCtx);
}
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -370,10 +370,11 @@
{
// We must block on the executor to ensure any async deliveries have completed or we might get out of order
// deliveries
- blockOnExecutorFuture();
-
- // Go into direct delivery mode
- directDeliver = true;
+ if (blockOnExecutorFuture())
+ {
+ // Go into direct delivery mode
+ directDeliver = true;
+ }
}
checkDirect = false;
}
@@ -420,7 +421,7 @@
blockOnExecutorFuture();
}
- public void blockOnExecutorFuture()
+ public boolean blockOnExecutorFuture()
{
Future future = new Future();
@@ -430,8 +431,10 @@
if (!ok)
{
- throw new IllegalStateException("Timed out waiting for future to complete");
+ log.warn("Couldn't finish waiting executors. Try increasing the thread pool size");
}
+
+ return ok;
}
public synchronized void addConsumer(final Consumer consumer) throws Exception
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -1461,8 +1461,9 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
*/
- public void waitOnOperations(final long timeout) throws Exception
+ public boolean waitOnOperations(final long timeout) throws Exception
{
+ return true;
}
/* (non-Javadoc)
@@ -1659,6 +1660,14 @@
return 0;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#newSingleThreadContext()
+ */
+ public OperationContext newSingleThreadContext()
+ {
+ return getContext();
+ }
+
}
class FakeStoreFactory implements PagingStoreFactory
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2011-02-17 19:25:42 UTC (rev 10230)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2011-02-20 05:03:54 UTC (rev 10231)
@@ -64,10 +64,9 @@
}
- public void blockOnExecutorFuture()
+ public boolean blockOnExecutorFuture()
{
- // TODO Auto-generated method stub
-
+ return true;
}
public void addHead(MessageReference ref)
13 years, 11 months
JBoss hornetq SVN: r10230 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-17 14:25:42 -0500 (Thu, 17 Feb 2011)
New Revision: 10230
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
Log:
tweak on test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-17 05:42:28 UTC (rev 10229)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-17 19:25:42 UTC (rev 10230)
@@ -147,6 +147,8 @@
testSettersThrowException(cf);
cf.close();
+
+ locator.close();
}
public void testStaticConnectorListConstructor() throws Exception
13 years, 11 months