JBoss hornetq SVN: r9970 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 22:53:59 -0500 (Wed, 01 Dec 2010)
New Revision: 9970
Modified:
trunk/build-maven.xml
trunk/pom.xml
Log:
upgrading netty
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2010-12-02 03:16:31 UTC (rev 9969)
+++ trunk/build-maven.xml 2010-12-02 03:53:59 UTC (rev 9970)
@@ -13,7 +13,7 @@
-->
<project default="upload" name="HornetQ">
- <property name="hornetq.version" value="2.2.0.CR1"/>
+ <property name="hornetq.version" value="2.2.0.QA1"/>
<property name="build.dir" value="build"/>
<property name="jars.dir" value="${build.dir}/jars"/>
@@ -152,7 +152,7 @@
<exec executable="mvn" dir="./build">
<arg value="install:install-file"/>
<!-- uncomment the following line to deploy to the JBoss 5 repository -->
- <!-- arg value="-Dmaven.repo.local=/work/eap-location/maven-repository"/ -->
+ <arg value="-Dmaven.repo.local=/work/eap/maven-repository"/>
<arg value="-DgroupId=org.hornetq"/>
<arg value="-DartifactId=${artifact.id}"/>
<arg value="-Dversion=${hornetq.version}"/>
@@ -164,7 +164,7 @@
<arg value="install:install-file"/>
<arg value="-DgroupId=org.hornetq"/>
<!-- uncomment the following line to deploy to the JBoss 5 repository -->
- <!-- arg value="-Dmaven.repo.local=/work/eap-location/maven-repository"/ -->
+ <arg value="-Dmaven.repo.local=/work/eap/maven-repository"/>
<arg value="-DartifactId=${artifact.id}"/>
<arg value="-Dversion=${hornetq.version}"/>
<arg value="-Dpackaging=jar"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-12-02 03:16:31 UTC (rev 9969)
+++ trunk/pom.xml 2010-12-02 03:53:59 UTC (rev 9970)
@@ -236,7 +236,7 @@
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.2.1.Final</version>
+ <version>3.2.3.Final</version>
</dependency>
<!--needed to compile the logging jar-->
<dependency>
14 years, 1 month
JBoss hornetq SVN: r9969 - trunk/src/main/org/hornetq/jms/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 22:16:31 -0500 (Wed, 01 Dec 2010)
New Revision: 9969
Modified:
trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
Log:
Changing connectionFactories for compatibility
Modified: trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java 2010-12-02 00:08:13 UTC (rev 9968)
+++ trunk/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java 2010-12-02 03:16:31 UTC (rev 9969)
@@ -14,6 +14,8 @@
package org.hornetq.jms.client;
import javax.jms.ConnectionFactory;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ServerLocator;
@@ -24,7 +26,7 @@
*
* @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
*/
-public class HornetQJMSConnectionFactory extends HornetQConnectionFactory implements ConnectionFactory
+public class HornetQJMSConnectionFactory extends HornetQConnectionFactory implements ConnectionFactory, TopicConnectionFactory, QueueConnectionFactory
{
private final static long serialVersionUID = -2810634789345348326L;
Modified: trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java 2010-12-02 00:08:13 UTC (rev 9968)
+++ trunk/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java 2010-12-02 03:16:31 UTC (rev 9969)
@@ -13,7 +13,12 @@
package org.hornetq.jms.client;
+import javax.jms.ConnectionFactory;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnectionFactory;
import javax.jms.XAConnectionFactory;
+import javax.jms.XAQueueConnectionFactory;
+import javax.jms.XATopicConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ServerLocator;
@@ -21,9 +26,11 @@
/**
* A class that represents a XAConnectionFactory.
*
+ * We consider the XAConnectionFactory to be the most complete possible option. It can be casted to any other connection factory since it is fully functional
+ *
* @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
*/
-public class HornetQXAConnectionFactory extends HornetQConnectionFactory implements XAConnectionFactory
+public class HornetQXAConnectionFactory extends HornetQConnectionFactory implements XAConnectionFactory, XATopicConnectionFactory, XAQueueConnectionFactory, ConnectionFactory, TopicConnectionFactory, QueueConnectionFactory
{
private static final long serialVersionUID = 743611571839154115L;
14 years, 1 month
JBoss hornetq SVN: r9968 - trunk/tests/joram-tests/src/org/hornetq/jms.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 19:08:13 -0500 (Wed, 01 Dec 2010)
New Revision: 9968
Modified:
trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java
trunk/tests/joram-tests/src/org/hornetq/jms/SpawnedJMSServer.java
Log:
fixing JORAM tests
Modified: trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java 2010-12-01 19:11:00 UTC (rev 9967)
+++ trunk/tests/joram-tests/src/org/hornetq/jms/HornetQAdmin.java 2010-12-02 00:08:13 UTC (rev 9968)
@@ -103,15 +103,20 @@
public void createConnectionFactory(final String name)
{
+ createConnection(name, 0);
+ }
+
+ private void createConnection(final String name, final int cfType)
+ {
try
{
invokeSyncOperation(ResourceNames.JMS_SERVER,
"createConnectionFactory",
name,
false,
- NettyConnectorFactory.class.getName(),
- new HashMap<String, Object>(),
- new String[] { name });
+ cfType,
+ "netty",
+ name);
}
catch (Exception e)
{
@@ -141,19 +146,7 @@
public void createQueueConnectionFactory(final String name)
{
- try
- {
- invokeSyncOperation(ResourceNames.JMS_SERVER,
- "createQueueConnectionFactory",
- name,
- NettyConnectorFactory.class.getName(),
- new HashMap<String, Object>(),
- new String[] { name });
- }
- catch (Exception e)
- {
- throw new IllegalStateException(e);
- }
+ createConnection(name, 1);
}
public void createTopic(final String name)
@@ -172,19 +165,7 @@
public void createTopicConnectionFactory(final String name)
{
- try
- {
- invokeSyncOperation(ResourceNames.JMS_SERVER,
- "createTopicConnectionFactory",
- name,
- NettyConnectorFactory.class.getName(),
- new HashMap<String, Object>(),
- new String[] { name });
- }
- catch (Exception e)
- {
- throw new IllegalStateException(e);
- }
+ createConnection(name, 2);
}
public void deleteConnectionFactory(final String name)
Modified: trunk/tests/joram-tests/src/org/hornetq/jms/SpawnedJMSServer.java
===================================================================
--- trunk/tests/joram-tests/src/org/hornetq/jms/SpawnedJMSServer.java 2010-12-01 19:11:00 UTC (rev 9967)
+++ trunk/tests/joram-tests/src/org/hornetq/jms/SpawnedJMSServer.java 2010-12-02 00:08:13 UTC (rev 9968)
@@ -23,6 +23,7 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.jms.server.JMSServerManager;
@@ -67,6 +68,9 @@
conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
conf.setSecurityEnabled(false);
conf.setFileDeploymentEnabled(false);
+
+
+ conf.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()));
// disable server persistence since JORAM tests do not restart server
final HornetQServer server = HornetQServers.newHornetQServer(conf, false);
14 years, 1 month
JBoss hornetq SVN: r9967 - trunk/tests/src/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 14:11:00 -0500 (Wed, 01 Dec 2010)
New Revision: 9967
Modified:
trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
removing eager thread leakage verification. Making to fail only the test that created the failure condition (not the whole testsuite)
Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 17:53:34 UTC (rev 9966)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 19:11:00 UTC (rev 9967)
@@ -35,6 +35,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
import javax.naming.Context;
@@ -97,6 +98,10 @@
private static final String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/hornetq-unit-test";
+
+ // There is a verification about thread leakages. We only fail a single thread when this happens
+ private static Set<Thread> alreadyFailedThread = new HashSet<Thread>();
+
// Static --------------------------------------------------------
protected static String getUDPDiscoveryAddress()
@@ -782,8 +787,9 @@
StackTraceElement[] stack = threadMap.get(thread);
for (StackTraceElement stackTraceElement : stack)
{
- if (stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
+ if (stackTraceElement.getMethodName().contains("getConnectionWithRetry") && !alreadyFailedThread.contains(thread))
{
+ alreadyFailedThread.add(thread);
System.out.println(threadDump(this.getName() + " has left threads running. Look at thread " +
thread.getName() +
" id = " +
14 years, 1 month
JBoss hornetq SVN: r9966 - trunk/tests/src/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 12:53:34 -0500 (Wed, 01 Dec 2010)
New Revision: 9966
Modified:
trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
small tweak
Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 17:49:16 UTC (rev 9965)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 17:53:34 UTC (rev 9966)
@@ -784,14 +784,12 @@
{
if (stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
{
- System.out.println(this.getName() + " has left threads running");
- System.out.println(threadDump("Thread : " + thread +
- ", name = " +
+ System.out.println(threadDump(this.getName() + " has left threads running. Look at thread " +
thread.getName() +
" id = " +
thread.getId() +
" has running locators on test " +
- this.getName()));
+ this.getName() + " on this following dump"));
fail("test left serverlocator running, this could effect other tests");
// System.exit(0);
}
14 years, 1 month
JBoss hornetq SVN: r9965 - trunk/tests/src/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-12-01 12:49:16 -0500 (Wed, 01 Dec 2010)
New Revision: 9965
Modified:
trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
adding thread dump information about failing tests
Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 14:45:00 UTC (rev 9964)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 17:49:16 UTC (rev 9965)
@@ -98,36 +98,33 @@
private static final String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/hornetq-unit-test";
// Static --------------------------------------------------------
-
-
+
protected static String getUDPDiscoveryAddress()
{
return System.getProperty("TEST-UDP-ADDRESS", "230.1.2.3");
}
-
+
protected static String getUDPDiscoveryAddress(int variant)
{
String value = getUDPDiscoveryAddress();
-
+
int posPoint = value.lastIndexOf('.');
-
- int last = Integer.valueOf( value.substring(posPoint + 1) );
-
+
+ int last = Integer.valueOf(value.substring(posPoint + 1));
+
return value.substring(0, posPoint + 1) + (last + variant);
}
-
+
public static int getUDPDiscoveryPort()
{
return Integer.parseInt(System.getProperty("TEST-UDP-PORT", "6750"));
}
-
public static int getUDPDiscoveryPort(final int variant)
{
return getUDPDiscoveryPort() + 1;
}
-
protected static JournalType getDefaultJournalType()
{
if (AsynchronousFileImpl.isLoaded())
@@ -139,7 +136,7 @@
return JournalType.NIO;
}
}
-
+
/**
* @param name
*/
@@ -172,14 +169,14 @@
public static void forceGC(Reference<?> ref, long timeout)
{
- long waitUntil = System.currentTimeMillis() + timeout;
+ long waitUntil = System.currentTimeMillis() + timeout;
// A loop that will wait GC, using the minimal time as possible
while (ref.get() != null && System.currentTimeMillis() < waitUntil)
{
ArrayList<String> list = new ArrayList<String>();
- for (int i = 0 ; i < 1000; i++)
+ for (int i = 0; i < 1000; i++)
{
- list.add("Some string with garbage with concatenation " + i);
+ list.add("Some string with garbage with concatenation " + i);
}
list.clear();
list = null;
@@ -242,6 +239,8 @@
out.println("Thread " + el.getKey() +
" name = " +
el.getKey().getName() +
+ " id = " +
+ el.getKey().getId() +
" group = " +
el.getKey().getThreadGroup());
out.println();
@@ -328,8 +327,9 @@
Assert.assertEquals("byte at index " + i, expected[i], actual[i]);
}
}
-
- public static void assertEqualsTransportConfigurations(final TransportConfiguration[] expected, final TransportConfiguration[] actual)
+
+ public static void assertEqualsTransportConfigurations(final TransportConfiguration[] expected,
+ final TransportConfiguration[] actual)
{
assertEquals(expected.length, actual.length);
for (int i = 0; i < expected.length; i++)
@@ -400,29 +400,29 @@
Assert.assertNotNull(o);
return o;
}
-
+
/**
* @param connectorConfigs
* @return
*/
- protected ArrayList<String> registerConnectors(final HornetQServer server, final List<TransportConfiguration> connectorConfigs)
+ protected ArrayList<String> registerConnectors(final HornetQServer server,
+ final List<TransportConfiguration> connectorConfigs)
{
- // The connectors need to be pre-configured at main config object but this method is taking TransportConfigurations directly
+ // The connectors need to be pre-configured at main config object but this method is taking
+ // TransportConfigurations directly
// So this will first register them at the config and then generate a list of objects
ArrayList<String> connectors = new ArrayList<String>();
for (TransportConfiguration tnsp : connectorConfigs)
{
String name = RandomUtil.randomString();
-
+
server.getConfiguration().getConnectorConfigurations().put(name, tnsp);
-
+
connectors.add(name);
}
return connectors;
}
-
-
protected static void checkFreePort(final int... ports)
{
for (int port : ports)
@@ -484,7 +484,7 @@
recreateDirectory(getLargeMessagesDir(testDir));
recreateDirectory(getClientLargeMessagesDir(testDir));
recreateDirectory(getTemporaryDir(testDir));
-
+
System.out.println("deleted " + testDir);
}
@@ -776,18 +776,24 @@
Assert.fail("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
}
-
- Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
+ Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
for (Thread thread : threadMap.keySet())
{
StackTraceElement[] stack = threadMap.get(thread);
for (StackTraceElement stackTraceElement : stack)
{
- if(stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
+ if (stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
{
System.out.println(this.getName() + " has left threads running");
+ System.out.println(threadDump("Thread : " + thread +
+ ", name = " +
+ thread.getName() +
+ " id = " +
+ thread.getId() +
+ " has running locators on test " +
+ this.getName()));
fail("test left serverlocator running, this could effect other tests");
- //System.exit(0);
+ // System.exit(0);
}
}
}
14 years, 1 month
JBoss hornetq SVN: r9964 - trunk/tests/src/org/hornetq/tests/integration/jms/cluster.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-12-01 09:45:00 -0500 (Wed, 01 Dec 2010)
New Revision: 9964
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
Log:
tidy up resoucres correctly
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-12-01 14:39:17 UTC (rev 9963)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-12-01 14:45:00 UTC (rev 9964)
@@ -119,16 +119,28 @@
jbcf.setReconnectAttempts(-1);
- Connection conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5);
+ Connection conn = null;
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ try
+ {
+ conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5);
- ClientSession coreSession = ((HornetQSession)sess).getCoreSession();
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- JMSUtil.crash(liveService, coreSession);
+ ClientSession coreSession = ((HornetQSession)sess).getCoreSession();
+ JMSUtil.crash(liveService, coreSession);
- assertNotNull(ctx2.lookup("/queue/queue1"));
+
+ assertNotNull(ctx2.lookup("/queue/queue1"));
+ }
+ finally
+ {
+ if(conn != null)
+ {
+ conn.close();
+ }
+ }
}
@@ -141,15 +153,27 @@
jbcf.setReconnectAttempts(-1);
- Connection conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5);
+ Connection conn = null;
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ try
+ {
+ conn = JMSUtil.createConnectionAndWaitForTopology(jbcf, 2, 5);
- ClientSession coreSession = ((HornetQSession)sess).getCoreSession();
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- JMSUtil.crash(liveService, coreSession);
+ ClientSession coreSession = ((HornetQSession)sess).getCoreSession();
- assertNotNull(ctx2.lookup("/topic/t1"));
+ JMSUtil.crash(liveService, coreSession);
+
+ assertNotNull(ctx2.lookup("/topic/t1"));
+ }
+ finally
+ {
+ if(conn != null)
+ {
+ conn.close();
+ }
+ }
}
public void testAutomaticFailover() throws Exception
14 years, 1 month
JBoss hornetq SVN: r9963 - trunk/tests/src/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-12-01 09:39:17 -0500 (Wed, 01 Dec 2010)
New Revision: 9963
Modified:
trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
moced erroneus thread check
Modified: trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-12-01 14:32:21 UTC (rev 9962)
+++ trunk/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-12-01 14:39:17 UTC (rev 9963)
@@ -98,20 +98,6 @@
{
System.exit(0);
}
- Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
- for (Thread thread : threadMap.keySet())
- {
- StackTraceElement[] stack = threadMap.get(thread);
- for (StackTraceElement stackTraceElement : stack)
- {
- if(stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
- {
- System.out.println(this.getName() + " has left threads running");
- fail("test left serverlocator running, this could effect other tests");
- //System.exit(0);
- }
- }
- }
}
protected static Map<String, Object> generateParams(final int node, final boolean netty)
Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 14:32:21 UTC (rev 9962)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-12-01 14:39:17 UTC (rev 9963)
@@ -776,21 +776,21 @@
Assert.fail("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
}
- /*Map<Thread, StackTraceElement[]> threads = Thread.getAllStackTraces();
- for (Thread thread : threads.keySet())
+
+ Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
+ for (Thread thread : threadMap.keySet())
{
- if(thread.isAlive())
+ StackTraceElement[] stack = threadMap.get(thread);
+ for (StackTraceElement stackTraceElement : stack)
{
- StackTraceElement[] elements = threads.get(thread);
- for (StackTraceElement element : elements)
+ if(stackTraceElement.getMethodName().contains("getConnectionWithRetry"))
{
- if(element.getMethodName().contains("getConnectionWithRetry"))
- {
- System.out.println("UnitTestCase.tearDown");
- }
+ System.out.println(this.getName() + " has left threads running");
+ fail("test left serverlocator running, this could effect other tests");
+ //System.exit(0);
}
}
- }*/
+ }
super.tearDown();
}
14 years, 1 month
JBoss hornetq SVN: r9962 - branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-12-01 09:32:21 -0500 (Wed, 01 Dec 2010)
New Revision: 9962
Modified:
branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
Log:
remove unused import
Modified: branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
===================================================================
--- branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java 2010-12-01 14:30:17 UTC (rev 9961)
+++ branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java 2010-12-01 14:32:21 UTC (rev 9962)
@@ -26,7 +26,6 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.BodyEncoder;
import org.hornetq.core.message.impl.MessageImpl;
-import org.hornetq.utils.HornetQBufferInputStream;
/**
*
14 years, 1 month
JBoss hornetq SVN: r9961 - in branches/Branch_Large_Message_Compression: src/main/org/hornetq/utils and 1 other directories.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-12-01 09:30:17 -0500 (Wed, 01 Dec 2010)
New Revision: 9961
Removed:
branches/Branch_Large_Message_Compression/src/main/org/hornetq/utils/GZipUtil.java
branches/Branch_Large_Message_Compression/tests/src/org/hornetq/tests/unit/util/GZipUtilTest.java
Modified:
branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
Log:
removed unused classes
Modified: branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
===================================================================
--- branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java 2010-12-01 14:25:42 UTC (rev 9960)
+++ branches/Branch_Large_Message_Compression/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java 2010-12-01 14:30:17 UTC (rev 9961)
@@ -26,7 +26,6 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.BodyEncoder;
import org.hornetq.core.message.impl.MessageImpl;
-import org.hornetq.utils.GZipUtil;
import org.hornetq.utils.HornetQBufferInputStream;
/**
Deleted: branches/Branch_Large_Message_Compression/src/main/org/hornetq/utils/GZipUtil.java
===================================================================
--- branches/Branch_Large_Message_Compression/src/main/org/hornetq/utils/GZipUtil.java 2010-12-01 14:25:42 UTC (rev 9960)
+++ branches/Branch_Large_Message_Compression/src/main/org/hornetq/utils/GZipUtil.java 2010-12-01 14:30:17 UTC (rev 9961)
@@ -1,418 +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;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-import org.hornetq.api.core.HornetQException;
-
-/**
- * A GZipUtil
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
- *
- */
-public class GZipUtil
-{
-
- public static InputStream createZipInputStream(InputStream input) throws HornetQException
- {
- try
- {
- return new GZipPipe(input, 1024);
- }
- catch (IOException e)
- {
- throw new HornetQException(HornetQException.LARGE_MESSAGE_ERROR_BODY, e.getMessage(), e);
- }
- }
-
- public static InputStream createUnZipInputStream(InputStream input) throws HornetQException
- {
- try
- {
- return new GZIPInputStream(input);
- }
- catch (IOException e)
- {
- throw new HornetQException(HornetQException.LARGE_MESSAGE_ERROR_BODY, e.getMessage(), e);
- }
- }
-
- public static OutputStream createZipOutputStream(OutputStream out) throws HornetQException
- {
- try
- {
- return new GZipOutput(out);
- }
- catch (IOException e)
- {
- throw new HornetQException(HornetQException.LARGE_MESSAGE_ERROR_BODY, e.getMessage(), e);
- }
- }
-
- public static class GZipOutput extends OutputStream
- {
- private OutputStream target;
- private GZIPInputStream zipIn;
- private DynamicInputStream receiver;
-
- public GZipOutput(OutputStream out) throws IOException
- {
- target = out;
- receiver = new DynamicInputStream(1024, 50);
- }
-
- public void write(int b) throws IOException
- {
- receiver.writeBuffer(b);
- }
-
- public void close() throws IOException
- {
- zipIn = new GZIPInputStream(receiver);
- byte[] buffer = new byte[1024];
- int n = zipIn.read(buffer);
- while (n != -1)
- {
- if (n > 0)
- {
- target.write(buffer, 0, n);
- }
- n = zipIn.read(buffer);
- }
- target.close();
- }
-
- }
-
- public static class DynamicInputStream extends InputStream
- {
- private List<byte[]> writeBuffer;
- private int bufferSize;
- private int counter, index;
- private int readIndex, readCounter;
-
- public DynamicInputStream(int size, int cache)
- {
- bufferSize = size;
- writeBuffer = new ArrayList<byte[]>(cache);
- for (int i = 0; i < cache; i++)
- {
- writeBuffer.add(new byte[size]);
- }
- counter = 0;
- index = 0;
- readIndex = 0;
- readCounter = 0;
- }
-
- //read the buffer. If buffer is empty, return -1
- public int read() throws IOException
- {
- int result = -1;
-
- if (index > readIndex)
- {
- result = writeBuffer.get(readIndex)[readCounter++] & 0xFF;
- if (readCounter == bufferSize)
- {
- readCounter = 0;
- readIndex ++;
- }
- }
- else if (index == readIndex)
- {
- if (counter > readCounter)
- {
- result = writeBuffer.get(readIndex)[readCounter++] & 0xFF;
- }
- }
- return result;
- }
-
- public void writeBuffer(int b)
- {
- writeBuffer.get(index)[counter++] = (byte)b;
- if (counter == bufferSize)
- {
- index++;
- if (index == writeBuffer.size())
- {
- writeBuffer.add(new byte[bufferSize]);
- }
- counter = 0;
- }
- }
-
- }
-
- /*
- * we keep a list of byte arrays. when writing, we start with the first array.
- * when getBuffer() is called, the returned value is subject to the following rules:
- *
- * 1. if not closed, return the last full array. then update flags and pointers.
- * 2. if closed, return all the remaining.
- */
- public static class DynamicOutputStream extends OutputStream
- {
-
- private List<byte[]> writeBuffer;
- private int bufferSize;
- private int counter, index;
- private int readIndex;
- private boolean closed;
-
- public DynamicOutputStream(int size, int cache)
- {
- bufferSize = size;
- writeBuffer = new ArrayList<byte[]>(cache);
- for (int i = 0; i < cache; i++)
- {
- writeBuffer.add(new byte[size]);
- }
- counter = 0;
- index = 0;
- readIndex = 0;
- closed = false;
- }
-
- public void write(int b) throws IOException
- {
- writeBuffer.get(index)[counter++] = (byte)b;
- if (counter == bufferSize)
- {
- index++;
- if (index == writeBuffer.size())
- {
- writeBuffer.add(new byte[bufferSize]);
- }
- counter = 0;
- }
- }
-
- public void close() throws IOException
- {
- closed = true;
- }
-
- /*
- * logic:
- * if index > readIndex, return readIndex, then readIndex++
- * if index == readIndex, then return zero length byte[]; if closed, return the remaining.
- *
- * if closed and no more data, returns null.
- */
- public byte[] getBuffer()
- {
- byte[] result = new byte[0];
- if (index > readIndex)
- {
- result = writeBuffer.get(readIndex);
- writeBuffer.set(readIndex, null);
- readIndex++;
- }
- else if (index == readIndex)
- {
- if (closed)
- {
- if (counter == 0)
- {
- result = null;
- }
- else
- {
- result = new byte[counter];
- System.arraycopy(writeBuffer.get(index), 0, result, 0, result.length);
- counter = 0;
- }
- }
- }
- return result;
- }
- }
-
- public static class GZipPipe extends InputStream
- {
- private InputStream input;
- private byte[] readBuffer;
- private GZIPOutputStream zipOut;
- private DynamicOutputStream receiver;
- private int readPointer;
- private byte[] buffer;
-
- public GZipPipe(InputStream raw, int size) throws IOException
- {
- input = raw;
- readBuffer = new byte[size];
- receiver = new DynamicOutputStream(size, 50);
- zipOut = new GZIPOutputStream(receiver);
- readPointer = 0;
- buffer = read1();
- }
-
- public int read() throws IOException
- {
- if (buffer == null)
- {
- return -1;
- }
-
- int val = buffer[readPointer] & 0xFF;
- readPointer++;
- if (readPointer == buffer.length)
- {
- buffer = read1();
- readPointer = 0;
- }
-
- return val;
- }
-
- public byte[] read1() throws IOException
- {
- byte[] result = receiver.getBuffer();
- if (result == null)
- {
- return null;
- }
- else if (result.length > 0)
- {
- return result;
- }
-
- int n = input.read(readBuffer);
- while (true)
- {
- if (n > 0)
- {
- zipOut.write(readBuffer, 0, n);
- result = receiver.getBuffer();
- if ((result != null) && (result.length > 0))
- {
- break;
- }
- n = input.read(readBuffer);
- }
- else
- {
- zipOut.close();
- result = receiver.getBuffer();
- break;
- }
- }
- return result;
- }
- }
-
- public static void main(String[] args) throws HornetQException, IOException
- {
- long begin = System.currentTimeMillis();
-/*
- FileInputStream input = new FileInputStream("/home/howard/tmp/jbm.log.1");
- FileOutputStream output = new FileOutputStream("/home/howard/tmp/output3.zip");
- GZIPOutputStream zipOut = new GZIPOutputStream(output);
-
- byte[] buffer = new byte[1024];
-
- int n = input.read(buffer);
-
- int counter = 0;
-
- while (n > 0)
- {
- zipOut.write(buffer, 0, n);
- counter += n;
- n = input.read(buffer);
- }
- zipOut.close();
-
- System.out.println("----total output: " + counter);
-*/
- zip();
-/*
- FileInputStream input = new FileInputStream("/home/howard/tmp/jbm.log.1");
- FileOutputStream output = new FileOutputStream("/home/howard/tmp/output.zip");
- ExecutorService service = Executors.newCachedThreadPool();
- InputStream result = GZipUtil.pipeGZip(input, true, service);
-
- byte[] buffer = new byte[2048];
- int n = result.read(buffer);
- System.out.println("got first data");
-
- while (n > 0)
- {
- output.write(buffer);
- n = result.read(buffer);
- }
-*/
- long end = System.currentTimeMillis();
-
-
- System.out.println("done. time: " + (end - begin));
- }
-
- public static void zip() throws IOException
- {
- FileInputStream input = new FileInputStream("/home/howard/tmp/jbm.log.1");
- FileOutputStream output = new FileOutputStream("/home/howard/tmp/myzip.zip");
- GZipPipe pipe = new GZipPipe(input, 2048);
-
- byte[] buffer = new byte[2048];
-
- int n = pipe.read(buffer);
-
- while (n != -1)
- {
- if (n > 0)
- {
- output.write(buffer, 0, n);
- }
- n = pipe.read(buffer);
- }
-
- output.close();
- }
-
- public static void unzip() throws IOException
- {
- FileInputStream input = new FileInputStream("/home/howard/tmp/myzip.zip");
- FileOutputStream output = new FileOutputStream("/home/howard/tmp/myzip.out");
-
- GZIPInputStream zipIn = new GZIPInputStream(input);
-
- byte[] buffer = new byte[1024];
-
- int n = zipIn.read(buffer);
-
- while (n > 0)
- {
- //System.out.println("buffer size: " + buffer.length);
- output.write(buffer, 0, n);
- n = zipIn.read(buffer);
- }
-
- output.close();
- }
-
-}
Deleted: branches/Branch_Large_Message_Compression/tests/src/org/hornetq/tests/unit/util/GZipUtilTest.java
===================================================================
--- branches/Branch_Large_Message_Compression/tests/src/org/hornetq/tests/unit/util/GZipUtilTest.java 2010-12-01 14:25:42 UTC (rev 9960)
+++ branches/Branch_Large_Message_Compression/tests/src/org/hornetq/tests/unit/util/GZipUtilTest.java 2010-12-01 14:30:17 UTC (rev 9961)
@@ -1,242 +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.tests.unit.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Random;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-
-import org.hornetq.core.logging.Logger;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.GZipUtil;
-import org.hornetq.utils.GZipUtil.GZipPipe;
-
-/**
- * A GZipUtilTest
- *
- * @author Howard Gao
- *
- *
- */
-public class GZipUtilTest extends UnitTestCase
-{
- private static final Logger log = Logger.getLogger(GZipUtilTest.class);
-
- //create a 10M file, zip it into another file
- //then unzip it and compare the result with original file
- public void testZipFunction() throws Exception
- {
- this.recreateDirectory(this.getTestDir());
-
- File originalFile = new File(this.getTestDir(), "gzipUtilTest_file.txt");
- File zippedFile = new File(this.getTestDir(), "gzipUtilTest_file.zip");
-
- FileOutputStream originalOut = new FileOutputStream(originalFile);
- FileOutputStream zippedOut = new FileOutputStream(zippedFile);
-
- //now create the file
- Random r = new Random();
- final int size = 1024 * 10;
- byte[] writeBuffer = new byte[1024];
-
- for (int i = 0; i < size; i++)
- {
- int b = r.nextInt(256);
- for (int j = 0; j < 1024; j++)
- {
- writeBuffer[j] = (byte)b;
- }
- originalOut.write(writeBuffer);
- }
- originalOut.close();
-
- //now zip it
- GZipPipe pipe = new GZipPipe(new FileInputStream(originalFile), 2048);
- byte[] buffer = new byte[2048];
-
- int n = pipe.read(buffer);
- while (n != -1)
- {
- if (n > 0)
- {
- zippedOut.write(buffer, 0, n);
- }
- n = pipe.read(buffer);
- }
- zippedOut.close();
-
- //now unzip it and compare
- log.debug("zipped file Size: " + zippedFile.length());
- GZIPInputStream zippedInput = new GZIPInputStream(new FileInputStream(zippedFile));
- FileInputStream originalInput = new FileInputStream(originalFile);
-
- ArrayList<Integer> fromZip = new ArrayList<Integer>();
- ArrayList<Integer> original = new ArrayList<Integer>();
-
- byte[] readBuffer = new byte[2048];
- int count = zippedInput.read(readBuffer);
-
- while (count != -1)
- {
- for (int i = 0; i < count; i++)
- {
- fromZip.add(readBuffer[i] & 0xFF);
- }
- count = zippedInput.read(readBuffer);
- }
- zippedInput.close();
-
- count = originalInput.read(readBuffer);
- while (count != -1)
- {
- for (int i = 0; i < count; i++)
- {
- original.add(readBuffer[i] & 0xFF);
- }
- count = originalInput.read(readBuffer);
- }
- originalInput.close();
-
- log.debug("fromZip: " + fromZip.size());
- compareByteArray(fromZip, original);
-
- originalFile.delete();
- zippedFile.delete();
- }
-
- //create a 10M file, zip it into another file
- //load it into an input stream and feed to the
- //GZipOutput. Then compare the result
- public void testUnzipFunction() throws Exception
- {
- this.recreateDirectory(this.getTestDir());
-
- File originalFile = new File(this.getTestDir(), "gzipUtilTest_file1.txt");
- File zippedFile = new File(this.getTestDir(), "gzipUtilTest_file1.zip");
- File unzippedFile = new File(this.getTestDir(), "gzipUtilTest_unzipped.txt");
-
- FileOutputStream originalOut = new FileOutputStream(originalFile);
- FileOutputStream zippedOut = new FileOutputStream(zippedFile);
-
- //now create the file
- Random r = new Random();
- final int size = 1024 * 10;
- byte[] writeBuffer = new byte[1024];
-
- for (int i = 0; i < size; i++)
- {
- int b = r.nextInt(256);
- for (int j = 0; j < 1024; j++)
- {
- writeBuffer[j] = (byte)b;
- }
- originalOut.write(writeBuffer);
- }
- originalOut.close();
-
- log.info("file created.");
-
- //now zip it
- GZIPOutputStream gzipOut = new GZIPOutputStream(zippedOut);
- FileInputStream originalIn = new FileInputStream(originalFile);
-
- byte[] buffer = new byte[2048];
-
- int n = originalIn.read(buffer);
- while (n != -1)
- {
- if (n > 0)
- {
- gzipOut.write(buffer, 0, n);
- }
- n = originalIn.read(buffer);
- }
- gzipOut.close();
-
- log.info("file zipped.");
-
- //get a zipped input stream
- FileInputStream zippedInput = new FileInputStream(zippedFile);
-
- FileOutputStream unzipOut = new FileOutputStream(unzippedFile);
-
- OutputStream newOut = GZipUtil.createZipOutputStream(unzipOut);
-
- n = zippedInput.read(buffer);
- while (n != -1)
- {
- if (n > 0)
- {
- newOut.write(buffer, 0, n);
- }
- n = zippedInput.read(buffer);
- }
- newOut.close();
-
- log.info("file unzipped");
-
- //compare original and unzipped
- FileInputStream originalInput = new FileInputStream(originalFile);
- FileInputStream unzippedInput = new FileInputStream(unzippedFile);
-
- ArrayList<Integer> fromZip = new ArrayList<Integer>();
- ArrayList<Integer> original = new ArrayList<Integer>();
-
- byte[] readBuffer = new byte[2048];
- int count = originalInput.read(readBuffer);
-
- while (count != -1)
- {
- for (int i = 0; i < count; i++)
- {
- original.add(readBuffer[i] & 0xFF);
- }
- count = originalInput.read(readBuffer);
- }
- originalInput.close();
-
- count = unzippedInput.read(readBuffer);
-
- while (count != -1)
- {
- for (int i = 0; i < count; i++)
- {
- fromZip.add(readBuffer[i] & 0xFF);
- }
- count = unzippedInput.read(readBuffer);
- }
- unzippedInput.close();
-
- compareByteArray(fromZip, original);
-
- originalFile.delete();
- zippedFile.delete();
- unzippedFile.delete();
- }
-
- private void compareByteArray(ArrayList<Integer> b1, ArrayList<Integer> b2)
- {
- assertEquals(b1.size(), b2.size());
-
- for (int i = 0; i < b1.size(); i++)
- {
- assertEquals(b1.get(i), b2.get(i));
- }
- }
-}
14 years, 1 month