Author: borges
Date: 2011-09-23 09:53:53 -0400 (Fri, 23 Sep 2011)
New Revision: 11403
Removed:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/Delivery.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/DeliveryImpl.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQDeque.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQIterator.java
Modified:
branches/HORNETQ-720_Replication/
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseTest.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/HORNETQ-720_Replication/tests/pom.xml
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/LinkedListTest.java
Log:
merge from trunk
Property changes on: branches/HORNETQ-720_Replication
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:10878-11242
+ /trunk:10878-11402
Deleted:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/Delivery.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/Delivery.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/Delivery.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -1,28 +0,0 @@
-/*
- * 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.core.server;
-
-/**
- *
- * A Delivery
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public interface Delivery
-{
- MessageReference getReference();
-
- long getConsumerID();
-}
Deleted:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/DeliveryImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/DeliveryImpl.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/server/impl/DeliveryImpl.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -1,47 +0,0 @@
-/*
- * 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.core.server.impl;
-
-import org.hornetq.core.server.Delivery;
-import org.hornetq.core.server.MessageReference;
-
-/**
- *
- * A DeliveryImpl
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class DeliveryImpl implements Delivery
-{
- private final long consumerID;
-
- private final MessageReference reference;
-
- public DeliveryImpl(final long consumerID, final MessageReference reference)
- {
- this.consumerID = consumerID;
- this.reference = reference;
- }
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public MessageReference getReference()
- {
- return reference;
- }
-}
Deleted:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQDeque.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQDeque.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQDeque.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -1,39 +0,0 @@
-/*
- * Copyright 2010 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.utils;
-
-
-/**
- * A HQDeque
- *
- * @author Tim Fox
- *
- *
- */
-public interface HQDeque<T>
-{
- void addFirst(T t);
-
- void addLast(T t);
-
- HQIterator<T> iterator();
-
- boolean isEmpty();
-
- T removeFirst();
-
- T getFirst();
-
- void clear();
-}
Deleted:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQIterator.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQIterator.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/utils/HQIterator.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -1,30 +0,0 @@
-/*
- * Copyright 2010 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.utils;
-
-/**
- * A HQIterator
- *
- * @author Tim Fox
- *
- *
- */
-public interface HQIterator<E>
-{
- E next();
-
- void remove();
-
- void prev();
-}
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -149,10 +149,10 @@
class TestHandler implements MessageHandler
{
- private CountDownLatch latch;
+ private final CountDownLatch latch;
int count = 0;
- private ClientSession clientSession;
+ private final ClientSession clientSession;
public TestHandler(CountDownLatch latch, ClientSession clientSession)
{
@@ -251,10 +251,12 @@
SimpleString dlq = new SimpleString("DLQ1");
clientSession.createQueue(dla, dlq, null, false);
clientSession.createQueue(qName, qName, null, false);
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ final ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ final ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession sendSession = sessionFactory.createSession(false, true, true);
- ClientProducer producer = sendSession.createProducer(qName);
+ try
+ {
+ ClientProducer producer = sendSession.createProducer(qName);
Map<String, Long> origIds = new HashMap<String, Long>();
for (int i = 0; i < NUM_MESSAGES; i++)
@@ -320,7 +322,10 @@
}
sendSession.close();
-
+ } finally {
+ sessionFactory.close();
+ locator.close();
+ }
}
public void testDeadlLetterAddressWithDefaultAddressSettings() throws Exception
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -26,7 +26,7 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A SessionCloseOnGCTest
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
@@ -57,7 +57,7 @@
protected void tearDown() throws Exception
{
//locator.close();
-
+
server.stop();
server = null;
@@ -269,12 +269,13 @@
public void testCloseOneSessionOnGC() throws Exception
{
- ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)
locator.createSessionFactory();
+ final ClientSessionFactoryImpl sf =
(ClientSessionFactoryImpl)locator.createSessionFactory();
- ClientSession session = sf.createSession(false, true, true);
+ try
+ {
+ ClientSession session = sf.createSession(false, true, true);
+ WeakReference<ClientSession> wses = new
WeakReference<ClientSession>(session);
- WeakReference<ClientSession> wses = new
WeakReference<ClientSession>(session);
-
Assert.assertEquals(1, server.getRemotingService().getConnections().size());
session = null;
@@ -284,12 +285,18 @@
Assert.assertEquals(0, sf.numSessions());
Assert.assertEquals(1, sf.numConnections());
Assert.assertEquals(1, server.getRemotingService().getConnections().size());
+ }
+ finally
+ {
+ sf.close();
+ }
}
public void testCloseSeveralSessionOnGC() throws Exception
{
- ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)
locator.createSessionFactory();
-
+ final ClientSessionFactoryImpl sf =
(ClientSessionFactoryImpl)locator.createSessionFactory();
+ try
+ {
ClientSession session1 = sf.createSession(false, true, true);
ClientSession session2 = sf.createSession(false, true, true);
ClientSession session3 = sf.createSession(false, true, true);
@@ -309,6 +316,11 @@
Assert.assertEquals(0, sf.numSessions());
Assert.assertEquals(1, sf.numConnections());
Assert.assertEquals(1, server.getRemotingService().getConnections().size());
+
+ }
+ finally
+ {
+ sf.close();
+ }
}
-
}
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseTest.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionCloseTest.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -21,11 +21,14 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
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.tests.util.RandomUtil;
@@ -49,6 +52,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -252,7 +257,9 @@
server.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator =
+ HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(
+
UnitTestCase.INVM_CONNECTOR_FACTORY));
sf = locator.createSessionFactory();
}
@@ -270,8 +277,13 @@
server.stop();
}
+ if (locator != null)
+ {
+ locator.close();
+ }
+
+ locator = null;
sf = null;
-
server = null;
super.tearDown();
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -38,7 +38,7 @@
import org.hornetq.tests.util.ServiceTestBase;
/**
- *
+ *
* A ClientSessionFactoryTest
*
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
@@ -50,7 +50,7 @@
{
private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
- private DiscoveryGroupConfiguration groupConfiguration = new
DiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
+ private final DiscoveryGroupConfiguration groupConfiguration = new
DiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
private HornetQServer liveService;
@@ -101,16 +101,22 @@
Assert.assertNotNull(csi);
csi.close();
-
+
locator.close();
}
public void testCloseUnusedClientSessionFactoryWithoutGlobalPools() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(liveTC);
-
- ClientSessionFactory csf = locator.createSessionFactory();
- csf.close();
+ try
+ {
+ ClientSessionFactory csf = locator.createSessionFactory();
+ csf.close();
+ }
+ finally
+ {
+ locator.close();
+ }
}
public void testDiscoveryConstructor() throws Exception
@@ -141,15 +147,15 @@
HornetQClient.DEFAULT_RETRY_INTERVAL,
HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
HornetQClient.DEFAULT_RECONNECT_ATTEMPTS);
-
+
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
testSettersThrowException(cf);
-
+
cf.close();
-
+
locator.close();
}
@@ -182,13 +188,13 @@
HornetQClient.DEFAULT_RETRY_INTERVAL,
HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
HornetQClient.DEFAULT_RECONNECT_ATTEMPTS);
-
+
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
testSettersThrowException(cf);
-
+
cf.close();
}
Modified: branches/HORNETQ-720_Replication/tests/pom.xml
===================================================================
--- branches/HORNETQ-720_Replication/tests/pom.xml 2011-09-23 12:22:05 UTC (rev 11402)
+++ branches/HORNETQ-720_Replication/tests/pom.xml 2011-09-23 13:53:53 UTC (rev 11403)
@@ -12,10 +12,6 @@
<artifactId>hornetq-tests-pom</artifactId>
<packaging>pom</packaging>
- <properties>
- <skipUnitTests>true</skipUnitTests>
- </properties>
-
<build>
<plugins>
<plugin>
Modified:
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/LinkedListTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/LinkedListTest.java 2011-09-23
12:22:05 UTC (rev 11402)
+++
branches/HORNETQ-720_Replication/tests/unit-tests/src/test/java/org/hornetq/tests/unit/util/LinkedListTest.java 2011-09-23
13:53:53 UTC (rev 11403)
@@ -57,6 +57,7 @@
payload = new byte[10 * 1024];
}
+ @Override
protected void finalize() throws Exception
{
count.decrementAndGet();
@@ -112,10 +113,8 @@
assertEquals(1000, count.get());
- int removed = 0;
while (iter.hasNext())
{
- System.out.println("removed " + (removed++));
iter.next();
iter.remove();
}