[jboss-cvs] JBoss Messaging SVN: r2686 - in trunk: docs/examples/http/etc and 27 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 15 04:47:20 EDT 2007
Author: timfox
Date: 2007-05-15 04:47:20 -0400 (Tue, 15 May 2007)
New Revision: 2686
Added:
trunk/src/main/org/jboss/jms/delegate/IDBlock.java
trunk/src/main/org/jboss/jms/tx/MessagingXid.java
trunk/src/main/org/jboss/jms/wireformat/JMSWireFormat.java
trunk/src/main/org/jboss/messaging/util/Version.java
Removed:
trunk/src/main/org/jboss/jms/server/Version.java
trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
trunk/src/main/org/jboss/messaging/core/plugin/IDBlock.java
trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java
trunk/tests/src/org/jboss/test/messaging/tools/client/
Modified:
trunk/build-messaging.xml
trunk/docs/examples/http/etc/messaging-http-service.xml
trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
trunk/src/etc/server/default/deploy/remoting-service.xml
trunk/src/main/org/jboss/jms/client/JBossConnectionMetaData.java
trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
trunk/src/main/org/jboss/jms/client/state/BrowserState.java
trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
trunk/src/main/org/jboss/jms/client/state/HierarchicalState.java
trunk/src/main/org/jboss/jms/client/state/ProducerState.java
trunk/src/main/org/jboss/jms/client/state/SessionState.java
trunk/src/main/org/jboss/jms/delegate/ConnectionEndpoint.java
trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
trunk/src/main/org/jboss/jms/tx/TransactionRequest.java
trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java
trunk/src/main/org/jboss/jms/wireformat/ConnectionGetPreparedTransactionsResponse.java
trunk/src/main/org/jboss/messaging/core/plugin/IDManager.java
trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
trunk/tests/etc/log4j.trace.xml
trunk/tests/etc/log4j.xml
trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/IdManagerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
Log:
Client jar
Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/build-messaging.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -454,14 +454,21 @@
<attribute name="Class-path"
value="jboss-aop.jar jboss-remoting.jar jboss-serialization.jar javassist.jar trove.jar jboss-common-core.jar jboss-common-client.jar jboss-j2ee.jar jboss-j2se.jar jnp-client.jar concurrent.jar log4j.jar commons-logging.jar"/>
</manifest>
- <fileset dir="${build.classes}">
+ <fileset dir="${build.classes}">
+ <!-- This structur is temporary until we partition the classes
+ properly between client and server -->
<include name="org/jboss/jms/client/**/*.class"/>
<include name="org/jboss/jms/delegate/**/*.class"/>
<include name="org/jboss/jms/destination/**/*.class"/>
<include name="org/jboss/jms/message/**/*.class"/>
<include name="org/jboss/jms/tx/**/*.class"/>
<include name="org/jboss/jms/referenceable/*.class"/>
- <include name="org/jboss/messaging/util/**/*.class"/>
+ <include name="org/jboss/jms/exception/*.class"/>
+ <include name="org/jboss/jms/wireformat/*.class"/>
+ <include name="org/jboss/messaging/util/**/*.class"/>
+ <include name="org/jboss/messaging/core/message/**/*.class"/>
+ <!-- Need server socket wrapper -->
+ <include name="org/jboss/jms/server/remoting/**/*.class"/>
</fileset>
<fileset dir="${build.etc}">
<include name="VERSION"/>
Modified: trunk/docs/examples/http/etc/messaging-http-service.xml
===================================================================
--- trunk/docs/examples/http/etc/messaging-http-service.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/docs/examples/http/etc/messaging-http-service.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -17,8 +17,8 @@
<attribute name="Configuration">
<config>
<invoker transport="http">
- <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
- <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+ <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+ <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="serializationtype" isParam="true">jms</attribute>
<attribute name="dataType" isParam="true">jms</attribute>
<attribute name="socket.check_connection" isParam="true">false</attribute>
Modified: trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml
===================================================================
--- trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/docs/examples/secure-socket/etc/messaging-secure-socket-service.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -15,8 +15,8 @@
<attribute name="Configuration">
<config>
<invoker transport="sslbisocket">
- <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
- <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+ <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+ <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="serializationtype" isParam="true">jms</attribute>
<attribute name="dataType" isParam="true">jms</attribute>
<attribute name="socket.check_connection" isParam="true">false</attribute>
Modified: trunk/src/etc/server/default/deploy/remoting-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/remoting-service.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/etc/server/default/deploy/remoting-service.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -17,8 +17,8 @@
<attribute name="Configuration">
<config>
<invoker transport="bisocket">
- <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
- <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
+ <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+ <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="serializationtype" isParam="true">jms</attribute>
<attribute name="dataType" isParam="true">jms</attribute>
<attribute name="socket.check_connection" isParam="true">false</attribute>
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionMetaData.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionMetaData.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionMetaData.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -21,15 +21,15 @@
*/
package org.jboss.jms.client;
-import org.jboss.jms.server.Version;
-
+import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
-import java.io.Serializable;
import javax.jms.ConnectionMetaData;
import javax.jms.JMSException;
+import org.jboss.messaging.util.Version;
+
/**
* Connection metadata
*
Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -25,27 +25,27 @@
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.jms.client.delegate.ClientBrowserDelegate;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.ClientConsumerDelegate;
import org.jboss.jms.client.delegate.ClientProducerDelegate;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.delegate.ClientBrowserDelegate;
+import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.state.BrowserState;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.ConsumerState;
import org.jboss.jms.client.state.HierarchicalState;
import org.jboss.jms.client.state.ProducerState;
import org.jboss.jms.client.state.SessionState;
+import org.jboss.jms.delegate.CreateConnectionResult;
import org.jboss.jms.delegate.ProducerDelegate;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.MessageIdGenerator;
import org.jboss.jms.message.MessageIdGeneratorFactory;
-import org.jboss.jms.server.Version;
-import org.jboss.jms.delegate.CreateConnectionResult;
import org.jboss.logging.Logger;
+import org.jboss.messaging.util.Version;
/**
* Maintains the hierarchy of parent and child state objects. For each delegate, this interceptor
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -29,9 +29,9 @@
import org.jboss.jms.client.plugin.LoadBalancingPolicy;
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
import org.jboss.jms.delegate.CreateConnectionResult;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.jms.exception.MessagingNetworkFailureException;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.plugin.IDBlock;
/**
* A ClientClusteredConnectionFactoryDelegate.
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -36,8 +36,9 @@
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.state.HierarchicalState;
import org.jboss.jms.delegate.ConnectionDelegate;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.server.Version;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.jms.tx.TransactionRequest;
import org.jboss.jms.wireformat.CloseRequest;
@@ -52,8 +53,7 @@
import org.jboss.jms.wireformat.ConnectionStopRequest;
import org.jboss.jms.wireformat.RequestSupport;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.plugin.IDBlock;
-import org.jboss.messaging.core.tx.MessagingXid;
+import org.jboss.messaging.util.Version;
/**
* The client-side Connection delegate class.
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -35,11 +35,11 @@
import org.jboss.jms.delegate.CreateConnectionResult;
import org.jboss.jms.exception.MessagingNetworkFailureException;
import org.jboss.jms.server.ServerPeer;
-import org.jboss.jms.server.Version;
-import org.jboss.jms.server.remoting.JMSWireFormat;
import org.jboss.jms.wireformat.ConnectionFactoryCreateConnectionDelegateRequest;
import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest;
+import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.jms.wireformat.ResponseSupport;
+import org.jboss.messaging.util.Version;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
Modified: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -25,7 +25,7 @@
import java.util.Map;
import org.jboss.jms.server.ServerPeer;
-import org.jboss.jms.server.remoting.JMSWireFormat;
+import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
Modified: trunk/src/main/org/jboss/jms/client/state/BrowserState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/BrowserState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/BrowserState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,7 +24,7 @@
import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.delegate.BrowserDelegate;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.server.Version;
+import org.jboss.messaging.util.Version;
/**
* State corresponding to a browser. This state is acessible inside aspects/interceptors.
Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -32,10 +32,10 @@
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
import org.jboss.jms.message.MessageIdGenerator;
-import org.jboss.jms.server.Version;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
+import org.jboss.messaging.util.Version;
import EDU.oswego.cs.dl.util.concurrent.SyncSet;
import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
Modified: trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -29,8 +29,9 @@
import org.jboss.jms.client.remoting.MessageCallbackHandler;
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.server.Version;
+import org.jboss.messaging.util.Version;
+
/**
* State corresponding to a Consumer. This state is acessible inside aspects/interceptors.
*
Modified: trunk/src/main/org/jboss/jms/client/state/HierarchicalState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/HierarchicalState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/HierarchicalState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -21,11 +21,11 @@
*/
package org.jboss.jms.client.state;
+import java.util.Set;
+
import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.server.Version;
+import org.jboss.messaging.util.Version;
-import java.util.Set;
-
/**
* Any state that is Hierarchical in nature implements this interface (e.g. a connection has child
* sessions). Or, a session has child consumers, producers and browsers.
Modified: trunk/src/main/org/jboss/jms/client/state/ProducerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ProducerState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/ProducerState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -26,9 +26,9 @@
import javax.jms.DeliveryMode;
import javax.jms.Destination;
+import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.delegate.ProducerDelegate;
-import org.jboss.jms.server.Version;
-import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.messaging.util.Version;
/**
* State corresponding to a producer. This state is acessible inside aspects/interceptors.
Modified: trunk/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -39,15 +39,15 @@
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.delegate.DelegateSupport;
import org.jboss.jms.client.remoting.MessageCallbackHandler;
+import org.jboss.jms.delegate.DeliveryInfo;
+import org.jboss.jms.delegate.DeliveryRecovery;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.server.Version;
-import org.jboss.jms.delegate.DeliveryInfo;
-import org.jboss.jms.delegate.DeliveryRecovery;
import org.jboss.jms.tx.MessagingXAResource;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
import org.jboss.messaging.util.ClearableQueuedExecutor;
+import org.jboss.messaging.util.Version;
import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
Modified: trunk/src/main/org/jboss/jms/delegate/ConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/delegate/ConnectionEndpoint.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/delegate/ConnectionEndpoint.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,10 +24,8 @@
import javax.jms.JMSException;
import org.jboss.jms.client.Closeable;
-import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
-import org.jboss.messaging.core.plugin.IDBlock;
-import org.jboss.messaging.core.tx.MessagingXid;
/**
Copied: trunk/src/main/org/jboss/jms/delegate/IDBlock.java (from rev 2680, trunk/src/main/org/jboss/messaging/core/plugin/IDBlock.java)
===================================================================
--- trunk/src/main/org/jboss/jms/delegate/IDBlock.java (rev 0)
+++ trunk/src/main/org/jboss/jms/delegate/IDBlock.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.delegate;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+
+import org.jboss.messaging.util.Streamable;
+
+/**
+ *
+ * A IDBlock.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class IDBlock implements Streamable
+{
+ private long low;
+ private long high;
+
+ public IDBlock()
+ {
+ }
+
+ public IDBlock(long low, long high)
+ {
+ this.low = low;
+ this.high = high;
+ }
+
+ public long getLow()
+ {
+ return low;
+ }
+
+ public long getHigh()
+ {
+ return high;
+ }
+
+ public void read(DataInputStream in) throws Exception
+ {
+ low = in.readLong();
+ high = in.readLong();
+ }
+
+ public void write(DataOutputStream out) throws Exception
+ {
+ out.writeLong(low);
+ out.writeLong(high);
+ }
+
+ public String toString()
+ {
+ return "IDBlock[" + low + "-" + high + "]";
+ }
+
+}
Modified: trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/message/MessageIdGenerator.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,8 +24,8 @@
import javax.jms.JMSException;
import org.jboss.jms.delegate.ConnectionEndpoint;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.plugin.IDBlock;
/**
*
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -49,8 +49,8 @@
import org.jboss.jms.server.messagecounter.MessageCounterManager;
import org.jboss.jms.server.plugin.contract.JMSUserManager;
import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
-import org.jboss.jms.server.remoting.JMSWireFormat;
import org.jboss.jms.server.security.SecurityMetadataStore;
+import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.memory.MemoryManager;
@@ -69,6 +69,7 @@
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.messaging.util.ExceptionUtil;
import org.jboss.messaging.util.Util;
+import org.jboss.messaging.util.Version;
import org.jboss.mx.loading.UnifiedClassLoader3;
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.system.ServiceCreator;
Deleted: trunk/src/main/org/jboss/jms/server/Version.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/Version.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/Version.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -1,280 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.jms.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.Properties;
-
-import org.jboss.logging.Logger;
-import org.jboss.messaging.util.Streamable;
-
-/**
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class Version implements Streamable, Serializable
-{
- // Constants -----------------------------------------------------
-
- private static final long serialVersionUID = 3605477218138273630L;
-
- private static final Logger log = Logger.getLogger(Version.class);
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private String jmsVersion = "UNKNOWN";
- private int jmsMajorVersion = 0;
- private int jmsMinorVersion = 0;
- private String jmsProviderName = "UNKNOWN";
- private String providerVersion = "UNKNOWN";
- private int providerMajorVersion = 0;
- private int providerMinorVersion = 0;
- private byte providerIncrementingVersion;
-
- private static Version singleton;
-
- // Constructors --------------------------------------------------
-
- /**
- * @param versionFile - the name of the version file. It must be available as resource to the
- * current class loader.
- */
-
- private Version(String versionFile)
- {
- load(versionFile);
- }
-
- // Public -------------------------------------------------------
-
- public Version()
- {
- }
-
- public static synchronized Version instance()
- {
- if (singleton == null)
- {
- singleton = new Version("VERSION");
- }
- return singleton;
- }
-
- public String getJMSVersion()
- {
- return jmsVersion;
- }
-
- public int getJMSMajorVersion()
- {
- return jmsMajorVersion;
- }
-
- public int getJMSMinorVersion()
- {
- return jmsMinorVersion;
- }
-
- public String getJMSProviderName()
- {
- return jmsProviderName;
- }
-
- public String getProviderVersion()
- {
- return providerVersion;
- }
-
- public int getProviderMajorVersion()
- {
- return providerMajorVersion;
- }
-
- public int getProviderMinorVersion()
- {
- return providerMinorVersion;
- }
-
- public byte getProviderIncrementingVersion()
- {
- return providerIncrementingVersion;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private void load(String versionFile)
- {
- InputStream is = null;
-
- try
- {
- Properties versionInfo = new Properties();
-
- //Note we use the context classloader so this works in a scoped deployment
-
- is = Thread.currentThread().getContextClassLoader().getResourceAsStream(versionFile);
-
- versionInfo.load(is);
-
- String s;
-
- s = versionInfo.getProperty("jboss.messaging.jmsVersion");
- if (s != null)
- {
- jmsVersion = s;
- }
-
- s = versionInfo.getProperty("jboss.messaging.jmsMajorVersion");
- if (s != null)
- {
- try
- {
- jmsMajorVersion = Integer.parseInt(s);
- }
- catch(Exception e)
- {
- log.debug("failed to parse jmsMajorVersion: " + s);
- }
- }
-
- s = versionInfo.getProperty("jboss.messaging.jmsMinorVersion");
- if (s != null)
- {
- try
- {
- jmsMinorVersion = Integer.parseInt(s);
- }
- catch(Exception e)
- {
- log.debug("failed to parse jmsMinorVersion: " + s);
- }
- }
-
- s = versionInfo.getProperty("jboss.messaging.jmsProviderName");
- if (s != null)
- {
- jmsProviderName = s;
- }
-
- s = versionInfo.getProperty("jboss.messaging.providerVersion");
- if (s != null)
- {
- providerVersion = s;
- }
-
- s = versionInfo.getProperty("jboss.messaging.providerMajorVersion");
- if (s != null)
- {
- try
- {
- providerMajorVersion = Integer.parseInt(s);
- }
- catch(Exception e)
- {
- log.debug("failed to parse providerMajorVersion: " + s);
- }
- }
-
- s = versionInfo.getProperty("jboss.messaging.providerMinorVersion");
- if (s != null)
- {
- try
- {
- providerMinorVersion = Integer.parseInt(s);
- }
- catch(Exception e)
- {
- log.debug("failed to parse providerMinorVersion: " + s);
- }
- }
-
- s = versionInfo.getProperty("jboss.messaging.providerIncrementingVersion");
- if (s != null)
- {
- try
- {
- providerIncrementingVersion = Byte.parseByte(s);
- }
- catch(Exception e)
- {
- log.debug("failed to parse providerIncrementingVersion: " + s);
- }
- }
- }
- catch(Exception e)
- {
- log.warn("Unable to read version info: " + e.getMessage());
- log.debug("Unable to read version info", e);
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch(Exception e)
- {
- log.debug("failed to close the version info stream", e);
- }
- }
- }
- }
-
- public void read(DataInputStream in) throws Exception
- {
- jmsVersion = in.readUTF();
-
- jmsMajorVersion = in.readInt();
-
- jmsMinorVersion = in.readInt();
-
- jmsProviderName = in.readUTF();
-
- providerVersion = in.readUTF();
-
- providerMajorVersion = in.readInt();
-
- providerMinorVersion = in.readInt();
-
- providerIncrementingVersion = in.readByte();
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- out.writeUTF(jmsVersion);
-
- out.writeInt(jmsMajorVersion);
-
- out.writeInt(jmsMinorVersion);
-
- out.writeUTF(jmsProviderName);
-
- out.writeUTF(providerVersion);
-
- out.writeInt(providerMajorVersion);
-
- out.writeInt(providerMinorVersion);
-
- out.writeByte(providerIncrementingVersion);
- }
-
- // Inner classes -------------------------------------------------
-}
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -45,16 +45,16 @@
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
import org.jboss.jms.server.ConnectionFactoryManager;
import org.jboss.jms.server.ServerPeer;
-import org.jboss.jms.server.Version;
import org.jboss.jms.server.endpoint.ServerConnectionFactoryEndpoint;
import org.jboss.jms.server.endpoint.advised.ConnectionFactoryAdvised;
-import org.jboss.messaging.util.JNDIUtil;
import org.jboss.jms.wireformat.Dispatcher;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.plugin.contract.FailoverMapper;
import org.jboss.messaging.core.plugin.contract.ReplicationListener;
import org.jboss.messaging.core.plugin.contract.Replicator;
import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
+import org.jboss.messaging.util.JNDIUtil;
+import org.jboss.messaging.util.Version;
/**
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -36,6 +36,7 @@
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.remoting.CallbackManager;
import org.jboss.jms.delegate.ConnectionEndpoint;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.JBossMessage;
@@ -45,21 +46,20 @@
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.advised.SessionAdvised;
import org.jboss.jms.server.messagecounter.MessageCounter;
-import org.jboss.jms.server.remoting.JMSWireFormat;
import org.jboss.jms.tx.ClientTransaction;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
import org.jboss.jms.tx.ClientTransaction.SessionTxState;
-import org.jboss.messaging.util.ExceptionUtil;
import org.jboss.jms.wireformat.Dispatcher;
+import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageReference;
-import org.jboss.messaging.core.plugin.IDBlock;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PostOffice;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.core.tx.Transaction;
import org.jboss.messaging.core.tx.TransactionRepository;
+import org.jboss.messaging.util.ExceptionUtil;
import org.jboss.messaging.util.Util;
import org.jboss.remoting.Client;
import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/endpoint/advised/ConnectionAdvised.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,10 +24,10 @@
import javax.jms.JMSException;
import org.jboss.jms.delegate.ConnectionEndpoint;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
-import org.jboss.messaging.core.plugin.IDBlock;
-import org.jboss.messaging.core.tx.MessagingXid;
/**
* The server-side advised instance corresponding to a Connection. It is bound to the AOP
Deleted: trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -1,343 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.server.remoting;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.jms.wireformat.ClientDelivery;
-import org.jboss.jms.wireformat.ConnectionFactoryUpdate;
-import org.jboss.jms.wireformat.NullResponse;
-import org.jboss.jms.wireformat.PacketSupport;
-import org.jboss.jms.wireformat.PolledCallbacksDelivery;
-import org.jboss.jms.wireformat.RequestSupport;
-import org.jboss.jms.wireformat.ResponseSupport;
-import org.jboss.jms.wireformat.SerializedPacket;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvocationResponse;
-import org.jboss.remoting.callback.Callback;
-import org.jboss.remoting.invocation.InternalInvocation;
-import org.jboss.remoting.invocation.OnewayInvocation;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
-
-/**
- * We do not use Java or JBoss serialization to send data over the wire. Serialization adds
- * considerable overhead in terms of the amount of data sent (it adds class information plus block
- * data information) which significantly degrades performance.
- *
- * Instead we define a customer wire format that minimises the amount of data sent.
- *
- * The only exception to this rule is when sending an ObjectMessage which contains a user defined
- * object whose type is only known at run-time. In this case we use serialization.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JMSWireFormat implements Marshaller, UnMarshaller
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final long serialVersionUID = -7646123424863782043L;
-
- private static final Logger log = Logger.getLogger(JMSWireFormat.class);
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- protected boolean trace;
-
- // Constructors ---------------------------------------------------------------------------------
-
- public JMSWireFormat()
- {
- trace = log.isTraceEnabled();
- }
-
- // Marshaller implementation --------------------------------------------------------------------
-
- public void write(Object obj, OutputStream out) throws IOException
- {
- if (trace) { log.trace("Writing " + obj); }
-
- DataOutputStream dos;
-
- if (out instanceof DataOutputStream)
- {
- //For non HTTP transports - we should ALWAYS be passed a DataOutputStream
- //We do this by specifying socket wrapper classes on the locator uri
- dos = (DataOutputStream)out;
-
- if (trace) { log.trace("Stream is a DataOutputStream"); }
- }
- else
- {
- // Further sanity check
- if (out instanceof ObjectOutputStream)
- {
- throw new IllegalArgumentException("Invalid stream - are you sure you have " +
- "configured socket wrappers?");
- }
-
- // This would be the case for the HTTP transport for example. Wrap the stream.
-
- //FIXME - remoting should be fixed to allow socket wrappers to be specified for
- //all transports - not just socket
- //until then we have no choice but to create a wrapping stream on every invocation
- //for HTTP transport
- dos = new DataOutputStream(out);
-
- if (trace) { log.trace("Stream is NOT a DataOutputStream - must be using HTTP transport"); }
- }
-
- try
- {
- PacketSupport packet = null;
-
- if (obj instanceof InvocationRequest)
- {
- InvocationRequest req = (InvocationRequest)obj;
-
- Object param = req.getParameter();
-
- if (param instanceof PacketSupport)
- {
- // A JBM invocation
- packet = (PacketSupport)param;
-
- if (trace) { log.trace("JBM Request"); }
- }
- else if (param instanceof OnewayInvocation)
- {
- if (trace) { log.trace("It's a OnewayInvocation"); }
-
- // This is fucking horrendous - remoting should not force us to deal with
- // its internal objects
-
- // Hmmm... hidden somewhere in the depths of this crap there must be the callback,
- // The search begins....
-
- OnewayInvocation oneWay = (OnewayInvocation)param;
-
- param = oneWay.getParameters()[0];
-
- if (param instanceof RequestSupport)
- {
- //A JBM invocation being sent one way (e.g. changeRate, send)
-
- if (trace) { log.trace("JBM oneway request"); }
-
- packet = (PacketSupport)param;
- }
- else if (param instanceof InternalInvocation)
- {
- InternalInvocation ii = (InternalInvocation)param;
-
- Object[] params = ii.getParameters();
-
- if (trace) { log.trace("Params is " + params); }
-
- if (params != null && params.length > 0 && params[0] instanceof Callback)
- {
- Callback callback = (Callback) params[0];
-
- if (trace) { log.trace("It's a callback: " + callback); }
-
- if (callback.getParameter() instanceof ClientDelivery)
- {
- packet = (ClientDelivery)callback.getParameter();
-
- if (trace) { log.trace("Message delivery callback"); }
- }
- else if (callback.getParameter() instanceof ConnectionFactoryUpdate)
- {
- packet = (ConnectionFactoryUpdate)callback.getParameter();
-
- if (trace) { log.trace("Connection factory update callback"); }
- }
- }
- }
- else
- {
- throw new IllegalArgumentException("Invalid request param " + param);
- }
- }
- else
- {
- //Some other remoting internal thing, e.g. PING, DISCONNECT, add listener etc
-
- packet = new SerializedPacket(req);
- }
- }
- else if (obj instanceof InvocationResponse)
- {
- InvocationResponse resp = (InvocationResponse)obj;
-
- Object param = resp.getResult();
-
- if (param instanceof ResponseSupport)
- {
- // A JBM invocation response
-
- packet = (ResponseSupport)param;
-
- if (trace) { log.trace("JBM Response"); }
- }
- else if (param instanceof List)
- {
- // List of polled Callbacks, this is how messages are delivered when using
- // polled callbacks e.g. the HTTP transport
-
- packet = new PolledCallbacksDelivery((List)param, resp.getSessionId());
- }
- else if (param == null)
- {
- // Null response
- packet = new NullResponse();
-
- if (trace) { log.trace("Null Response"); }
- }
- else
- {
- // Return value from some remoting internal invocation e.g. PONG - return value from PING
- packet = new SerializedPacket(obj);
- }
- }
- else
- {
- //Actually this should never occur
- packet = new SerializedPacket(obj);
- }
-
- if (trace) { log.trace("Writing packet: " + packet); }
-
- packet.write(dos);
-
- if (trace) { log.trace("Wrote packet"); }
- }
- catch (Exception e)
- {
- log.error("Failed to write packet", e);
- IOException e2 = new IOException(e.getMessage());
- e2.setStackTrace(e.getStackTrace());
- throw e2;
- }
- }
-
- public Marshaller cloneMarshaller() throws CloneNotSupportedException
- {
- return this;
- }
-
- // UnMarshaller implementation ------------------------------------------------------------------
-
- public Object read(InputStream in, Map map) throws IOException, ClassNotFoundException
- {
- if (trace) { log.trace("Reading"); }
-
- DataInputStream dis;
-
- if (in instanceof DataInputStream)
- {
- //For non HTTP transports - we should ALWAYS be passed a DataInputStream
- //We do this by specifying socket wrapper classes on the locator uri
- dis = (DataInputStream)in;
-
- if (trace) { log.trace("Stream is already DataInputStream :)"); }
- }
- else
- {
- // Further sanity check
- if (in instanceof ObjectInputStream)
- {
- throw new IllegalArgumentException("Invalid stream - are you sure you have " +
- "configured socket wrappers?");
- }
-
- // This would be the case for the HTTP transport for example. Wrap the stream
-
- //FIXME Ideally remoting would let us wrap this before invoking the marshaller
- // but this does not appear to be possible
- dis = new DataInputStream(in);
-
- if (trace) { log.trace("Stream is NOT DataInputStream - must be using HTTP transport"); }
- }
-
- int id = dis.readInt();
-
- PacketSupport packet = PacketSupport.createPacket(id);
-
- if (trace) { log.trace("Created packet " + packet); }
-
- try
- {
- if (trace) { log.trace("Reading packet"); }
-
- packet.read(dis);
-
- if (trace) { log.trace("Read packet"); }
- }
- catch (Exception e)
- {
- IOException e2 = new IOException(e.getMessage());
- e2.setStackTrace(e.getStackTrace());
- throw e2;
- }
-
- Object payload = packet.getPayload();
-
- if (trace) { log.trace("Returning payload: " + payload); }
-
- return payload;
- }
-
- public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
- {
- return this;
- }
-
- public void setClassLoader(ClassLoader classloader)
- {
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-}
Modified: trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -29,7 +29,6 @@
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.exception.MessagingXAException;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
/**
* An XAResource implementation.
Copied: trunk/src/main/org/jboss/jms/tx/MessagingXid.java (from rev 2680, trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java)
===================================================================
--- trunk/src/main/org/jboss/jms/tx/MessagingXid.java (rev 0)
+++ trunk/src/main/org/jboss/jms/tx/MessagingXid.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.tx;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.Serializable;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.util.Streamable;
+
+/**
+ *
+ * Xid implementation
+ *
+ * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ *
+ * @version $Revision 1.1 $
+ */
+public class MessagingXid implements Xid, Serializable, Streamable
+{
+ private static final long serialVersionUID = -1893120702576869245L;
+
+ private byte[] branchQualifier;
+
+ private int formatId;
+
+ private byte[] globalTransactionId;
+
+ private int hash;
+
+ private boolean hashCalculated;
+
+ public byte[] getBranchQualifier()
+ {
+ return branchQualifier;
+ }
+
+ public int getFormatId()
+ {
+ return formatId;
+ }
+
+ public byte[] getGlobalTransactionId()
+ {
+ return globalTransactionId;
+ }
+
+ //For serialization
+ public MessagingXid()
+ {
+ }
+
+ public MessagingXid(byte[] branchQualifier, int formatId, byte[] globalTransactionId)
+ {
+ this.branchQualifier = branchQualifier;
+ this.formatId = formatId;
+ this.globalTransactionId = globalTransactionId;
+ }
+
+ //Copy constructor
+ public MessagingXid(Xid other)
+ {
+ this.branchQualifier = copyBytes(other.getBranchQualifier());
+ this.formatId = other.getFormatId();
+ this.globalTransactionId = copyBytes(other.getGlobalTransactionId());
+ }
+
+ public int hashCode()
+ {
+ if (!hashCalculated)
+ {
+ calcHash();
+ }
+ return hash;
+ }
+
+ public boolean equals(Object other)
+ {
+ if (!(other instanceof Xid))
+ {
+ return false;
+ }
+ Xid xother = (Xid)other;
+ if (xother.getFormatId() != formatId)
+ {
+ return false;
+ }
+ if (xother.getBranchQualifier().length != this.branchQualifier.length)
+ {
+ return false;
+ }
+ if (xother.getGlobalTransactionId().length != this.globalTransactionId.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < this.branchQualifier.length; i++)
+ {
+ byte[] otherBQ = xother.getBranchQualifier();
+ if (this.branchQualifier[i] != otherBQ[i])
+ {
+ return false;
+ }
+ }
+ for (int i = 0; i < this.globalTransactionId.length; i++)
+ {
+ byte[] otherGtx = xother.getGlobalTransactionId();
+ if (this.globalTransactionId[i] != otherGtx[i])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String toString()
+ {
+ return getClass().getName() + "(GID: " + stringRep(getGlobalTransactionId()) +
+ ", Branch: " + stringRep(getBranchQualifier()) +
+ ", Format: " + getFormatId() + ")";
+ }
+
+ private String stringRep(byte[] bytes)
+ {
+ StringBuffer buff = new StringBuffer();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ byte b = bytes[i];
+
+ buff.append(b);
+
+ if (i != bytes.length - 1)
+ {
+ buff.append('.');
+ }
+ }
+
+ return buff.toString();
+ }
+
+ public void read(DataInputStream in) throws Exception
+ {
+ int len = in.readInt();
+ branchQualifier = new byte[len];
+ in.readFully(branchQualifier);
+
+ formatId = in.readInt();
+
+ len = in.readInt();
+ globalTransactionId = new byte[len];
+ in.readFully(globalTransactionId);
+ }
+
+ public void write(DataOutputStream out) throws Exception
+ {
+ out.writeInt(branchQualifier.length);
+ out.write(branchQualifier);
+
+ out.writeInt(formatId);
+
+ out.writeInt(globalTransactionId.length);
+ out.write(globalTransactionId);
+ }
+
+ private void calcHash()
+ {
+ byte[] hashBytes = new byte[branchQualifier.length + globalTransactionId.length + 4];
+ System.arraycopy(branchQualifier, 0, hashBytes, 0, branchQualifier.length);
+ System.arraycopy(globalTransactionId, 0, hashBytes, branchQualifier.length, globalTransactionId.length);
+ byte[] intBytes = new byte[4];
+ for (int i = 0; i < 4; i++)
+ {
+ intBytes[i] = (byte)((formatId >> (i * 8)) % 0xFF);
+ }
+ System.arraycopy(intBytes, 0, hashBytes, branchQualifier.length + globalTransactionId.length, 4);
+ String s = new String(hashBytes);
+ hash = s.hashCode();
+ hashCalculated = true;
+ }
+
+ private byte[] copyBytes(byte[] other)
+ {
+ byte[] bytes = new byte[other.length];
+
+ System.arraycopy(other, 0, bytes, 0, other.length);
+
+ return bytes;
+ }
+
+}
Modified: trunk/src/main/org/jboss/jms/tx/TransactionRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/TransactionRequest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/tx/TransactionRequest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -26,7 +26,6 @@
import javax.transaction.xa.Xid;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.Streamable;
/**
Modified: trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionGetIDBlockResponse.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,7 +24,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.messaging.core.plugin.IDBlock;
+import org.jboss.jms.delegate.IDBlock;
/**
*
Modified: trunk/src/main/org/jboss/jms/wireformat/ConnectionGetPreparedTransactionsResponse.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionGetPreparedTransactionsResponse.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionGetPreparedTransactionsResponse.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -24,7 +24,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import org.jboss.messaging.core.tx.MessagingXid;
+import org.jboss.jms.tx.MessagingXid;
/**
*
Copied: trunk/src/main/org/jboss/jms/wireformat/JMSWireFormat.java (from rev 2680, trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java)
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/JMSWireFormat.java (rev 0)
+++ trunk/src/main/org/jboss/jms/wireformat/JMSWireFormat.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -0,0 +1,335 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.wireformat;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvocationResponse;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.invocation.InternalInvocation;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+
+/**
+ * We do not use Java or JBoss serialization to send data over the wire. Serialization adds
+ * considerable overhead in terms of the amount of data sent (it adds class information plus block
+ * data information) which significantly degrades performance.
+ *
+ * Instead we define a customer wire format that minimises the amount of data sent.
+ *
+ * The only exception to this rule is when sending an ObjectMessage which contains a user defined
+ * object whose type is only known at run-time. In this case we use serialization.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class JMSWireFormat implements Marshaller, UnMarshaller
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -7646123424863782043L;
+
+ private static final Logger log = Logger.getLogger(JMSWireFormat.class);
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ protected boolean trace;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public JMSWireFormat()
+ {
+ trace = log.isTraceEnabled();
+ }
+
+ // Marshaller implementation --------------------------------------------------------------------
+
+ public void write(Object obj, OutputStream out) throws IOException
+ {
+ if (trace) { log.trace("Writing " + obj); }
+
+ DataOutputStream dos;
+
+ if (out instanceof DataOutputStream)
+ {
+ //For non HTTP transports - we should ALWAYS be passed a DataOutputStream
+ //We do this by specifying socket wrapper classes on the locator uri
+ dos = (DataOutputStream)out;
+
+ if (trace) { log.trace("Stream is a DataOutputStream"); }
+ }
+ else
+ {
+ // Further sanity check
+ if (out instanceof ObjectOutputStream)
+ {
+ throw new IllegalArgumentException("Invalid stream - are you sure you have " +
+ "configured socket wrappers?");
+ }
+
+ // This would be the case for the HTTP transport for example. Wrap the stream.
+
+ //FIXME - remoting should be fixed to allow socket wrappers to be specified for
+ //all transports - not just socket
+ //until then we have no choice but to create a wrapping stream on every invocation
+ //for HTTP transport
+ dos = new DataOutputStream(out);
+
+ if (trace) { log.trace("Stream is NOT a DataOutputStream - must be using HTTP transport"); }
+ }
+
+ try
+ {
+ PacketSupport packet = null;
+
+ if (obj instanceof InvocationRequest)
+ {
+ InvocationRequest req = (InvocationRequest)obj;
+
+ Object param = req.getParameter();
+
+ if (param instanceof PacketSupport)
+ {
+ // A JBM invocation
+ packet = (PacketSupport)param;
+
+ if (trace) { log.trace("JBM Request"); }
+ }
+ else if (param instanceof OnewayInvocation)
+ {
+ if (trace) { log.trace("It's a OnewayInvocation"); }
+
+ // This is fucking horrendous - remoting should not force us to deal with
+ // its internal objects
+
+ // Hmmm... hidden somewhere in the depths of this crap there must be the callback,
+ // The search begins....
+
+ OnewayInvocation oneWay = (OnewayInvocation)param;
+
+ param = oneWay.getParameters()[0];
+
+ if (param instanceof RequestSupport)
+ {
+ //A JBM invocation being sent one way (e.g. changeRate, send)
+
+ if (trace) { log.trace("JBM oneway request"); }
+
+ packet = (PacketSupport)param;
+ }
+ else if (param instanceof InternalInvocation)
+ {
+ InternalInvocation ii = (InternalInvocation)param;
+
+ Object[] params = ii.getParameters();
+
+ if (trace) { log.trace("Params is " + params); }
+
+ if (params != null && params.length > 0 && params[0] instanceof Callback)
+ {
+ Callback callback = (Callback) params[0];
+
+ if (trace) { log.trace("It's a callback: " + callback); }
+
+ if (callback.getParameter() instanceof ClientDelivery)
+ {
+ packet = (ClientDelivery)callback.getParameter();
+
+ if (trace) { log.trace("Message delivery callback"); }
+ }
+ else if (callback.getParameter() instanceof ConnectionFactoryUpdate)
+ {
+ packet = (ConnectionFactoryUpdate)callback.getParameter();
+
+ if (trace) { log.trace("Connection factory update callback"); }
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid request param " + param);
+ }
+ }
+ else
+ {
+ //Some other remoting internal thing, e.g. PING, DISCONNECT, add listener etc
+
+ packet = new SerializedPacket(req);
+ }
+ }
+ else if (obj instanceof InvocationResponse)
+ {
+ InvocationResponse resp = (InvocationResponse)obj;
+
+ Object param = resp.getResult();
+
+ if (param instanceof ResponseSupport)
+ {
+ // A JBM invocation response
+
+ packet = (ResponseSupport)param;
+
+ if (trace) { log.trace("JBM Response"); }
+ }
+ else if (param instanceof List)
+ {
+ // List of polled Callbacks, this is how messages are delivered when using
+ // polled callbacks e.g. the HTTP transport
+
+ packet = new PolledCallbacksDelivery((List)param, resp.getSessionId());
+ }
+ else if (param == null)
+ {
+ // Null response
+ packet = new NullResponse();
+
+ if (trace) { log.trace("Null Response"); }
+ }
+ else
+ {
+ // Return value from some remoting internal invocation e.g. PONG - return value from PING
+ packet = new SerializedPacket(obj);
+ }
+ }
+ else
+ {
+ //Actually this should never occur
+ packet = new SerializedPacket(obj);
+ }
+
+ if (trace) { log.trace("Writing packet: " + packet); }
+
+ packet.write(dos);
+
+ if (trace) { log.trace("Wrote packet"); }
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to write packet", e);
+ IOException e2 = new IOException(e.getMessage());
+ e2.setStackTrace(e.getStackTrace());
+ throw e2;
+ }
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return this;
+ }
+
+ // UnMarshaller implementation ------------------------------------------------------------------
+
+ public Object read(InputStream in, Map map) throws IOException, ClassNotFoundException
+ {
+ if (trace) { log.trace("Reading"); }
+
+ DataInputStream dis;
+
+ if (in instanceof DataInputStream)
+ {
+ //For non HTTP transports - we should ALWAYS be passed a DataInputStream
+ //We do this by specifying socket wrapper classes on the locator uri
+ dis = (DataInputStream)in;
+
+ if (trace) { log.trace("Stream is already DataInputStream :)"); }
+ }
+ else
+ {
+ // Further sanity check
+ if (in instanceof ObjectInputStream)
+ {
+ throw new IllegalArgumentException("Invalid stream - are you sure you have " +
+ "configured socket wrappers?");
+ }
+
+ // This would be the case for the HTTP transport for example. Wrap the stream
+
+ //FIXME Ideally remoting would let us wrap this before invoking the marshaller
+ // but this does not appear to be possible
+ dis = new DataInputStream(in);
+
+ if (trace) { log.trace("Stream is NOT DataInputStream - must be using HTTP transport"); }
+ }
+
+ int id = dis.readInt();
+
+ PacketSupport packet = PacketSupport.createPacket(id);
+
+ if (trace) { log.trace("Created packet " + packet); }
+
+ try
+ {
+ if (trace) { log.trace("Reading packet"); }
+
+ packet.read(dis);
+
+ if (trace) { log.trace("Read packet"); }
+ }
+ catch (Exception e)
+ {
+ IOException e2 = new IOException(e.getMessage());
+ e2.setStackTrace(e.getStackTrace());
+ throw e2;
+ }
+
+ Object payload = packet.getPayload();
+
+ if (trace) { log.trace("Returning payload: " + payload); }
+
+ return payload;
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return this;
+ }
+
+ public void setClassLoader(ClassLoader classloader)
+ {
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+}
Deleted: trunk/src/main/org/jboss/messaging/core/plugin/IDBlock.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/IDBlock.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/messaging/core/plugin/IDBlock.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.core.plugin;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-import org.jboss.messaging.util.Streamable;
-
-/**
- *
- * A IDBlock.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class IDBlock implements Streamable
-{
- private long low;
- private long high;
-
- public IDBlock()
- {
- }
-
- public IDBlock(long low, long high)
- {
- this.low = low;
- this.high = high;
- }
-
- public long getLow()
- {
- return low;
- }
-
- public long getHigh()
- {
- return high;
- }
-
- public void read(DataInputStream in) throws Exception
- {
- low = in.readLong();
- high = in.readLong();
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- out.writeLong(low);
- out.writeLong(high);
- }
-
- public String toString()
- {
- return "IDBlock[" + low + "-" + high + "]";
- }
-
-}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/IDManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/IDManager.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/messaging/core/plugin/IDManager.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -21,6 +21,7 @@
*/
package org.jboss.messaging.core.plugin;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.plugin.contract.MessagingComponent;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -49,13 +49,13 @@
import javax.transaction.TransactionManager;
import javax.transaction.xa.Xid;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageFactory;
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.message.MessageSupport;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.core.tx.PreparedTxInfo;
import org.jboss.messaging.core.tx.Transaction;
import org.jboss.messaging.core.tx.TxCallback;
Deleted: trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -1,212 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.core.tx;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.Serializable;
-
-import javax.transaction.xa.Xid;
-
-import org.jboss.messaging.util.Streamable;
-
-/**
- *
- * Xid implementation
- *
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
- *
- * @version $Revision 1.1 $
- */
-public class MessagingXid implements Xid, Serializable, Streamable
-{
- private static final long serialVersionUID = -1893120702576869245L;
-
- private byte[] branchQualifier;
-
- private int formatId;
-
- private byte[] globalTransactionId;
-
- private int hash;
-
- private boolean hashCalculated;
-
- public byte[] getBranchQualifier()
- {
- return branchQualifier;
- }
-
- public int getFormatId()
- {
- return formatId;
- }
-
- public byte[] getGlobalTransactionId()
- {
- return globalTransactionId;
- }
-
- //For serialization
- public MessagingXid()
- {
- }
-
- public MessagingXid(byte[] branchQualifier, int formatId, byte[] globalTransactionId)
- {
- this.branchQualifier = branchQualifier;
- this.formatId = formatId;
- this.globalTransactionId = globalTransactionId;
- }
-
- //Copy constructor
- public MessagingXid(Xid other)
- {
- this.branchQualifier = copyBytes(other.getBranchQualifier());
- this.formatId = other.getFormatId();
- this.globalTransactionId = copyBytes(other.getGlobalTransactionId());
- }
-
- public int hashCode()
- {
- if (!hashCalculated)
- {
- calcHash();
- }
- return hash;
- }
-
- public boolean equals(Object other)
- {
- if (!(other instanceof Xid))
- {
- return false;
- }
- Xid xother = (Xid)other;
- if (xother.getFormatId() != formatId)
- {
- return false;
- }
- if (xother.getBranchQualifier().length != this.branchQualifier.length)
- {
- return false;
- }
- if (xother.getGlobalTransactionId().length != this.globalTransactionId.length)
- {
- return false;
- }
- for (int i = 0; i < this.branchQualifier.length; i++)
- {
- byte[] otherBQ = xother.getBranchQualifier();
- if (this.branchQualifier[i] != otherBQ[i])
- {
- return false;
- }
- }
- for (int i = 0; i < this.globalTransactionId.length; i++)
- {
- byte[] otherGtx = xother.getGlobalTransactionId();
- if (this.globalTransactionId[i] != otherGtx[i])
- {
- return false;
- }
- }
- return true;
- }
-
- public String toString()
- {
- return getClass().getName() + "(GID: " + stringRep(getGlobalTransactionId()) +
- ", Branch: " + stringRep(getBranchQualifier()) +
- ", Format: " + getFormatId() + ")";
- }
-
- private String stringRep(byte[] bytes)
- {
- StringBuffer buff = new StringBuffer();
- for (int i = 0; i < bytes.length; i++)
- {
- byte b = bytes[i];
-
- buff.append(b);
-
- if (i != bytes.length - 1)
- {
- buff.append('.');
- }
- }
-
- return buff.toString();
- }
-
- public void read(DataInputStream in) throws Exception
- {
- int len = in.readInt();
- branchQualifier = new byte[len];
- in.readFully(branchQualifier);
-
- formatId = in.readInt();
-
- len = in.readInt();
- globalTransactionId = new byte[len];
- in.readFully(globalTransactionId);
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- out.writeInt(branchQualifier.length);
- out.write(branchQualifier);
-
- out.writeInt(formatId);
-
- out.writeInt(globalTransactionId.length);
- out.write(globalTransactionId);
- }
-
- private void calcHash()
- {
- byte[] hashBytes = new byte[branchQualifier.length + globalTransactionId.length + 4];
- System.arraycopy(branchQualifier, 0, hashBytes, 0, branchQualifier.length);
- System.arraycopy(globalTransactionId, 0, hashBytes, branchQualifier.length, globalTransactionId.length);
- byte[] intBytes = new byte[4];
- for (int i = 0; i < 4; i++)
- {
- intBytes[i] = (byte)((formatId >> (i * 8)) % 0xFF);
- }
- System.arraycopy(intBytes, 0, hashBytes, branchQualifier.length + globalTransactionId.length, 4);
- String s = new String(hashBytes);
- hash = s.hashCode();
- hashCalculated = true;
- }
-
- private byte[] copyBytes(byte[] other)
- {
- byte[] bytes = new byte[other.length];
-
- System.arraycopy(other, 0, bytes, 0, other.length);
-
- return bytes;
- }
-
-}
Copied: trunk/src/main/org/jboss/messaging/util/Version.java (from rev 2680, trunk/src/main/org/jboss/jms/server/Version.java)
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Version.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/util/Version.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -0,0 +1,279 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.util;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Properties;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class Version implements Streamable, Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 3605477218138273630L;
+
+ private static final Logger log = Logger.getLogger(Version.class);
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String jmsVersion = "UNKNOWN";
+ private int jmsMajorVersion = 0;
+ private int jmsMinorVersion = 0;
+ private String jmsProviderName = "UNKNOWN";
+ private String providerVersion = "UNKNOWN";
+ private int providerMajorVersion = 0;
+ private int providerMinorVersion = 0;
+ private byte providerIncrementingVersion;
+
+ private static Version singleton;
+
+ // Constructors --------------------------------------------------
+
+ /**
+ * @param versionFile - the name of the version file. It must be available as resource to the
+ * current class loader.
+ */
+
+ private Version(String versionFile)
+ {
+ load(versionFile);
+ }
+
+ // Public -------------------------------------------------------
+
+ public Version()
+ {
+ }
+
+ public static synchronized Version instance()
+ {
+ if (singleton == null)
+ {
+ singleton = new Version("VERSION");
+ }
+ return singleton;
+ }
+
+ public String getJMSVersion()
+ {
+ return jmsVersion;
+ }
+
+ public int getJMSMajorVersion()
+ {
+ return jmsMajorVersion;
+ }
+
+ public int getJMSMinorVersion()
+ {
+ return jmsMinorVersion;
+ }
+
+ public String getJMSProviderName()
+ {
+ return jmsProviderName;
+ }
+
+ public String getProviderVersion()
+ {
+ return providerVersion;
+ }
+
+ public int getProviderMajorVersion()
+ {
+ return providerMajorVersion;
+ }
+
+ public int getProviderMinorVersion()
+ {
+ return providerMinorVersion;
+ }
+
+ public byte getProviderIncrementingVersion()
+ {
+ return providerIncrementingVersion;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private void load(String versionFile)
+ {
+ InputStream is = null;
+
+ try
+ {
+ Properties versionInfo = new Properties();
+
+ //Note we use the context classloader so this works in a scoped deployment
+
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(versionFile);
+
+ versionInfo.load(is);
+
+ String s;
+
+ s = versionInfo.getProperty("jboss.messaging.jmsVersion");
+ if (s != null)
+ {
+ jmsVersion = s;
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.jmsMajorVersion");
+ if (s != null)
+ {
+ try
+ {
+ jmsMajorVersion = Integer.parseInt(s);
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to parse jmsMajorVersion: " + s);
+ }
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.jmsMinorVersion");
+ if (s != null)
+ {
+ try
+ {
+ jmsMinorVersion = Integer.parseInt(s);
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to parse jmsMinorVersion: " + s);
+ }
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.jmsProviderName");
+ if (s != null)
+ {
+ jmsProviderName = s;
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.providerVersion");
+ if (s != null)
+ {
+ providerVersion = s;
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.providerMajorVersion");
+ if (s != null)
+ {
+ try
+ {
+ providerMajorVersion = Integer.parseInt(s);
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to parse providerMajorVersion: " + s);
+ }
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.providerMinorVersion");
+ if (s != null)
+ {
+ try
+ {
+ providerMinorVersion = Integer.parseInt(s);
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to parse providerMinorVersion: " + s);
+ }
+ }
+
+ s = versionInfo.getProperty("jboss.messaging.providerIncrementingVersion");
+ if (s != null)
+ {
+ try
+ {
+ providerIncrementingVersion = Byte.parseByte(s);
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to parse providerIncrementingVersion: " + s);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ log.warn("Unable to read version info: " + e.getMessage());
+ log.debug("Unable to read version info", e);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch(Exception e)
+ {
+ log.debug("failed to close the version info stream", e);
+ }
+ }
+ }
+ }
+
+ public void read(DataInputStream in) throws Exception
+ {
+ jmsVersion = in.readUTF();
+
+ jmsMajorVersion = in.readInt();
+
+ jmsMinorVersion = in.readInt();
+
+ jmsProviderName = in.readUTF();
+
+ providerVersion = in.readUTF();
+
+ providerMajorVersion = in.readInt();
+
+ providerMinorVersion = in.readInt();
+
+ providerIncrementingVersion = in.readByte();
+ }
+
+ public void write(DataOutputStream out) throws Exception
+ {
+ out.writeUTF(jmsVersion);
+
+ out.writeInt(jmsMajorVersion);
+
+ out.writeInt(jmsMinorVersion);
+
+ out.writeUTF(jmsProviderName);
+
+ out.writeUTF(providerVersion);
+
+ out.writeInt(providerMajorVersion);
+
+ out.writeInt(providerMinorVersion);
+
+ out.writeByte(providerIncrementingVersion);
+ }
+
+ // Inner classes -------------------------------------------------
+}
Modified: trunk/tests/etc/log4j.trace.xml
===================================================================
--- trunk/tests/etc/log4j.trace.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/etc/log4j.trace.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -75,7 +75,7 @@
<priority value="DEBUG"/>
</category>
- <category name="org.jboss.jms.server.remoting.JMSWireFormat">
+ <category name="org.jboss.jms.wireformat.JMSWireFormat">
<priority value="DEBUG"/>
</category>
Modified: trunk/tests/etc/log4j.xml
===================================================================
--- trunk/tests/etc/log4j.xml 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/etc/log4j.xml 2007-05-15 08:47:20 UTC (rev 2686)
@@ -84,7 +84,7 @@
<priority value="DEBUG"/>
</category>
- <category name="org.jboss.jms.server.remoting.JMSWireFormat">
+ <category name="org.jboss.jms.wireformat.JMSWireFormat">
<!-- <priority value="TRACE" class="org.jboss.logging.XLevel"/> -->
<priority value="DEBUG"/>
</category>
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -32,6 +32,7 @@
import javax.sql.DataSource;
import javax.transaction.TransactionManager;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.messaging.core.Channel;
import org.jboss.messaging.core.Delivery;
import org.jboss.messaging.core.DeliveryObserver;
@@ -42,7 +43,6 @@
import org.jboss.messaging.core.plugin.IDManager;
import org.jboss.messaging.core.plugin.JDBCPersistenceManager;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.core.tx.Transaction;
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.test.messaging.MessagingTestCase;
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/IdManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/IdManagerTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/IdManagerTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.messaging.core.plugin;
-import org.jboss.messaging.core.plugin.IDBlock;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.messaging.core.plugin.IDManager;
import org.jboss.messaging.core.plugin.JDBCPersistenceManager;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -362,8 +362,8 @@
"<attribute name=\"Configuration\">\n" +
"<config>\n" +
"<invoker transport=\"socket\">\n" +
- "<attribute name=\"marshaller\" isParam=\"true\">org.jboss.jms.server.remoting.JMSWireFormat</attribute>\n" +
- "<attribute name=\"unmarshaller\" isParam=\"true\">org.jboss.jms.server.remoting.JMSWireFormat</attribute>\n" +
+ "<attribute name=\"marshaller\" isParam=\"true\">org.jboss.jms.wireformat.JMSWireFormat</attribute>\n" +
+ "<attribute name=\"unmarshaller\" isParam=\"true\">org.jboss.jms.wireformat.JMSWireFormat</attribute>\n" +
"<attribute name=\"serializationtype\" isParam=\"true\">jms</attribute>\n" +
"<attribute name=\"dataType\" isParam=\"true\">jms</attribute>\n" +
"<attribute name=\"serverBindPort\">" + port +"</attribute>\n" +
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -39,12 +39,13 @@
import org.jboss.jms.delegate.DefaultAck;
import org.jboss.jms.delegate.DefaultCancel;
import org.jboss.jms.delegate.DeliveryRecovery;
+import org.jboss.jms.delegate.IDBlock;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTemporaryQueue;
import org.jboss.jms.destination.JBossTopic;
import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.server.remoting.JMSWireFormat;
import org.jboss.jms.tx.ClientTransaction;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
import org.jboss.jms.wireformat.BrowserHasNextMessageRequest;
import org.jboss.jms.wireformat.BrowserHasNextMessageResponse;
@@ -72,6 +73,7 @@
import org.jboss.jms.wireformat.ConnectionStartRequest;
import org.jboss.jms.wireformat.ConnectionStopRequest;
import org.jboss.jms.wireformat.ConsumerChangeRateRequest;
+import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.jms.wireformat.NullResponse;
import org.jboss.jms.wireformat.PacketSupport;
import org.jboss.jms.wireformat.RequestSupport;
@@ -93,8 +95,6 @@
import org.jboss.jms.wireformat.SessionRecoverDeliveriesRequest;
import org.jboss.jms.wireformat.SessionSendRequest;
import org.jboss.jms.wireformat.SessionUnsubscribeRequest;
-import org.jboss.messaging.core.plugin.IDBlock;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.remoting.InvocationRequest;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -36,8 +36,8 @@
import javax.transaction.xa.Xid;
import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XATestBase.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -57,9 +57,9 @@
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.tx.LocalTx;
import org.jboss.jms.tx.MessagingXAResource;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.jmx.ServiceContainer;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/ServerPeerTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -47,7 +47,7 @@
import org.jboss.jms.exception.MessagingJMSException;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.messagecounter.MessageStatistics;
-import org.jboss.messaging.core.tx.MessagingXid;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/SimpleConnectionManagerTest.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -36,9 +36,9 @@
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.jms.tx.TransactionRequest;
import org.jboss.messaging.core.plugin.IDBlock;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -26,8 +26,8 @@
import javax.jms.XASession;
import javax.transaction.xa.XAResource;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.util.id.GUID;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2007-05-15 07:56:12 UTC (rev 2685)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2007-05-15 08:47:20 UTC (rev 2686)
@@ -26,8 +26,8 @@
import javax.jms.XASession;
import javax.transaction.xa.XAResource;
+import org.jboss.jms.tx.MessagingXid;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.util.id.GUID;
/**
More information about the jboss-cvs-commits
mailing list