JBoss hornetq SVN: r11851 - in trunk: hornetq-journal and 7 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-12-06 05:33:14 -0500 (Tue, 06 Dec 2011)
New Revision: 11851
Added:
trunk/hornetq-journal/src/test/
trunk/hornetq-journal/src/test/java/
trunk/hornetq-journal/src/test/java/org/
trunk/hornetq-journal/src/test/java/org/hornetq/
trunk/hornetq-journal/src/test/java/org/hornetq/tests/
trunk/hornetq-journal/src/test/java/org/hornetq/tests/asyncio/
trunk/hornetq-journal/src/test/java/org/hornetq/tests/asyncio/LibaioDependencyCheckTest.java
Modified:
trunk/hornetq-journal/pom.xml
trunk/pom.xml
Log:
moved libaio test into hornetq journal module and fixed
Modified: trunk/hornetq-journal/pom.xml
===================================================================
--- trunk/hornetq-journal/pom.xml 2011-12-06 10:27:49 UTC (rev 11850)
+++ trunk/hornetq-journal/pom.xml 2011-12-06 10:33:14 UTC (rev 11851)
@@ -22,6 +22,13 @@
<artifactId>hornetq-commons</artifactId>
<version>${project.version}</version>
</dependency>
+ <!-- needed to compile the tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <!-- There are newer versions of the JUnit but thet break our tests -->
+ <version>3.8.2</version>
+ </dependency>
</dependencies>
<profiles>
Copied: trunk/hornetq-journal/src/test/java/org/hornetq/tests/asyncio/LibaioDependencyCheckTest.java (from rev 11847, trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/asyncio/LibaioDependencyCheckTest.java)
===================================================================
--- trunk/hornetq-journal/src/test/java/org/hornetq/tests/asyncio/LibaioDependencyCheckTest.java (rev 0)
+++ trunk/hornetq-journal/src/test/java/org/hornetq/tests/asyncio/LibaioDependencyCheckTest.java 2011-12-06 10:33:14 UTC (rev 11851)
@@ -0,0 +1,55 @@
+/*
+ * 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.tests.asyncio;
+
+import junit.framework.TestCase;
+import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
+
+/**
+ * A LibaioDependencyCheckTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class LibaioDependencyCheckTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testDependency() throws Exception
+ {
+ if (System.getProperties().get("os.name").equals("Linux"))
+ {
+ assertTrue("Libaio is not available on this platform", AsynchronousFileImpl.isLoaded());
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-12-06 10:27:49 UTC (rev 11850)
+++ trunk/pom.xml 2011-12-06 10:33:14 UTC (rev 11851)
@@ -475,7 +475,7 @@
<testFailureIgnore>true</testFailureIgnore>
<runOrder>alphabetical</runOrder>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
- <argLine>-Djava.util.logging.config.file=${user.dir}/distribution/hornetq/src/main/resources/stand-alone/non-clustered/logging.properties</argLine>
+ <argLine>-Djava.util.logging.config.file=${user.dir}/distribution/hornetq/src/main/resources/stand-alone/non-clustered/logging.properties -Djava.library.path=${user.dir}/distribution/hornetq/src/main/resources/bin/</argLine>
</configuration>
</plugin>
<plugin>
13 years
JBoss hornetq SVN: r11850 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster: failover and 1 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-06 05:27:49 -0500 (Tue, 06 Dec 2011)
New Revision: 11850
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
Log:
Delete unnecessary tearDown code.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -18,13 +18,10 @@
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.logging.Logger;
import org.hornetq.core.message.impl.MessageImpl;
public class ClusterHeadersRemovedTest extends ClusterTestBase
{
- private static final Logger log = Logger.getLogger(ClusterHeadersRemovedTest.class);
-
@Override
protected void setUp() throws Exception
{
@@ -34,25 +31,11 @@
setupServer(1, isFileStorage(), isNetty());
}
- @Override
- protected void tearDown() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
}
-
+
public void testHeadersRemoved() throws Exception
{
setupClusterConnection("cluster1", 0, 1, "queues", false, 1, isNetty(), false);
@@ -64,14 +47,14 @@
createQueue(0, "queues.testaddress", "queue0", null, false);
createQueue(1, "queues.testaddress", "queue0", null, false);
-
+
addConsumer(1, 1, "queue0", null);
-
+
waitForBindings(0, "queues.testaddress", 1, 0, true);
waitForBindings(0, "queues.testaddress", 1, 1, false);
-
+
waitForBindings(1, "queues.testaddress", 1, 1, true);
-
+
ClientSessionFactory sf = sfs[0];
ClientSession session0 = sf.createSession(false, true, true);
@@ -91,15 +74,15 @@
{
session0.close();
}
-
+
ClientConsumer consumer = super.getConsumer(1);
-
+
for (int i = 0; i < 10; i++)
{
ClientMessage message = consumer.receive(5000);
-
+
assertNotNull(message);
-
+
assertFalse(message.containsProperty(MessageImpl.HDR_ROUTE_TO_IDS));
}
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -168,18 +168,23 @@
{
if (servers[i] == null)
continue;
-
- final ClusterManager clusterManager = servers[i].getClusterManager();
- if (clusterManager != null)
+ try
{
- for (ClusterConnection cc : clusterManager.getClusterConnections())
+ final ClusterManager clusterManager = servers[i].getClusterManager();
+ if (clusterManager != null)
{
- cc.stop();
+ for (ClusterConnection cc : clusterManager.getClusterConnections())
+ {
+ cc.stop();
+ }
}
}
+ catch (Exception e)
+ {
+ // no-op
+ }
stopComponent(servers[i]);
-
- }
+ }
for (int i = 0; i < MAX_SERVERS; i++)
{
stopComponent(nodeManagers[i]);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -46,14 +46,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -134,16 +126,4 @@
setupLiveServer(5, isFileStorage(), true, isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4, 5);
- }
-
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -1047,12 +1047,6 @@
}
}
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
public boolean isNetty()
{
return true;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -36,14 +36,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -162,16 +154,4 @@
setupServer(3, isFileStorage(), isNetty());
setupServer(4, isFileStorage(), isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4);
- }
-
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -22,7 +22,6 @@
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.settings.impl.AddressSettings;
/**
@@ -34,8 +33,6 @@
*/
public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
{
- private static final Logger log = Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
-
protected final String groupAddress = getUDPDiscoveryAddress();
protected final int groupPort = getUDPDiscoveryPort();
@@ -45,25 +42,13 @@
return false;
}
+ @Override
protected void setUp() throws Exception
{
super.setUp();
setupCluster();
}
- protected void tearDown() throws Exception
- {
- for (int i = 0; i < servers.length; i++)
- {
- if (servers[i] != null)
- {
- servers[i].stop();
- servers[i] = null;
- }
- }
- super.tearDown();
- }
-
protected void setupCluster() throws Exception
{
setupCluster(false);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -13,14 +13,14 @@
package org.hornetq.tests.integration.cluster.distribution;
+import java.util.Map;
+import java.util.Set;
+
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.cluster.ClusterConnection;
import org.hornetq.core.server.cluster.MessageFlowRecord;
import org.hornetq.core.server.cluster.impl.ClusterConnectionImpl;
-import java.util.Map;
-import java.util.Set;
-
/**
* A OneWayChainClusterTest
*
@@ -46,20 +46,6 @@
setupServer(4, isFileStorage(), isNetty());
}
- @Override
- protected void tearDown() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -396,6 +382,5 @@
records = ccon.getRecords();
assertNotNull(records);
assertEquals(records.size(), 1);
- System.out.println("OneWayChainClusterTest.testChainClusterConnections");
}
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -44,21 +44,6 @@
setupClusterConnection("clusterX", 1, -1, "queues", false, 1, isNetty(), true);
}
- @Override
- protected void tearDown() throws Exception
- {
- log.info("#test Tear down");
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -41,6 +41,7 @@
// Public --------------------------------------------------------
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -55,6 +56,7 @@
* @param pairs
* @return
*/
+ @Override
protected ClusterConnectionConfiguration createClusterConfig(final String name,
final String address,
final boolean forwardWhenNoConsumers,
@@ -75,13 +77,6 @@
return clusterConf;
}
- public void tearDown() throws Exception
- {
- log.info("#test tearDown " + loopNumber);
- stopServers(0, 1, 2, 3, 4);
- super.tearDown();
- }
-
public boolean isNetty()
{
return false;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -18,7 +18,6 @@
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.core.logging.Logger;
/**
* A TemporaryQueueClusterTest
@@ -30,17 +29,6 @@
public class TemporaryQueueClusterTest extends ClusterTestBase
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
- private static final Logger log = Logger.getLogger(ClusteredRequestResponseTest.class);
-
@Override
protected void setUp() throws Exception
{
@@ -49,14 +37,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -124,24 +104,4 @@
setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -49,21 +49,6 @@
setupClusterConnection("cluster1", 1, 0, "queues", false, 1, isNetty(), false);
}
- @Override
- protected void tearDown() throws Exception
- {
- log.info("#test tearDown");
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -236,12 +236,21 @@
@Override
protected void tearDown() throws Exception
{
- if (sessionOne != null)
- sessionOne.close();
- if (sessionThree != null)
- sessionThree.close();
-
- super.tearDown();
+ try
+ {
+ if (consThree != null)
+ consThree.close();
+ if (producer != null)
+ producer.close();
+ if (sessionOne != null)
+ sessionOne.close();
+ if (sessionThree != null)
+ sessionThree.close();
+ }
+ finally
+ {
+ super.tearDown();
+ }
}
protected boolean isShared()
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -16,20 +16,19 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.logging.Logger;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class HAClientTopologyTest extends TopologyClusterTestBase
{
- private static final Logger log = Logger.getLogger(HAClientTopologyTest.class);
-
+ @Override
protected boolean isNetty()
{
return false;
}
+ @Override
protected void setupCluster() throws Exception
{
setupCluster(false);
@@ -44,6 +43,7 @@
setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
}
+ @Override
protected void setupServers() throws Exception
{
setupServer(0, isFileStorage(), isNetty());
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -16,24 +16,23 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.logging.Logger;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class HAClientTopologyWithDiscoveryTest extends TopologyClusterTestBase
{
- private static final Logger log = Logger.getLogger(HAClientTopologyWithDiscoveryTest.class);
-
protected final String groupAddress = getUDPDiscoveryAddress();
protected final int groupPort = getUDPDiscoveryPort();
+ @Override
protected boolean isNetty()
{
return false;
}
+ @Override
protected void setupCluster() throws Exception
{
setupCluster(false);
@@ -48,6 +47,7 @@
setupDiscoveryClusterConnection("cluster4", 4, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
}
+ @Override
protected void setupServers() throws Exception
{
setupLiveServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), false);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-06 10:08:37 UTC (rev 11849)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-06 10:27:49 UTC (rev 11850)
@@ -44,20 +44,6 @@
public abstract class TopologyClusterTestBase extends ClusterTestBase
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
private static final Logger log = Logger.getLogger(TopologyClusterTestBase.class);
private static final long WAIT_TIMEOUT = 5000;
@@ -110,9 +96,9 @@
continue;
}
boolean ok = true;
- for (int i = 0; i < expected.length; i++)
+ for (int element : expected)
{
- ok = (ok && actual.contains(nodeIDs[expected[i]]));
+ ok = (ok && actual.contains(nodeIDs[element]));
}
if (ok)
{
@@ -480,9 +466,8 @@
assertTrue("Was not notified that all servers are Down", ok);
checkContains(new int[] { 0 }, nodeIDs, nodes);
- for (int i = 0; i < sfs.length; i++)
+ for (ClientSessionFactory sf : sfs)
{
- ClientSessionFactory sf = sfs[i];
sf.close();
}
13 years
JBoss hornetq SVN: r11849 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-06 05:08:37 -0500 (Tue, 06 Dec 2011)
New Revision: 11849
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
Log:
Class is not sub-class of ServiceTestBase
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2011-12-06 10:08:23 UTC (rev 11848)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2011-12-06 10:08:37 UTC (rev 11849)
@@ -160,8 +160,8 @@
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
locator.setGroupID("grp1");
- ClientSessionFactory sessionFactory = createSessionFactory(locator);
- clientSession = addClientSession(sessionFactory.createSession(false, true, true));
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ clientSession = sessionFactory.createSession(false, true, true);
clientSession.createQueue(qName, qName, null, false);
}
13 years
JBoss hornetq SVN: r11848 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-06 05:08:23 -0500 (Tue, 06 Dec 2011)
New Revision: 11848
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
Do not declare 'throws Exception' when we don't throw anything.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06 04:13:32 UTC (rev 11847)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06 10:08:23 UTC (rev 11848)
@@ -551,7 +551,7 @@
}
}
- protected void removeConsumer(final int consumerID) throws Exception
+ protected void removeConsumer(final int consumerID)
{
ConsumerHolder holder = consumers[consumerID];
@@ -560,13 +560,12 @@
throw new IllegalArgumentException("No consumer at " + consumerID);
}
- holder.consumer.close();
- holder.session.close();
+ holder.close();
consumers[consumerID] = null;
}
- protected void closeAllConsumers() throws Exception
+ protected void closeAllConsumers()
{
for (int i = 0; i < consumers.length; i++)
{
@@ -580,7 +579,7 @@
}
}
- protected void closeAllSessionFactories() throws Exception
+ protected void closeAllSessionFactories()
{
for (int i = 0; i < sfs.length; i++)
{
@@ -589,7 +588,7 @@
}
}
- protected void closeAllServerLocatorsFactories() throws Exception
+ protected void closeAllServerLocatorsFactories()
{
for (int i = 0; i < locators.length; i++)
{
13 years
JBoss hornetq SVN: r11847 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 23:13:32 -0500 (Mon, 05 Dec 2011)
New Revision: 11847
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
Log:
JBPAPP-7504 - duplicate JNDI should throw an exception - fixing test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2011-12-06 02:56:29 UTC (rev 11846)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2011-12-06 04:13:32 UTC (rev 11847)
@@ -74,14 +74,17 @@
jmsServer.createConnectionFactory(false, nonPersisted, "/nonPersisted" );
+ boolean ex = false;
try
{
jmsServer.addConnectionFactoryToJNDI("np", "/someCF");
- fail("Failure expected and the API let duplicates");
}
- catch (HornetQException expected)
+ catch (Exception expected)
{
+ ex = true;
}
+
+ assertTrue(ex);
openCon("/someCF");
@@ -101,14 +104,18 @@
jmsServer.start();
jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI");
+
+ ex = false;
try
{
jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI");
- fail("Failure expected and the API let duplicates");
}
- catch (HornetQException expected)
+ catch (Exception expected)
{
+ ex = true;
}
+ assertTrue(ex);
+
openCon("/someCF");
openCon("/someCF2");
openCon("/newJNDI");
13 years
JBoss hornetq SVN: r11846 - in branches/Branch_2_2_EAP/src/main/org/hornetq: jms/server/impl and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 21:56:29 -0500 (Mon, 05 Dec 2011)
New Revision: 11846
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
JBPAPP-7504 - duplicate JNDI should throw an exception
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java 2011-12-06 00:16:24 UTC (rev 11845)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java 2011-12-06 02:56:29 UTC (rev 11846)
@@ -1,6 +1,7 @@
package org.hornetq.integration.spring;
import org.hornetq.spi.core.naming.BindingRegistry;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
/**
@@ -18,7 +19,14 @@
public Object lookup(String name)
{
- return factory.getBean(name);
+ try
+ {
+ return factory.getBean(name);
+ }
+ catch (NoSuchBeanDefinitionException e)
+ {
+ return null;
+ }
}
public boolean bind(String name, Object obj)
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-12-06 00:16:24 UTC (rev 11845)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-12-06 02:56:29 UTC (rev 11846)
@@ -408,6 +408,8 @@
public void runException() throws Exception
{
+ checkJNDI(jndi);
+
if (internalCreateQueue(queueName, selectorString, durable))
{
@@ -462,6 +464,8 @@
public void runException() throws Exception
{
+ checkJNDI(jndi);
+
if (internalCreateTopic(topicName))
{
HornetQDestination destination = topics.get(topicName);
@@ -501,6 +505,8 @@
public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception
{
checkInitialised();
+
+ checkJNDI(jndiBinding);
HornetQTopic destination = topics.get(topicName);
if (destination == null)
@@ -540,6 +546,8 @@
{
checkInitialised();
+ checkJNDI(jndiBinding);
+
HornetQQueue destination = queues.get(queueName);
if (destination == null)
{
@@ -561,6 +569,8 @@
public boolean addConnectionFactoryToJNDI(final String name, final String jndiBinding) throws Exception
{
checkInitialised();
+
+ checkJNDI(jndiBinding);
HornetQConnectionFactory factory = connectionFactories.get(name);
if (factory == null)
@@ -954,7 +964,7 @@
{
runAfterActive(new RunnableException()
{
-
+
public String toString()
{
return "createConnectionFactory for " + cfConfig.getName();
@@ -962,6 +972,7 @@
public void runException() throws Exception
{
+ checkJNDI(jndi);
HornetQConnectionFactory cf = internalCreateCF(storeConfig, cfConfig);
@@ -1402,15 +1413,24 @@
list.add(jndiItem);
}
}
-
- private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
+
+ private void checkJNDI(final String ... jndiNames) throws NamingException
{
- if (registry != null)
+
+ for (String jndiName : jndiNames)
{
if (registry.lookup(jndiName) != null)
{
throw new NamingException(jndiName + " already has an object bound");
}
+ }
+ }
+
+ private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
+ {
+ if (registry != null)
+ {
+ registry.unbind(jndiName);
registry.bind(jndiName, objectToBind);
}
return true;
13 years
JBoss hornetq SVN: r11845 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/jms/server/management and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 19:16:24 -0500 (Mon, 05 Dec 2011)
New Revision: 11845
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
Log:
JBPAPP-7504 - duplicate JNDI should throw an exception
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-12-05 23:34:09 UTC (rev 11844)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-12-06 00:16:24 UTC (rev 11845)
@@ -1407,7 +1407,10 @@
{
if (registry != null)
{
- registry.unbind(jndiName);
+ if (registry.lookup(jndiName) != null)
+ {
+ throw new NamingException(jndiName + " already has an object bound");
+ }
registry.bind(jndiName, objectToBind);
}
return true;
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-12-05 23:34:09 UTC (rev 11844)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-12-06 00:16:24 UTC (rev 11845)
@@ -28,6 +28,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -428,6 +429,24 @@
Assert.assertEquals(expiryAddress, queueControl.getExpiryAddress());
}
+ public void testDuplicateJNDI() throws Exception
+ {
+ String someQueue = RandomUtil.randomString();
+ String someOtherQueue = RandomUtil.randomString();
+ serverManager.createQueue(false, someQueue, null, true, someQueue, "/duplicate");
+ boolean exception = false;
+ try
+ {
+ serverManager.createQueue(false, someOtherQueue, null, true, someOtherQueue, "/duplicate");
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+
+ assertTrue(exception);
+ }
+
public void testExpireMessage() throws Exception
{
JMSQueueControl queueControl = createManagementControl();
13 years
JBoss hornetq SVN: r11844 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/management/impl and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 18:34:09 -0500 (Mon, 05 Dec 2011)
New Revision: 11844
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/TopicControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
Log:
JBPAPP-7541 - just adding missing methods to the JMX Control
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2011-12-05 22:58:28 UTC (rev 11843)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2011-12-05 23:34:09 UTC (rev 11844)
@@ -77,6 +77,10 @@
*/
@Operation(desc = "Adds the queue to another JNDI binding")
void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
+ @Operation(desc = "Adds the queue to another JNDI binding")
+ void removeJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
/**
* Lists all the JMS messages in this queue matching the specified filter.
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/TopicControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/TopicControl.java 2011-12-05 22:58:28 UTC (rev 11843)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/TopicControl.java 2011-12-05 23:34:09 UTC (rev 11844)
@@ -13,7 +13,6 @@
package org.hornetq.api.jms.management;
-import java.util.List;
import java.util.Map;
import javax.management.MBeanOperationInfo;
@@ -64,8 +63,13 @@
/**
* Add the JNDI binding to this destination
*/
- @Operation(desc = "Adds the queue to another JNDI binding")
+ @Operation(desc = "Add the queue to another JNDI binding")
void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
+ @Operation(desc = "Add the queue to another JNDI binding")
+ void removeJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
+
+
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2011-12-05 22:58:28 UTC (rev 11843)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2011-12-05 23:34:09 UTC (rev 11844)
@@ -173,6 +173,11 @@
{
jmsServerManager.addQueueToJndi(managedQueue.getName(), jndi);
}
+
+ public void removeJNDI(String jndi) throws Exception
+ {
+ jmsServerManager.removeQueueFromJNDI(managedQueue.getName(), jndi);
+ }
public String[] getJNDIBindings()
{
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2011-12-05 22:58:28 UTC (rev 11843)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2011-12-05 23:34:09 UTC (rev 11844)
@@ -91,7 +91,17 @@
{
jmsServerManager.addTopicToJndi(managedTopic.getName(), jndi);
}
+
+ /* (non-Javadoc)
+ * @see org.hornetq.api.jms.management.TopicControl#removeJNDI(java.lang.String)
+ */
+ public void removeJNDI(String jndi) throws Exception
+ {
+ jmsServerManager.removeTopicFromJNDI(managedTopic.getName(), jndi);
+ }
+
+
public String[] getJNDIBindings()
{
return jmsServerManager.getJNDIOnTopic(managedTopic.getName());
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2011-12-05 22:58:28 UTC (rev 11843)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2011-12-05 23:34:09 UTC (rev 11844)
@@ -298,6 +298,12 @@
{
return (String)proxy.invokeOperation("listConsumersAsJSON");
}
+
+ public void removeJNDI(String jndi) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
};
}
13 years
JBoss hornetq SVN: r11843 - branches/Branch_2_2_EAP/src/main/org/hornetq/ra/inflow.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 17:58:28 -0500 (Mon, 05 Dec 2011)
New Revision: 11843
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/inflow/HornetQActivation.java
Log:
JBPAPP-7329 - adding meta-data on MDBs
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/inflow/HornetQActivation.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/inflow/HornetQActivation.java 2011-12-05 21:19:58 UTC (rev 11842)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/inflow/HornetQActivation.java 2011-12-05 22:58:28 UTC (rev 11843)
@@ -368,6 +368,13 @@
spec.isUseLocalTx(),
spec.getTransactionTimeout());
+ result.addMetaData("resource-adapter", "inbound");
+ result.addMetaData("jms-session", "");
+ if (spec.getClientID() != null)
+ {
+ result.addMetaData("jms-client-id", spec.getClientID());
+ }
+
HornetQActivation.log.debug("Using queue connection " + result);
return result;
13 years
JBoss hornetq SVN: r11842 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 16:19:58 -0500 (Mon, 05 Dec 2011)
New Revision: 11842
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java
Log:
JBPAPP-7455 - reverting accidental commit
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java 2011-12-05 21:17:25 UTC (rev 11841)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java 2011-12-05 21:19:58 UTC (rev 11842)
@@ -13,7 +13,6 @@
package org.hornetq.core.paging.impl;
-import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -116,9 +115,9 @@
ArrayList<PagedMessage> messages = new ArrayList<PagedMessage>();
size.set((int)file.size());
+ // Using direct buffer, as described on https://jira.jboss.org/browse/HORNETQ-467
+ ByteBuffer buffer2 = ByteBuffer.allocateDirect(size.get());
- ByteBuffer buffer2 = allocateBuffer();
-
file.position(0);
file.read(buffer2);
@@ -176,38 +175,6 @@
return messages;
}
- /**
- * @return
- * @throws InterruptedException
- */
- private ByteBuffer allocateBuffer() throws InterruptedException
- {
- // Using direct buffer, as described on https://jira.jboss.org/browse/HORNETQ-467
- ByteBuffer buffer2 = null;
- try
- {
- buffer2 = ByteBuffer.allocateDirect(size.get());
- }
- catch (OutOfMemoryError error)
- {
- // This is a workaround for the way the JDK will deal with native buffers.
- // the main portion is outside of the VM heap
- // and the JDK will not have any reference about it to take GC into account
- // so we force a GC and try again.
- WeakReference<Object> obj = new WeakReference<Object>(new Object());
- long timeout = System.currentTimeMillis() + 5000;
- while (System.currentTimeMillis() > timeout && obj.get() != null)
- {
- System.gc();
- Thread.sleep(100);
- }
-
- buffer2 = ByteBuffer.allocateDirect(size.get());
-
- }
- return buffer2;
- }
-
public void write(final PagedMessage message) throws Exception
{
ByteBuffer buffer = fileFactory.newBuffer(message.getEncodeSize() + PageImpl.SIZE_RECORD);
13 years