Author: clebert.suconic(a)jboss.com
Date: 2010-11-20 13:23:29 -0500 (Sat, 20 Nov 2010)
New Revision: 9916
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java
Log:
fixing rest compilation
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -2,7 +2,9 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.registry.JndiBindingRegistry;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
@@ -140,14 +142,21 @@
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
transportConfig.put(TransportConstants.SERVER_ID_PROP_NAME,
configuration.getInVmId());
- ClientSessionFactory consumerSessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
+
+ ServerLocator consumerLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
if (configuration.getConsumerWindowSize() != -1)
{
-
consumerSessionFactory.setConsumerWindowSize(configuration.getConsumerWindowSize());
+ consumerLocator.setConsumerWindowSize(configuration.getConsumerWindowSize());
}
- ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ ClientSessionFactory consumerSessionFactory =
consumerLocator.createSessionFactory();
+
+ ServerLocator defaultLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ ClientSessionFactory sessionFactory = defaultLocator.createSessionFactory();
+
LinkStrategy linkStrategy = new LinkHeaderLinkStrategy();
if (configuration.isUseLinkHeaders())
{
@@ -158,8 +167,10 @@
linkStrategy = new CustomHeaderLinkStrategy();
}
+ queueManager.setServerLocator(defaultLocator);
queueManager.setSessionFactory(sessionFactory);
queueManager.setTimeoutTask(timeoutTask);
+ queueManager.setConsumerServerLocator(consumerLocator);
queueManager.setConsumerSessionFactory(consumerSessionFactory);
queueManager.setDefaultSettings(defaultSettings);
queueManager.setPushStoreFile(configuration.getQueuePushStoreDirectory());
@@ -167,8 +178,10 @@
queueManager.setLinkStrategy(linkStrategy);
queueManager.setRegistry(registry);
+ queueManager.setServerLocator(defaultLocator);
topicManager.setSessionFactory(sessionFactory);
topicManager.setTimeoutTask(timeoutTask);
+ topicManager.setConsumerServerLocator(consumerLocator);
topicManager.setConsumerSessionFactory(consumerSessionFactory);
topicManager.setDefaultSettings(defaultSettings);
topicManager.setPushStoreFile(configuration.getTopicPushStoreDirectory());
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -4,7 +4,6 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.rest.util.LinkStrategy;
import org.hornetq.rest.util.TimeoutTask;
@@ -18,6 +17,7 @@
{
protected ServerLocator locator;
protected ClientSessionFactory sessionFactory;
+ protected ServerLocator consumerServerLocator;
protected ClientSessionFactory consumerSessionFactory;
protected boolean started;
protected String pushStoreFile;
@@ -67,8 +67,22 @@
{
this.consumerSessionFactory = consumerSessionFactory;
}
-
- public TimeoutTask getTimeoutTask()
+
+ /**
+ * @return the consumerServerLocator
+ */
+ public ServerLocator getConsumerServerLocator() {
+ return consumerServerLocator;
+ }
+
+ /**
+ * @param consumerServerLocator the consumerServerLocator to set
+ */
+ public void setConsumerServerLocator(ServerLocator consumerServerLocator) {
+ this.consumerServerLocator = consumerServerLocator;
+ }
+
+ public TimeoutTask getTimeoutTask()
{
return timeoutTask;
}
@@ -87,6 +101,16 @@
{
this.defaultSettings = defaultSettings;
}
+
+ public ServerLocator getServerLocator()
+ {
+ return this.locator;
+ }
+
+ public void setServerLocator(ServerLocator locator)
+ {
+ this.locator = locator;
+ }
public ClientSessionFactory getSessionFactory()
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -40,7 +40,7 @@
@BeforeClass
public static void setup() throws Exception
{
- connectionFactory = new
HornetQJMSConnectionFactory(manager.getQueueManager().getSessionFactory());
+ connectionFactory = new
HornetQJMSConnectionFactory(manager.getQueueManager().getServerLocator());
}
@XmlRootElement
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -1,5 +1,7 @@
package org.hornetq.rest.test;
+import java.util.HashMap;
+
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -7,7 +9,8 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -19,8 +22,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.HashMap;
-
/**
* Play with HornetQ
*
@@ -30,6 +31,7 @@
public class RawAckTest
{
protected static HornetQServer hornetqServer;
+ static ServerLocator serverLocator;
static ClientSessionFactory sessionFactory;
static ClientSessionFactory consumerSessionFactory;
static ClientProducer producer;
@@ -47,8 +49,10 @@
hornetqServer.start();
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
- sessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
- consumerSessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
+ serverLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ sessionFactory = serverLocator.createSessionFactory();
+ consumerSessionFactory = serverLocator.createSessionFactory();
hornetqServer.createQueue(new SimpleString("testQueue"), new
SimpleString("testQueue"), null, false, false);
session = sessionFactory.createSession(true, true);
@@ -59,6 +63,7 @@
@AfterClass
public static void shutdown() throws Exception
{
+ serverLocator.close();
hornetqServer.stop();
}
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -8,7 +8,9 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.MessageHandler;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -32,6 +34,7 @@
public class RawRestartTest
{
protected static HornetQServer hornetqServer;
+ static ServerLocator serverLocator;
static ClientSessionFactory sessionFactory;
static ClientSessionFactory consumerSessionFactory;
static ClientProducer producer;
@@ -51,11 +54,12 @@
session.start();
}
- private static void createFactories()
+ private static void createFactories() throws Exception
{
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
- sessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
- consumerSessionFactory = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ serverLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ sessionFactory = serverLocator.createSessionFactory();
+ consumerSessionFactory = serverLocator.createSessionFactory();
}
private static void startupTheServer()
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java 2010-11-19
07:29:42 UTC (rev 9915)
+++
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java 2010-11-20
18:23:29 UTC (rev 9916)
@@ -39,7 +39,7 @@
@BeforeClass
public static void setup() throws Exception
{
- connectionFactory = new
HornetQJMSConnectionFactory(manager.getQueueManager().getSessionFactory());
+ connectionFactory = new
HornetQJMSConnectionFactory(manager.getQueueManager().getServerLocator());
System.out.println("Queue name: " + topicName);
TopicDeployment deployment = new TopicDeployment();
deployment.setDuplicatesAllowed(true);