[jboss-cvs] JBoss Messaging SVN: r3614 - in trunk: src/main/org/jboss/jms/client and 50 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 22 11:41:41 EST 2008
Author: timfox
Date: 2008-01-22 11:41:40 -0500 (Tue, 22 Jan 2008)
New Revision: 3614
Added:
trunk/src/main/org/jboss/jms/client/AsfMessageHolder.java
trunk/src/main/org/jboss/jms/client/remoting/MessagingRemotingConnection.java
Removed:
trunk/src/main/org/jboss/jms/client/impl/ClosedInterceptor.java
trunk/src/main/org/jboss/jms/client/impl/CommunicationSupport.java
trunk/src/main/org/jboss/jms/client/impl/CreateConnectionResult.java
trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryInternalEndpoint.java
trunk/src/main/org/jboss/messaging/util/ProxyFactory.java
trunk/tests/src/org/jboss/test/messaging/jms/server/connectionmanager/
Modified:
trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
trunk/src/main/org/jboss/jms/client/JBossConnection.java
trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
trunk/src/main/org/jboss/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/jms/client/JBossMessageConsumer.java
trunk/src/main/org/jboss/jms/client/JBossQueueBrowser.java
trunk/src/main/org/jboss/jms/client/JBossSession.java
trunk/src/main/org/jboss/jms/client/api/ClientBrowser.java
trunk/src/main/org/jboss/jms/client/api/ClientConnection.java
trunk/src/main/org/jboss/jms/client/api/ClientProducer.java
trunk/src/main/org/jboss/jms/client/api/ClientSession.java
trunk/src/main/org/jboss/jms/client/impl/ClientBrowserImpl.java
trunk/src/main/org/jboss/jms/client/impl/ClientConnectionFactoryImpl.java
trunk/src/main/org/jboss/jms/client/impl/ClientConnectionImpl.java
trunk/src/main/org/jboss/jms/client/impl/ClientConsumerImpl.java
trunk/src/main/org/jboss/jms/client/impl/ClientProducerImpl.java
trunk/src/main/org/jboss/jms/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java
trunk/src/main/org/jboss/jms/message/JBossMessage.java
trunk/src/main/org/jboss/jms/server/Configuration.java
trunk/src/main/org/jboss/jms/server/SecurityStore.java
trunk/src/main/org/jboss/jms/server/bridge/Bridge.java
trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
trunk/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java
trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java
trunk/src/main/org/jboss/jms/server/jndi/InVMContext.java
trunk/src/main/org/jboss/jms/server/jndi/InVMInitialContextFactory.java
trunk/src/main/org/jboss/jms/server/jndi/InVMNameParser.java
trunk/src/main/org/jboss/jms/server/plugin/JDBCJMSUserManager.java
trunk/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper.java
trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
trunk/src/main/org/jboss/jms/tx/ResourceManager.java
trunk/src/main/org/jboss/messaging/core/Configuration.java
trunk/src/main/org/jboss/messaging/core/MessagingServer.java
trunk/src/main/org/jboss/messaging/core/PersistenceManager.java
trunk/src/main/org/jboss/messaging/core/impl/BindingImpl.java
trunk/src/main/org/jboss/messaging/core/impl/JDBCSupport.java
trunk/src/main/org/jboss/messaging/core/impl/MessageImpl.java
trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java
trunk/src/main/org/jboss/messaging/core/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/core/impl/TransactionImpl.java
trunk/src/main/org/jboss/messaging/core/impl/bdbje/BDBJEPersistenceManager.java
trunk/src/main/org/jboss/messaging/core/impl/bdbje/integration/RealBDBJEEnvironment.java
trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java
trunk/src/main/org/jboss/messaging/core/impl/memory/SimpleMemoryManager.java
trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounter.java
trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounterManager.java
trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java
trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/PacketDispatcher.java
trunk/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java
trunk/src/main/org/jboss/messaging/core/remoting/codec/BrowserNextMessageResponseCodec.java
trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionRequestCodec.java
trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionResponseCodec.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/ClientImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java
trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionRequest.java
trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionResponse.java
trunk/src/main/org/jboss/messaging/microcontainer/AuthenticationManager.java
trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
trunk/src/main/org/jboss/messaging/microcontainer/JndiBinder.java
trunk/src/main/org/jboss/messaging/microcontainer/NonSerializableFactory.java
trunk/src/main/org/jboss/messaging/microcontainer/ServiceLocator.java
trunk/src/main/org/jboss/messaging/microcontainer/factory/Connector.java
trunk/src/main/org/jboss/messaging/util/AbstractHashSet.java
trunk/src/main/org/jboss/messaging/util/ConcurrentReaderHashSet.java
trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java
trunk/src/main/org/jboss/messaging/util/Future.java
trunk/src/main/org/jboss/messaging/util/Util.java
trunk/src/main/org/jboss/messaging/util/Version.java
trunk/src/main/org/jboss/messaging/util/XMLUtil.java
trunk/tests/src/org/jboss/messaging/core/impl/bdbje/integration/test/unit/BDBSpeedTest.java
trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterParserTest.java
trunk/tests/src/org/jboss/messaging/core/remoting/wireformat/test/unit/PacketTypeTest.java
trunk/tests/src/org/jboss/messaging/test/unit/UnitTestCase.java
trunk/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
trunk/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ClientExitTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java
trunk/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
trunk/tests/src/org/jboss/test/messaging/jms/GracefulClient.java
trunk/tests/src/org/jboss/test/messaging/jms/JMSTest.java
trunk/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
trunk/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageProxyTest.java
trunk/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
trunk/tests/src/org/jboss/test/messaging/jms/SessionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/XATest.java
trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
trunk/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/JMSPriorityHeaderTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/MessageBodyTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/message/MessagePropertyConversionTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageDeliveryTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignMessageTest.java
trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/StressTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java
trunk/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/Example.java
trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
trunk/tests/src/org/jboss/test/messaging/tools/container/InVMInitialContextFactory.java
trunk/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java
trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java
trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
trunk/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
Log:
Client side refactoring part VI
Modified: trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
===================================================================
--- trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,18 @@
*/
package org.jboss.example.jms.distributedqueue;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
import org.jboss.example.jms.common.ExampleSupport;
-import javax.jms.*;
-import javax.naming.InitialContext;
-
/**
* The example creates two connections to two distinct cluster nodes on which we have previously
* deployed a distributed queue. The example sends messages on one node and consumes them from another
Added: trunk/src/main/org/jboss/jms/client/AsfMessageHolder.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/AsfMessageHolder.java (rev 0)
+++ trunk/src/main/org/jboss/jms/client/AsfMessageHolder.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -0,0 +1,121 @@
+/*
+ * 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.client;
+
+import org.jboss.jms.client.api.ClientSession;
+import org.jboss.jms.message.JBossMessage;
+
+/**
+ *
+ * A AsfMessageHolder
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class AsfMessageHolder
+{
+ private JBossMessage msg;
+
+ private String consumerID;
+
+ private String queueName;
+
+ private int maxDeliveries;
+
+ private ClientSession connectionConsumerSession;
+
+ private boolean shouldAck;
+
+ public AsfMessageHolder(JBossMessage msg, String consumerID,
+ String queueName, int maxDeliveries,
+ ClientSession connectionConsumerSession, boolean shouldAck)
+ {
+ this.msg = msg;
+ this.consumerID = consumerID;
+ this.queueName = queueName;
+ this.maxDeliveries = maxDeliveries;
+ this.connectionConsumerSession = connectionConsumerSession;
+ this.shouldAck = shouldAck;
+ }
+
+ public JBossMessage getMsg()
+ {
+ return msg;
+ }
+
+ public void setMsg(JBossMessage msg)
+ {
+ this.msg = msg;
+ }
+
+ public String getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public void setConsumerID(String consumerID)
+ {
+ this.consumerID = consumerID;
+ }
+
+ public String getQueueName()
+ {
+ return queueName;
+ }
+
+ public void setQueueName(String queueName)
+ {
+ this.queueName = queueName;
+ }
+
+ public int getMaxDeliveries()
+ {
+ return maxDeliveries;
+ }
+
+ public void setMaxDeliveries(int maxDeliveries)
+ {
+ this.maxDeliveries = maxDeliveries;
+ }
+
+ public ClientSession getConnectionConsumerSession()
+ {
+ return connectionConsumerSession;
+ }
+
+ public void setConnectionConsumerSession(ClientSession connectionConsumerSession)
+ {
+ this.connectionConsumerSession = connectionConsumerSession;
+ }
+
+ public boolean isShouldAck()
+ {
+ return shouldAck;
+ }
+
+ public void setShouldAck(boolean shouldAck)
+ {
+ this.shouldAck = shouldAck;
+ }
+
+
+}
Modified: trunk/src/main/org/jboss/jms/client/JBossConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnection.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossConnection.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,6 +22,7 @@
package org.jboss.jms.client;
import java.io.Serializable;
+
import javax.jms.Connection;
import javax.jms.ConnectionConsumer;
import javax.jms.ConnectionMetaData;
@@ -214,12 +215,13 @@
// Public ---------------------------------------------------------------------------------------
+ /* For testing only */
public String getRemotingClientSessionID()
{
- return connection.getRemotingConnection().getRemotingClient().getSessionID();
+ return connection.getRemotingConnection().getSessionID();
}
- public org.jboss.jms.client.api.ClientConnection getDelegate()
+ public ClientConnection getDelegate()
{
return connection;
}
@@ -233,16 +235,6 @@
return connection.getServerID();
}
- /*public void registerFailoverListener(FailoverListener listener)
- {
- connection.registerFailoverListener(listener);
- }
-
- public synchronized boolean unregisterFailoverListener(FailoverListener listener)
- {
- return delegate.unregisterFailoverListener(listener);
- } */
-
public String toString()
{
return "JBossConnection->" + connection;
@@ -261,7 +253,7 @@
}
org.jboss.jms.client.api.ClientSession session =
- connection.createSessionDelegate(transacted, acknowledgeMode, isXA);
+ connection.createClientSession(transacted, acknowledgeMode, isXA);
return new JBossSession(session, type);
}
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -23,6 +23,7 @@
import java.util.ArrayList;
import java.util.List;
+
import javax.jms.ConnectionConsumer;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -31,12 +32,13 @@
import javax.jms.ServerSessionPool;
import javax.jms.Session;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.JBossMessage;
import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.MessageQueueNameHelper;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+
/**
* This class implements javax.jms.ConnectionConsumer
*
@@ -113,9 +115,9 @@
// Create a consumer. The ClientConsumer knows we are a connection consumer so will
// not call pre or postDeliver so messages won't be acked, or stored in session/tx.
- sess = conn.createSessionDelegate(false, Session.CLIENT_ACKNOWLEDGE, false);
+ sess = conn.createClientSession(false, Session.CLIENT_ACKNOWLEDGE, false);
- cons = sess.createConsumerDelegate(dest.toCoreDestination(), messageSelector, false, subName, true);
+ cons = sess.createClientConsumer(dest.toCoreDestination(), messageSelector, false, subName, true);
this.consumerID = cons.getID();
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -39,8 +39,8 @@
import javax.naming.NamingException;
import javax.naming.Reference;
+import org.jboss.jms.client.api.ClientConnection;
import org.jboss.jms.client.impl.ClientConnectionFactoryImpl;
-import org.jboss.jms.client.impl.CreateConnectionResult;
import org.jboss.jms.referenceable.SerializableObjectRefAddr;
import org.jboss.messaging.util.Logger;
@@ -187,12 +187,9 @@
boolean isXA, int type)
throws JMSException
{
- // The version used by the connection is the minimum of the server version for the
- // connection factory and the client code version
+ ClientConnection res = delegate.createConnection(username, password);
- CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1);
-
- return new JBossConnection(res.getProxiedDelegate(), type);
+ return new JBossConnection(res, type);
}
// Private --------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/JBossMessageConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossMessageConsumer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossMessageConsumer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -33,8 +33,6 @@
import javax.jms.TopicSubscriber;
import org.jboss.jms.client.api.ClientConsumer;
-
-
import org.jboss.jms.destination.JBossDestination;
/**
Modified: trunk/src/main/org/jboss/jms/client/JBossQueueBrowser.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossQueueBrowser.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossQueueBrowser.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -30,8 +30,8 @@
import org.jboss.jms.client.api.ClientBrowser;
import org.jboss.jms.message.JBossMessage;
+import org.jboss.messaging.core.Message;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.Message;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossSession.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/JBossSession.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,6 +22,8 @@
package org.jboss.jms.client;
import java.io.Serializable;
+import java.util.LinkedList;
+
import javax.jms.BytesMessage;
import javax.jms.Destination;
import javax.jms.IllegalStateException;
@@ -53,6 +55,8 @@
import javax.transaction.xa.XAResource;
import org.jboss.jms.client.api.ClientConsumer;
+import org.jboss.jms.client.api.ClientProducer;
+import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTemporaryQueue;
@@ -60,7 +64,6 @@
import org.jboss.jms.destination.JBossTopic;
import org.jboss.jms.message.JBossMessage;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.ProxyFactory;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -90,15 +93,20 @@
// Attributes ----------------------------------------------------
- protected org.jboss.jms.client.api.ClientSession session;
+ private ClientSession session;
- protected int sessionType;
-
+ private int sessionType;
+
+ private LinkedList<AsfMessageHolder> asfMessages;
+
+ private MessageListener distinguishedListener;
+
// Constructors --------------------------------------------------
- public JBossSession(org.jboss.jms.client.api.ClientSession sessionDelegate, int sessionType)
+ public JBossSession(ClientSession sessionDelegate, int sessionType)
{
this.session = sessionDelegate;
+
this.sessionType = sessionType;
}
@@ -177,28 +185,52 @@
public MessageListener getMessageListener() throws JMSException
{
- if (log.isTraceEnabled()) { log.trace("getMessageListener() called"); }
- return session.getMessageListener();
+ if (session.isClosed())
+ {
+ throw new IllegalStateException("Session is closed");
+ }
+ return distinguishedListener;
}
public void setMessageListener(MessageListener listener) throws JMSException
{
- if (log.isTraceEnabled()) { log.trace("setMessageListener(" + listener + ") called"); }
-
- session.setMessageListener(listener);
+ if (session.isClosed())
+ {
+ throw new IllegalStateException("Session is closed");
+ }
+ this.distinguishedListener = listener;
+
+ //When we have a distinguised listener our behaviour is to fall back to local transacted
+ //when the session is not enlisted.
+ this.session.setTreatAsNonTransactedWhenNotEnlisted(false);
}
+ /**
+ * This invocation should either be handled by the client-side interceptor chain or by the
+ * server-side endpoint.
+ */
public void run()
{
try
{
- if (log.isTraceEnabled()) { log.trace("run() called"); }
- session.run();
+ if (asfMessages != null)
+ {
+ int ackMode = getAcknowledgeMode();
+
+ while (asfMessages.size() > 0)
+ {
+ AsfMessageHolder holder = (AsfMessageHolder)asfMessages.removeFirst();
+
+ MessageHandler.callOnMessage(session, distinguishedListener, holder.getConsumerID(),
+ false,
+ holder.getMsg(), ackMode, holder.getMaxDeliveries(),
+ holder.getConnectionConsumerSession(), holder.isShouldAck());
+ }
+ }
}
- catch (JMSException e)
+ catch (Exception e)
{
- // TODO: What to do on this case?
- log.error(e, e);
+ log.error("Failed to process ASF messages", e);
}
}
@@ -209,7 +241,8 @@
throw new InvalidDestinationException("Not a JBossDestination:" + d);
}
- org.jboss.jms.client.api.ClientProducer producerDelegate = session.createProducerDelegate((JBossDestination)d);
+ ClientProducer producerDelegate = session.createClientProducer((JBossDestination)d);
+
return new JBossMessageProducer(producerDelegate);
}
@@ -235,10 +268,8 @@
throw new InvalidDestinationException("Not a JBossDestination:" + d);
}
- log.trace("attempting to create consumer for destination:" + d + (messageSelector == null ? "" : ", messageSelector: " + messageSelector) + (noLocal ? ", noLocal = true" : ""));
-
org.jboss.jms.client.api.ClientConsumer cd = session.
- createConsumerDelegate(((JBossDestination)d).toCoreDestination(), messageSelector, noLocal, null, false);
+ createClientConsumer(((JBossDestination)d).toCoreDestination(), messageSelector, noLocal, null, false);
return new JBossMessageConsumer(cd);
}
@@ -280,7 +311,7 @@
}
ClientConsumer cd =
- session.createConsumerDelegate(((JBossTopic)topic).toCoreDestination(), null, false, name, false);
+ session.createClientConsumer(((JBossTopic)topic).toCoreDestination(), null, false, name, false);
return new JBossMessageConsumer(cd);
}
@@ -310,7 +341,7 @@
}
ClientConsumer cd = session.
- createConsumerDelegate(((JBossTopic)topic).toCoreDestination(), messageSelector, noLocal, name, false);
+ createClientConsumer(((JBossTopic)topic).toCoreDestination(), messageSelector, noLocal, name, false);
return new JBossMessageConsumer(cd);
}
@@ -341,7 +372,7 @@
}
org.jboss.jms.client.api.ClientBrowser del =
- session.createBrowserDelegate(((JBossQueue)queue).toCoreDestination(), messageSelector);
+ session.createClientBrowser(((JBossQueue)queue).toCoreDestination(), messageSelector);
return new JBossQueueBrowser(queue, messageSelector, del);
}
@@ -466,9 +497,19 @@
* with messages to be processed by the session's run() method
*/
void addAsfMessage(JBossMessage m, String consumerID, String queueName, int maxDeliveries,
- org.jboss.jms.client.api.ClientSession connectionConsumerSession, boolean shouldAck) throws JMSException
+ ClientSession connectionConsumerSession, boolean shouldAck) throws JMSException
{
- session.addAsfMessage(m, consumerID, queueName, maxDeliveries, connectionConsumerSession, shouldAck);
+
+ AsfMessageHolder holder =
+ new AsfMessageHolder(m, consumerID, queueName, maxDeliveries,
+ connectionConsumerSession, shouldAck);
+
+ if (asfMessages == null)
+ {
+ asfMessages = new LinkedList<AsfMessageHolder>();
+ }
+
+ asfMessages.add(holder);
}
// Protected -----------------------------------------------------
@@ -476,5 +517,5 @@
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
+
}
Modified: trunk/src/main/org/jboss/jms/client/api/ClientBrowser.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/api/ClientBrowser.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/api/ClientBrowser.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -19,11 +19,6 @@
*/
public interface ClientBrowser extends Closeable
{
- /**
- * Reset the internal state of the browser endpoint so the following
- * nextMessage()/hasNextMessage()/nextMessageBlock() invocations would reflect the state of the
- * queue at the moment of the reset.
- */
void reset() throws JMSException;
Message nextMessage() throws JMSException;
Modified: trunk/src/main/org/jboss/jms/client/api/ClientConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/api/ClientConnection.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/api/ClientConnection.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -15,10 +15,9 @@
import org.jboss.jms.client.Closeable;
import org.jboss.jms.client.JBossConnectionConsumer;
-import org.jboss.jms.client.remoting.JMSRemotingConnection;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.TransactionRequest;
-import org.jboss.messaging.core.remoting.Client;
import org.jboss.messaging.core.tx.MessagingXid;
/**
@@ -28,11 +27,12 @@
*/
public interface ClientConnection extends Closeable
{
- ClientSession createSessionDelegate(boolean transacted,
- int acknowledgmentMode, boolean isXA) throws JMSException;
+ ClientSession createClientSession(boolean transacted,
+ int acknowledgmentMode, boolean isXA) throws JMSException;
String getClientID() throws JMSException;
+ //Only used for testing
int getServerID();
void setClientID(String id) throws JMSException;
@@ -58,22 +58,10 @@
ServerSessionPool sessionPool,
int maxMessages) throws JMSException;
- void setRemotingConnection(JMSRemotingConnection conn);
-
- Client getClient();
+ MessagingRemotingConnection getRemotingConnection();
- JMSRemotingConnection getRemotingConnection();
-
ResourceManager getResourceManager();
- void setResourceManager(ResourceManager resourceManager);
-
- String getID();
-
- byte getVersion();
-
-
/** This is a method used by children Session during close operations */
- void removeChild(String key);
-
+ void removeChild(String id) throws JMSException;
}
Modified: trunk/src/main/org/jboss/jms/client/api/ClientProducer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/api/ClientProducer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/api/ClientProducer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -20,6 +20,8 @@
*/
public interface ClientProducer extends Closeable
{
+ String getID();
+
void setDisableMessageID(boolean value) throws JMSException;
boolean isDisableMessageID() throws JMSException;
@@ -42,22 +44,10 @@
JBossDestination getDestination() throws JMSException;
- void setDestination(JBossDestination dest) throws JMSException;
-
- /**
- * This method is only handled by the advice stack, the corresponding invocation is never sent
- * to the server.
- */
void send(JBossDestination destination,
Message message,
int deliveryMode,
int priority,
long timeToLive) throws JMSException;
- void send(JBossDestination destination,
- Message message,
- int deliveryMode,
- int priority,
- long timeToLive, boolean keepOriginalID) throws JMSException;
-
}
Modified: trunk/src/main/org/jboss/jms/client/api/ClientSession.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/api/ClientSession.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/api/ClientSession.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -11,7 +11,6 @@
import java.util.List;
import javax.jms.JMSException;
-import javax.jms.MessageListener;
import javax.transaction.xa.XAResource;
import org.jboss.jms.client.Closeable;
@@ -40,87 +39,40 @@
ClientConnection getConnection();
String getID();
-
- /// Methods that will perform a server invocation ----------------------------------------------------------
- ClientConsumer createConsumerDelegate(Destination destination, String selector,
+ ClientConsumer createClientConsumer(Destination destination, String selector,
boolean noLocal, String subscriptionName,
boolean isCC) throws JMSException;
- ClientBrowser createBrowserDelegate(Destination queue, String messageSelector) throws JMSException;
+ ClientBrowser createClientBrowser(Destination queue, String messageSelector) throws JMSException;
+
+ ClientProducer createClientProducer(JBossDestination destination) throws JMSException;
- /**
- * Creates a queue identity given a Queue name. Does NOT create the physical queue. The physical
- * creation of queues is an administrative task and is not to be initiated by the JMS API, with
- * the exception of temporary queues.
- */
JBossQueue createQueue(String queueName) throws JMSException;
- /**
- * Creates a topic identity given a Queue name. Does NOT create the physical topic. The physical
- * creation of topics is an administrative task and is not to be initiated by the JMS API, with
- * the exception of temporary topics.
- */
JBossTopic createTopic(String topicName) throws JMSException;
- /**
- * Acknowledge a list of deliveries
- * @throws JMSException
- */
void acknowledgeDeliveries(List<Ack> acks) throws JMSException;
- /**
- * Acknowledge a delivery
- * @throws JMSException
- */
boolean acknowledgeDelivery(Ack ack) throws JMSException;
- /**
- * Cancel a list of deliveries.
- */
void cancelDeliveries(List<Cancel> cancels) throws JMSException;
- /**
- * Cancel a delivery
- * @param cancelure
- * @throws JMSException
- */
void cancelDelivery(Cancel cancel) throws JMSException;
- /**
- * Add a temporary destination.
- */
void addTemporaryDestination(Destination destination) throws JMSException;
- /**
- * Delete a temporary destination
- */
void deleteTemporaryDestination(Destination destination) throws JMSException;
- /**
- * Unsubscribe the client from the durable subscription
- * specified by subscriptionName
- *
- * @param subscriptionName the Name of the durable subscription to unsubscribe from
- * @throws JMSException if the unsubscribe fails
- */
void unsubscribe(String subscriptionName) throws JMSException;
- /**
- * Send a message
- * @param message The message to send
- * @throws JMSException
- */
void send(Message message) throws JMSException;
- int getDupsOKBatchSize();
+ int getDupsOKBatchSize() throws JMSException;
- public boolean isStrictTck();
+ public boolean isStrictTck() throws JMSException;
-
- /// Client methods -------------------------------------------------------------------------------
-
JBossMessage createMessage() throws JMSException;
JBossBytesMessage createBytesMessage() throws JMSException;
@@ -141,18 +93,8 @@
boolean postDeliver() throws JMSException;
- MessageListener getMessageListener() throws JMSException;
-
- void setMessageListener(MessageListener listener) throws JMSException;
-
- void run() throws JMSException;
-
XAResource getXAResource();
- void addAsfMessage(JBossMessage m, String consumerID, String queueName,
- int maxDeliveries, ClientSession connectionConsumerDelegate,
- boolean shouldAck) throws JMSException;
-
boolean isTransacted() throws JMSException;
int getAcknowledgeMode() throws JMSException;
@@ -165,14 +107,10 @@
void redeliver(List deliveryInfos) throws JMSException;
- ClientProducer createProducerDelegate(JBossDestination destination) throws JMSException;
-
void acknowledgeAll() throws JMSException;
- boolean isXA();
+ boolean isXA() throws JMSException;
- boolean isTreatAsNonTransactedWhenNotEnlisted();
-
void setTreatAsNonTransactedWhenNotEnlisted(boolean treatAsNonTransactedWhenNotEnlisted);
Object getCurrentTxId();
@@ -180,5 +118,7 @@
void setCurrentTxId(Object currentTxId);
/** This is a method used by children (Producer, Consumer and Browser) during close operations */
- void removeChild(String key);
+ void removeChild(String id) throws JMSException;
+
+ boolean isClosed();
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientBrowserImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientBrowserImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientBrowserImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,12 @@
*/
package org.jboss.jms.client.impl;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
+import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import org.jboss.jms.client.api.ClientBrowser;
import org.jboss.jms.client.api.ClientSession;
-import org.jboss.messaging.core.remoting.Client;
-import org.jboss.messaging.core.Destination;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.remoting.wireformat.BrowserHasNextMessageRequest;
import org.jboss.messaging.core.remoting.wireformat.BrowserHasNextMessageResponse;
@@ -42,8 +39,6 @@
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
/**
- * The client-side Browser delegate class.
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
@@ -52,130 +47,118 @@
*
* $Id: ClientBrowserImpl.java 3602 2008-01-21 17:48:32Z timfox $
*/
-public class ClientBrowserImpl extends CommunicationSupport implements ClientBrowser
+public class ClientBrowserImpl implements ClientBrowser
{
// Constants ------------------------------------------------------------------------------------
- private static final long serialVersionUID = 3048255931412144958L;
-
// Attributes -----------------------------------------------------------------------------------
+ private String id;
+
private ClientSession session;
- private Destination jmsDestination;
- private String messageSelector;
-
+
+ private MessagingRemotingConnection remotingConnection;
+
+ private volatile boolean closed;
+
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
- public ClientBrowserImpl(ClientSession session, String objectID, Destination jmsDestination, String messageSelector)
+ public ClientBrowserImpl(MessagingRemotingConnection remotingConnection, ClientSession session, String id)
{
- super(objectID);
+ this.remotingConnection = remotingConnection;
+
+ this.id = id;
+
this.session = session;
- this.jmsDestination = jmsDestination;
-
- this.messageSelector = messageSelector;
}
- public ClientBrowserImpl(String objectID)
- {
- super(objectID);
- }
-
- public ClientBrowserImpl()
- {
- }
-
- // DelegateSupport overrides --------------------------------------------------------------------
-
// Closeable implementation ---------------------------------------------------------------------
- public void close() throws JMSException
+ public synchronized void close() throws JMSException
{
+ if (closed)
+ {
+ return;
+ }
+
try
{
- sendBlocking(new CloseMessage());
+ remotingConnection.sendBlocking(id, new CloseMessage());
}
finally
{
- session.removeChild(this.getID());
+ session.removeChild(id);
+
+ closed = true;
}
}
- public long closing(long sequence) throws JMSException
+ public synchronized long closing(long sequence) throws JMSException
{
- ClosingResponse response = (ClosingResponse) sendBlocking(new ClosingRequest(sequence));
+ if (closed)
+ {
+ return -1;
+ }
+
+ ClosingResponse response = (ClosingResponse) remotingConnection.sendBlocking(id, new ClosingRequest(sequence));
+
return response.getID();
}
- // BrowserDelegate implementation ---------------------------------------------------------------
-
public void reset() throws JMSException
{
- sendBlocking(new BrowserResetMessage());
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new BrowserResetMessage());
}
public boolean hasNextMessage() throws JMSException
{
- BrowserHasNextMessageResponse response = (BrowserHasNextMessageResponse) sendBlocking(new BrowserHasNextMessageRequest());
+ checkClosed();
+
+ BrowserHasNextMessageResponse response =
+ (BrowserHasNextMessageResponse)remotingConnection.sendBlocking(id, new BrowserHasNextMessageRequest());
+
return response.hasNext();
}
public Message nextMessage() throws JMSException
{
- BrowserNextMessageResponse response = (BrowserNextMessageResponse) sendBlocking(new org.jboss.messaging.core.remoting.wireformat.BrowserNextMessageRequest());
+ checkClosed();
+
+ BrowserNextMessageResponse response =
+ (BrowserNextMessageResponse)remotingConnection.sendBlocking(id, new org.jboss.messaging.core.remoting.wireformat.BrowserNextMessageRequest());
+
return response.getMessage();
}
public Message[] nextMessageBlock(int maxMessages) throws JMSException
{
-
- BrowserNextMessageBlockResponse response = (BrowserNextMessageBlockResponse) sendBlocking(new BrowserNextMessageBlockRequest(maxMessages));
+ checkClosed();
+
+ BrowserNextMessageBlockResponse response =
+ (BrowserNextMessageBlockResponse)remotingConnection.sendBlocking(id, new BrowserNextMessageBlockRequest(maxMessages));
return response.getMessages();
}
- // Streamable implementation ----------------------------------------------------------
-
- public void read(DataInputStream in) throws Exception
- {
- super.read(in);
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- super.write(out);
- }
-
// Public ---------------------------------------------------------------------------------------
- public String getStackName()
- {
- return "BrowserStack";
- }
-
- public String toString()
- {
- return "BrowserDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
- }
-
// Protected ------------------------------------------------------------------------------------
- @Override
- protected Client getClient()
- {
- return this.session.getConnection().getClient();
- }
+ // Package Private ------------------------------------------------------------------------------
- @Override
- protected byte getVersion()
+ // Private --------------------------------------------------------------------------------------
+
+ private void checkClosed() throws IllegalStateException
{
- return this.session.getConnection().getVersion();
+ if (closed)
+ {
+ throw new IllegalStateException("Browser is closed");
+ }
}
-
- // Package Private ------------------------------------------------------------------------------
- // Private --------------------------------------------------------------------------------------
-
// Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientConnectionFactoryImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientConnectionFactoryImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,25 +21,19 @@
*/
package org.jboss.jms.client.impl;
-import static org.jboss.messaging.core.remoting.ConnectorRegistrySingleton.REGISTRY;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.Serializable;
import javax.jms.JMSException;
import org.jboss.jms.client.api.ClientConnection;
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
-import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.jms.exception.MessagingNetworkFailureException;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
+import org.jboss.jms.exception.MessagingJMSException;
+import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.messaging.core.remoting.Client;
-import org.jboss.messaging.core.remoting.NIOConnector;
-import org.jboss.messaging.core.remoting.ServerLocator;
-import org.jboss.messaging.core.remoting.impl.ClientImpl;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
+import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.Version;
/**
@@ -54,19 +48,18 @@
*
* $Id: ClientConnectionFactoryImpl.java 3602 2008-01-21 17:48:32Z timfox $
*/
-public class ClientConnectionFactoryImpl
- extends CommunicationSupport implements Serializable
+public class ClientConnectionFactoryImpl implements Serializable
{
// Constants ------------------------------------------------------------------------------------
private static final long serialVersionUID = 2512460695662741413L;
+
+ private static final Logger log = Logger.getLogger(ClientConnectionFactoryImpl.class);
// Attributes -----------------------------------------------------------------------------------
- //This data is needed in order to create a connection
-
- private String uniqueName;
-
+ private String id;
+
private String serverLocatorURI;
private Version serverVersion;
@@ -79,11 +72,6 @@
// Static ---------------------------------------------------------------------------------------
- /*
- * Calculate what version to use.
- * The client itself has a version, but we also support other versions of servers lower if the
- * connection version is lower (backwards compatibility)
- */
private static Version getVersionToUse(Version connectionVersion)
{
Version clientVersion = Version.instance();
@@ -105,12 +93,10 @@
// Constructors ---------------------------------------------------------------------------------
- public ClientConnectionFactoryImpl(String uniqueName, String objectID, int serverID,
+ public ClientConnectionFactoryImpl(String id, int serverID,
String serverLocatorURI, Version serverVersion, boolean clientPing, boolean strictTck)
{
- super(objectID);
-
- this.uniqueName = uniqueName;
+ this.id = id;
this.serverID = serverID;
this.serverLocatorURI = serverLocatorURI;
this.serverVersion = serverVersion;
@@ -122,56 +108,41 @@
{
}
- protected Client getClient()
+ public ClientConnection createConnection(String username, String password) throws JMSException
{
- return null;
- }
-
- public CreateConnectionResult createConnectionDelegate(String username,
- String password,
- int failedNodeID)
- throws JMSException
- {
- // If the method being invoked is createConnectionDelegate() then we must invoke it on the
- // same remoting client subsequently used by the connection. This is because we need to pass
- // in the remoting session id in the call to createConnection. All other invocations can be
- // invoked on an arbitrary client, which can be created for each invocation.
- //
- // If we disable pinging on the client then it is a reasonably light weight operation to
- // create the client since it will use the already existing invoker. This prevents us from
- // having to maintain a Client instance per connection factory, which gives difficulties in
- // knowing when to close it.
-
Version version = getVersionToUse(serverVersion);
byte v = version.getProviderIncrementingVersion();
- CreateConnectionResult res;
-
- JMSRemotingConnection remotingConnection = null;
+ MessagingRemotingConnection remotingConnection = null;
try
{
- remotingConnection = new JMSRemotingConnection(serverLocatorURI);
+ remotingConnection = new MessagingRemotingConnection(version, serverLocatorURI);
remotingConnection.start();
- Client client = remotingConnection.getRemotingClient();
- String sessionID = client.getSessionID();
- CreateConnectionRequest request = new CreateConnectionRequest(v, sessionID, JMSClientVMIdentifier.instance, failedNodeID, username, password);
- CreateConnectionResponse response = (CreateConnectionResponse) sendBlocking(client, this.getID(), this.getVersion(), request);
- ClientConnectionImpl connectionDelegate = new ClientConnectionImpl(response.getConnectionID(), response.getServerID());
- connectionDelegate.setStrictTck(strictTck);
-
- connectionDelegate.setVersionToUse(version);
- connectionDelegate.setResourceManager(ResourceManagerFactory.instance.checkOutResourceManager(connectionDelegate.getServerID()));
-
- ConsolidatedRemotingConnectionListener listener =
- new ConsolidatedRemotingConnectionListener(connectionDelegate);
-
- if (remotingConnection!=null)remotingConnection.addConnectionListener(listener);
+ String sessionID = remotingConnection.getSessionID();
- res = new CreateConnectionResult(connectionDelegate);
- } catch (Throwable t)
+ CreateConnectionRequest request =
+ new CreateConnectionRequest(v, sessionID, JMSClientVMIdentifier.instance, username, password);
+
+ CreateConnectionResponse response =
+ (CreateConnectionResponse)remotingConnection.sendBlocking(id, request);
+
+ ResourceManager resourceManager = ResourceManagerFactory.instance.checkOutResourceManager(this.serverID);
+
+ ClientConnectionImpl connection =
+ new ClientConnectionImpl(response.getConnectionID(), serverID, strictTck, version, resourceManager, remotingConnection);
+
+ //FIXME - get rid of this stupid ConsolidatedThingamajug bollocks
+
+ ConsolidatedRemotingConnectionListener listener = new ConsolidatedRemotingConnectionListener(connection);
+
+ remotingConnection.addConnectionListener(listener);
+
+ return connection;
+ }
+ catch (Throwable t)
{
if (remotingConnection != null)
{
@@ -183,43 +154,21 @@
{
}
}
- throw handleThrowable(t);
- }
- ClientConnection connectionDelegate = res.getInternalDelegate();
-
- if (connectionDelegate != null)
- {
- connectionDelegate.setRemotingConnection(remotingConnection);
+ //TODO - we will sort out exception handling further in the refactoring
+
+ log.error("Failed to start connection ", t);
+
+ throw new MessagingJMSException("Failed to start connection", t);
}
- else
- {
- //Wrong server redirect on failure
- //close the remoting connection
- try
- {
- remotingConnection.stop();
- }
- catch (Throwable ignore)
- {
- }
- }
-
- return res;
}
// Public ---------------------------------------------------------------------------------------
- public String toString()
- {
- return "ConnectionFactoryDelegate[" + id + ", SID=" + serverID + "]";
- }
-
public String getServerLocatorURI()
{
return serverLocatorURI;
}
-
public int getServerID()
{
@@ -236,12 +185,6 @@
return serverVersion;
}
- public String getName()
- {
- return uniqueName;
- }
-
-
public boolean getStrictTck()
{
return strictTck;
@@ -253,64 +196,6 @@
// Private --------------------------------------------------------------------------------------
- private Client createClient() throws JMSException
- {
- //We execute this on it's own client
- Client client;
-
- try
- {
- ServerLocator locator = new ServerLocator(serverLocatorURI);
- NIOConnector connector = REGISTRY.getConnector(locator);
- client = new ClientImpl(connector, locator);
- client.connect();
- }
- catch (Exception e)
- {
- throw new MessagingNetworkFailureException("Failed to connect client", e);
- }
-
- return client;
- }
-
- // Streamable implementation --------------------------------------------
-
- public void read(DataInputStream in) throws Exception
- {
- super.read(in);
-
- uniqueName = in.readUTF();
-
- serverLocatorURI = in.readUTF();
-
- serverVersion = new Version();
-
- serverVersion.read(in);
-
- serverID = in.readInt();
-
- clientPing = in.readBoolean();
-
- strictTck = in.readBoolean();
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- super.write(out);
-
- out.writeUTF(uniqueName);
-
- out.writeUTF(serverLocatorURI);
-
- serverVersion.write(out);
-
- out.writeInt(serverID);
-
- out.writeBoolean(clientPing);
-
- out.writeBoolean(strictTck);
- }
-
// Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientConnectionImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientConnectionImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,7 @@
*/
package org.jboss.jms.client.impl;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,13 +38,11 @@
import org.jboss.jms.client.api.ClientConnection;
import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
-import org.jboss.jms.client.remoting.JMSRemotingConnection;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.jms.tx.TransactionRequest;
-import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.remoting.Client;
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
import org.jboss.messaging.core.remoting.wireformat.ClosingRequest;
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
@@ -62,8 +57,7 @@
import org.jboss.messaging.core.remoting.wireformat.StartConnectionMessage;
import org.jboss.messaging.core.remoting.wireformat.StopConnectionMessage;
import org.jboss.messaging.core.tx.MessagingXid;
-import org.jboss.messaging.util.ConcurrentHashSet;
-import org.jboss.messaging.util.ProxyFactory;
+import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.Version;
/**
@@ -78,80 +72,77 @@
*
* $Id: ClientConnectionImpl.java 3602 2008-01-21 17:48:32Z timfox $
*/
-public class ClientConnectionImpl extends CommunicationSupport implements ClientConnection
+public class ClientConnectionImpl implements ClientConnection
{
// Constants ------------------------------------------------------------------------------------
- private static final long serialVersionUID = -5485083713058725777L;
-
private static final Logger log = Logger.getLogger(ClientConnectionImpl.class);
private static final boolean trace = log.isTraceEnabled();
// Attributes -----------------------------------------------------------------------------------
+ private String id;
+
protected JBossConnectionMetaData connMetaData;
private int serverID;
- private transient JMSRemotingConnection remotingConnection;
+ private MessagingRemotingConnection remotingConnection;
- private transient Version versionToUse;
+ private Version versionToUse;
private boolean strictTck;
-
- // Attributes that used to be on ConnectionState
-
- protected Map<String, ClientSession> children = new ConcurrentHashMap<String, ClientSession>();
+ private Map<String, ClientSession> children = new ConcurrentHashMap<String, ClientSession>();
- protected boolean started;
-
private boolean justCreated = true;
private String clientID;
private ResourceManager resourceManager;
- // Cached by the connection state in case ClusteringAspect needs to re-try establishing
- // connection on a different node
- private transient String username;
+ private volatile boolean closed;
- // Cached by the connection state in case ClusteringAspect needs to re-try establishing
- // connection on a different node
- private transient String password;
-
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
- public ClientConnectionImpl(String objectID, int serverID)
+ public ClientConnectionImpl(String id, int serverID, boolean strictTck, Version version, ResourceManager rm,
+ MessagingRemotingConnection connection)
{
- super(objectID);
-
+ this.id = id;
+
this.serverID = serverID;
+
+ this.strictTck = strictTck;
+
+ this.versionToUse = version;
+
+ this.resourceManager = rm;
+
+ this.remotingConnection = connection;
}
- public ClientConnectionImpl()
- {
- super();
- }
-
- // DelegateSupport overrides --------------------------------------------------------------------
-
// Closeable implementation ---------------------------------------------------------------------
- public void close() throws JMSException
+ public synchronized void close() throws JMSException
{
+ if (closed)
+ {
+ return;
+ }
+
try
{
- sendBlocking(new CloseMessage());
+ remotingConnection.sendBlocking(id, new CloseMessage());
}
finally
{
// remove the consolidated remoting connection listener
ConsolidatedRemotingConnectionListener l = remotingConnection.removeConnectionListener();
+
if (l != null)
{
l.clear();
@@ -161,24 +152,27 @@
remotingConnection.stop();
// And to resource manager
- ResourceManagerFactory.instance.checkInResourceManager(getServerID());
+ ResourceManagerFactory.instance.checkInResourceManager(serverID);
+
+ closed = true;
}
-
}
- public long closing(long sequence) throws JMSException
+ public synchronized long closing(long sequence) throws JMSException
{
+ if (closed)
+ {
+ return -1;
+ }
+
closeChildren();
- ClosingResponse response = (ClosingResponse) sendBlocking(new ClosingRequest(sequence));
+
+ ClosingResponse response = (ClosingResponse)remotingConnection.sendBlocking(id, new ClosingRequest(sequence));
+
return response.getID();
}
- public Client getClient()
- {
- return this.getRemotingConnection().getRemotingClient();
- }
-
- // Connection implementation ------------------------------------------------------------
+ // ClientConnection implementation ------------------------------------------------------------
/**
* This invocation should either be handled by the client-side interceptor chain or by the
@@ -190,30 +184,33 @@
ServerSessionPool sessionPool,
int maxMessages) throws JMSException
{
- if (trace) { log.trace("createConnectionConsumer()"); }
-
-
- return new JBossConnectionConsumer((ClientConnection)ProxyFactory.proxy(this, ClientConnection.class), (JBossDestination)dest,
+ checkClosed();
+
+ return new JBossConnectionConsumer(this, (JBossDestination)dest,
subscriptionName, messageSelector, sessionPool,
maxMessages);
}
- public ClientSession createSessionDelegate(boolean transacted,
+ public ClientSession createClientSession(boolean transacted,
int acknowledgmentMode,
boolean isXA) throws JMSException
{
-
+ checkClosed();
+
justCreated = false;
CreateSessionRequest request = new CreateSessionRequest(transacted, acknowledgmentMode, isXA);
- CreateSessionResponse response = (CreateSessionResponse) sendBlocking(request);
- ClientSessionImpl delegate = new ClientSessionImpl(this, response.getSessionID(), response.getDupsOKBatchSize(), isStrictTck(),
+
+ CreateSessionResponse response = (CreateSessionResponse)remotingConnection.sendBlocking(id, request);
+
+ ClientSession session = new ClientSessionImpl(this, response.getSessionID(), response.getDupsOKBatchSize(), isStrictTck(),
transacted, acknowledgmentMode, isXA);
- ClientSession proxy =(ClientSession) ProxyFactory.proxy(delegate, ClientSession.class);
- children.put(proxy.getID(), proxy);
- return proxy;
+
+ children.put(response.getSessionID(), session);
+
+ return session;
}
@@ -222,19 +219,16 @@
return strictTck;
}
- public void setStrictTck(boolean strictTck)
- {
- this.strictTck = strictTck;
- }
-
public String getClientID() throws JMSException
{
+ checkClosed();
+
justCreated = false;
if (clientID == null)
{
//Get from the server
- clientID = ((GetClientIDResponse) sendBlocking(new GetClientIDRequest())).getClientID();
+ clientID = ((GetClientIDResponse)remotingConnection.sendBlocking(id, new GetClientIDRequest())).getClientID();
}
return clientID;
}
@@ -245,7 +239,8 @@
*/
public ConnectionMetaData getConnectionMetaData() throws JMSException
{
-
+ checkClosed();
+
justCreated = false;
if (connMetaData == null)
@@ -269,12 +264,15 @@
public void sendTransaction(TransactionRequest tr) throws JMSException
{
- sendBlocking(new SendTransactionMessage(tr));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new SendTransactionMessage(tr));
}
-
public void setClientID(String clientID) throws JMSException
{
+ checkClosed();
+
if (this.clientID != null)
{
throw new javax.jms.IllegalStateException("Client id has already been set");
@@ -285,23 +283,21 @@
}
this.clientID = clientID;
+
this.justCreated = false;
- // this gets invoked on the server too
- invokeSetClientID(clientID);
-
+ remotingConnection.sendBlocking(id, new SetClientIDMessage(clientID));
}
- private void invokeSetClientID(String clientID) throws JMSException
- {
- sendBlocking(new SetClientIDMessage(clientID));
- }
-
+
+
/**
* This invocation should either be handled by the client-side interceptor chain or by the
* server-side endpoint.
*/
public void setExceptionListener(ExceptionListener listener) throws JMSException
{
+ checkClosed();
+
justCreated = false;
remotingConnection.getConnectionListener().addJMSExceptionListener(listener);
@@ -309,38 +305,38 @@
public void start() throws JMSException
{
- started = true;
+ checkClosed();
+
justCreated = false;
- sendOneWay(new StartConnectionMessage());
+
+ remotingConnection.sendOneWay(id, new StartConnectionMessage());
}
- public void startAfterFailover() throws JMSException
- {
- sendOneWay(new StartConnectionMessage());
- }
-
public void stop() throws JMSException
{
- started = false;
+ checkClosed();
+
justCreated = false;
- sendBlocking(new StopConnectionMessage());
+
+ remotingConnection.sendBlocking(id, new StopConnectionMessage());
}
public MessagingXid[] getPreparedTransactions() throws JMSException
{
- GetPreparedTransactionsResponse response = (GetPreparedTransactionsResponse) sendBlocking(new GetPreparedTransactionsRequest());
+ checkClosed();
+ GetPreparedTransactionsResponse response =
+ (GetPreparedTransactionsResponse)remotingConnection.sendBlocking(id, new GetPreparedTransactionsRequest());
+
return response.getXids();
}
-
- // Public ---------------------------------------------------------------------------------------
-
- public void setRemotingConnection(JMSRemotingConnection conn)
+
+ public ResourceManager getResourceManager()
{
- this.remotingConnection = conn;
+ return resourceManager;
}
-
- public JMSRemotingConnection getRemotingConnection()
+
+ public MessagingRemotingConnection getRemotingConnection()
{
return remotingConnection;
}
@@ -349,97 +345,43 @@
{
return serverID;
}
-
- public Version getVersionToUse()
- {
- return versionToUse;
- }
-
- public void setVersionToUse(Version versionToUse)
- {
- this.versionToUse = versionToUse;
- }
-
- public String toString()
- {
- return "ConnectionDelegate[" + System.identityHashCode(this) + ", ID=" + id +
- ", SID=" + serverID + "]";
- }
- // Package protected
-
- public void removeChild(String key)
+ public void removeChild(String key) throws JMSException
{
+ checkClosed();
+
children.remove(key);
}
+ // Public ---------------------------------------------------------------------------------------
+
// Protected ------------------------------------------------------------------------------------
+
+ // Package Private ------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
- protected void closeChildren() throws JMSException
+ private void checkClosed() throws IllegalStateException
{
- Set<ClientSession> childrenClone = new HashSet<ClientSession>(children.values());
-
- for (ClientSession session: childrenClone)
+ if (closed)
{
- try
- {
- session.closing(-1);
- session.close();
- }
- catch (Throwable t)
- {
- //We swallow exceptions in close/closing, this is because if the connection fails, it is naturally for code to then close
- //in a finally block, it would not then be appropriate to throw an exception. This is a common technique
- if (trace)
- {
- log.trace("Failed to close", t);
- }
- }
+ throw new IllegalStateException("Connection is closed");
}
}
-
- @Override
- public byte getVersion()
+ private void closeChildren() throws JMSException
{
- if (versionToUse == null)
+ //We copy the set of children to prevent ConcurrentModificationException which would occur
+ //when the child trues to remove itself from its parent
+ Set<ClientSession> childrenClone = new HashSet<ClientSession>(children.values());
+
+ for (ClientSession session: childrenClone)
{
- log.warn("Version to use it null");
+ session.closing(-1);
+ session.close();
}
- return versionToUse.getProviderIncrementingVersion();
}
-
- // Streamable implementation -------------------------------------------------------------------
-
- public void read(DataInputStream in) throws Exception
- {
- super.read(in);
-
- serverID = in.readInt();
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- super.write(out);
-
- out.writeInt(serverID);
- }
-
- public ResourceManager getResourceManager()
- {
- return resourceManager;
- }
-
- public void setResourceManager(ResourceManager resourceManager)
- {
- this.resourceManager = resourceManager;
- }
-
- // Package Private ------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
// Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientConsumerImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientConsumerImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,8 +21,6 @@
*/
package org.jboss.jms.client.impl;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -30,18 +28,15 @@
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.MessageListener;
-import javax.jms.Session;
+import org.jboss.jms.client.MessageHandler;
import org.jboss.jms.client.api.ClientConsumer;
import org.jboss.jms.client.api.ClientSession;
-import org.jboss.jms.exception.MessagingShutdownException;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
import org.jboss.jms.message.JBossMessage;
import org.jboss.messaging.core.Destination;
-import org.jboss.messaging.core.DestinationType;
-import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.PriorityLinkedList;
import org.jboss.messaging.core.impl.PriorityLinkedListImpl;
-import org.jboss.messaging.core.remoting.Client;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.wireformat.ChangeRateMessage;
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
@@ -64,169 +59,56 @@
*
* $Id: ClientConsumerImpl.java 3603 2008-01-21 18:49:20Z timfox $
*/
-public class ClientConsumerImpl extends CommunicationSupport implements ClientConsumer
+public class ClientConsumerImpl implements ClientConsumer
{
// Constants ------------------------------------------------------------------------------------
- private static final long serialVersionUID = 3253922610778321868L;
-
private static final Logger log = Logger.getLogger(ClientConsumerImpl.class);
private static final boolean trace = log.isTraceEnabled();
private static final int WAIT_TIMEOUT = 30000;
-
// Attributes -----------------------------------------------------------------------------------
+ private String id;
private ClientSession session;
private int bufferSize;
private int maxDeliveries;
private long redeliveryDelay;
private Destination destination;
private String selector;
- private String subscriptionName;
private boolean noLocal;
private boolean isConnectionConsumer;
- private boolean storingDeliveries;
-
private PriorityLinkedList<JBossMessage> buffer = new PriorityLinkedListImpl<JBossMessage>(10);
private volatile Thread receiverThread;
private MessageListener listener;
- private boolean closed;
+ private volatile boolean closed;
+ private boolean closing;
private Object mainLock = new Object();
private QueuedExecutor sessionExecutor;
private boolean listenerRunning;
private long lastDeliveryId = -1;
private boolean waitingForLastDelivery;
- private boolean shouldAck;
- private boolean paused;
+ private boolean shouldAck;
private int consumeCount;
- private boolean firstTime = true;
-
+ private MessagingRemotingConnection remotingConnection;
- // Static ---------------------------------------------------------------------------------------
+ //FIXME - revisit closed and closing flags
- private static boolean checkExpiredOrReachedMaxdeliveries(JBossMessage jbm,
- ClientSession del,
- int maxDeliveries, boolean shouldCancel)
- {
- Message msg = jbm.getCoreMessage();
-
- boolean expired = msg.isExpired();
-
- boolean reachedMaxDeliveries = jbm.getDeliveryCount() == maxDeliveries;
-
- if (expired || reachedMaxDeliveries)
- {
- if (trace)
- {
- if (expired)
- {
- log.trace(msg + " has expired, cancelling to server");
- }
- else
- {
- log.trace(msg + " has reached maximum delivery number " + maxDeliveries +", cancelling to server");
- }
- }
-
- if (shouldCancel)
- {
- final Cancel cancel = new CancelImpl(jbm.getDeliveryId(), jbm.getDeliveryCount(),
- expired, reachedMaxDeliveries);
- try
- {
- del.cancelDelivery(cancel);
- }
- catch (JMSException e)
- {
- log.error("Failed to cancel delivery", e);
- }
- }
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
- // This is static so it can be called by the asf layer too
- public static void callOnMessage(ClientSession sess,
- MessageListener listener,
- String consumerID,
- boolean isConnectionConsumer,
- JBossMessage m,
- int ackMode,
- int maxDeliveries,
- ClientSession connectionConsumerSession,
- boolean shouldAck)
- throws JMSException
- {
- if (checkExpiredOrReachedMaxdeliveries(m, connectionConsumerSession!=null?connectionConsumerSession:sess, maxDeliveries, shouldAck))
- {
- // Message has been cancelled
- return;
- }
-
- DeliveryInfo deliveryInfo =
- new DeliveryInfo(m, consumerID, connectionConsumerSession, shouldAck);
-
- m.incDeliveryCount();
-
- // If this is the callback-handler for a connection consumer we don't want to acknowledge or
- // add anything to the tx for this session.
- if (!isConnectionConsumer)
- {
- // We need to call preDeliver, deliver the message then call postDeliver - this is because
- // it is legal to call session.recover(), or session.rollback() from within the onMessage()
- // method in which case the last message needs to be delivered so it needs to know about it
- sess.preDeliver(deliveryInfo);
- }
-
- try
- {
- if (trace) { log.trace("calling listener's onMessage(" + m + ")"); }
-
- listener.onMessage(m);
-
- if (trace) { log.trace("listener's onMessage() finished"); }
- }
- catch (RuntimeException e)
- {
- log.error("RuntimeException was thrown from onMessage, " + m.getJMSMessageID() + " will be redelivered", e);
-
- // See JMS 1.1 spec 4.5.2
-
- if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
- {
- sess.recover();
- }
- }
-
- // If this is the callback-handler for a connection consumer we don't want to acknowledge
- //or add anything to the tx for this session
- if (!isConnectionConsumer)
- {
- if (trace) { log.trace("Calling postDeliver"); }
-
- sess.postDeliver();
-
- if (trace) { log.trace("Called postDeliver"); }
- }
- }
-
+ // Static ---------------------------------------------------------------------------------------
+
// Constructors ---------------------------------------------------------------------------------
- public ClientConsumerImpl(ClientSession session, String objectID, int bufferSize,
+ public ClientConsumerImpl(ClientSession session, String id, int bufferSize,
int maxDeliveries, long redeliveryDelay,
Destination dest,
- String selector, boolean noLocal, String subscriptionName,
- boolean isCC, QueuedExecutor sessionExecutor)
+ String selector, boolean noLocal,
+ boolean isCC, QueuedExecutor sessionExecutor,
+ MessagingRemotingConnection remotingConnection,
+ boolean shouldAck)
{
- super(objectID);
+ this.id = id;
this.session = session;
this.bufferSize = bufferSize;
this.maxDeliveries = maxDeliveries;
@@ -234,229 +116,87 @@
this.destination = dest;
this.selector = selector;
this.noLocal = noLocal;
- this.subscriptionName = subscriptionName;
this.isConnectionConsumer = isCC;
this.sessionExecutor = sessionExecutor;
- this.shouldAck = !(destination.getType() == DestinationType.TOPIC && subscriptionName == null);
+ this.shouldAck = shouldAck;
+ this.remotingConnection = remotingConnection;
+
}
- @Override
- protected byte getVersion()
- {
- return session.getConnection().getVersion();
- }
-
- protected Client getClient()
- {
- return this.session.getConnection().getClient();
- }
-
// Closeable implementation ---------------------------------------------------------------------
- public void close() throws JMSException
+ public synchronized void close() throws JMSException
{
+ if (closed)
+ {
+ return;
+ }
+
try
{
- sendBlocking(new CloseMessage());
+ remotingConnection.sendBlocking(id, new CloseMessage());
}
finally
{
- session.removeChild(this.getID());
+ session.removeChild(id);
+
+ closed = true;
}
}
- public long closing(long sequence) throws JMSException
+ public synchronized long closing(long sequence) throws JMSException
{
- try
+ if (closed)
{
- // We make sure closing is called on the ServerConsumerEndpoint.
- // This returns us the last delivery id sent
-
- long lastDeliveryId = invokeClosing(sequence);
-
- // First we call close on the ClientConsumer which waits for onMessage invocations
- // to complete and the last delivery to arrive
- close(lastDeliveryId);
-
- PacketDispatcher.client.unregister(id);
-
- //And then we cancel any messages still in the message callback handler buffer
- cancelBuffer();
-
- return lastDeliveryId;
-
+ return -1;
}
- catch (Exception proxiedException)
- {
- // if MessagingServer is shutdown or
- // if there is no failover in place... we just close the consumerState as well
- if (proxiedException instanceof MessagingShutdownException /* ||
- (connectionState.getFailoverCommandCenter() == null ) */ )
- {
- if (!this.isClosed())
- {
- close(-1);
- }
- }
- JMSException ex = new JMSException(proxiedException.toString());
- ex.initCause(proxiedException);
- throw ex;
- }
- }
+ // We make sure closing is called on the ServerConsumerEndpoint.
+ // This returns us the last delivery id sent
- private long invokeClosing(long sequence) throws JMSException
- {
ClosingRequest request = new ClosingRequest(sequence);
- ClosingResponse response = (ClosingResponse) sendBlocking(request);
- return response.getID();
- }
+ ClosingResponse response = (ClosingResponse)remotingConnection.sendBlocking(id, request);
+ long lastDeliveryId = response.getID();
- public boolean isClosed()
- {
- return closed;
- }
-
- public void changeRate(float newRate) throws JMSException
- {
- sendOneWay(new ChangeRateMessage(newRate));
- }
-
- public MessageListener getMessageListener()
- {
- return this.listener;
- }
+ // First we call close on the ClientConsumer which waits for onMessage invocations
+ // to complete and the last delivery to arrive
+ close(lastDeliveryId);
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public boolean getNoLocal()
- {
- return this.noLocal;
- }
+ PacketDispatcher.client.unregister(id);
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public Destination getDestination()
- {
- return this.destination;
- }
+ //And then we cancel any messages still in the message callback handler buffer
+ cancelBuffer();
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public String getMessageSelector()
- {
- return this.selector;
+ return lastDeliveryId;
}
- // Streamable implementation ----------------------------------------------------------
- public void read(DataInputStream in) throws Exception
+ // ClientConsumer implementation --------------------------------------------------------------
+
+ public String getID()
{
- super.read(in);
-
- bufferSize = in.readInt();
-
- maxDeliveries = in.readInt();
-
- redeliveryDelay = in.readLong();
+ return id;
}
-
- public void write(DataOutputStream out) throws Exception
+
+ public void changeRate(float newRate) throws JMSException
{
- super.write(out);
-
- out.writeInt(bufferSize);
-
- out.writeInt(maxDeliveries);
+ checkClosed();
- out.writeLong(redeliveryDelay);
+ remotingConnection.sendOneWay(id, new ChangeRateMessage(newRate));
}
-
- // Public ---------------------------------------------------------------------------------------
-
- public String toString()
- {
- return "ConsumerDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
- }
-
- public int getBufferSize()
- {
- return bufferSize;
- }
-
- public int getMaxDeliveries()
- {
- return maxDeliveries;
- }
- public long getRedeliveryDelay()
+ public MessageListener getMessageListener() throws JMSException
{
- return redeliveryDelay;
+ checkClosed();
+
+ return this.listener;
}
- public boolean isConnectionConsumer()
- {
- return isConnectionConsumer;
- }
-
- public String getSubscriptionName()
- {
- return subscriptionName;
- }
-
- public void setSubscriptionName(String subscriptionName)
- {
- this.subscriptionName = subscriptionName;
- }
-
- public boolean isStoringDeliveries()
- {
- return storingDeliveries;
- }
-
- // Protected ------------------------------------------------------------------------------------
-
- // Package Private ------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner Classes --------------------------------------------------------------------------------
-
- public void handleMessage(final JBossMessage message) throws Exception
- {
- synchronized (mainLock)
- {
- if (closed)
- {
- // Sanity - this should never happen - we should always wait for all deliveries to arrive
- // when closing
- throw new IllegalStateException(this + " is closed, so ignoring message");
- }
-
- message.setSessionDelegate(session, isConnectionConsumer);
-
- message.doBeforeReceive();
-
- //Add it to the buffer
- buffer.addLast(message, message.getJMSPriority());
-
- lastDeliveryId = message.getDeliveryId();
-
- if (trace) { log.trace(this + " added message(s) to the buffer are now " + buffer.size() + " messages"); }
-
- messageAdded();
- }
- }
-
public void setMessageListener(MessageListener listener) throws JMSException
- {
+ {
+ checkClosed();
+
synchronized (mainLock)
{
if (receiverThread != null)
@@ -477,94 +217,39 @@
}
}
- public void cancelBuffer() throws JMSException
+ public boolean getNoLocal() throws JMSException
{
- if (trace) { log.trace("Cancelling buffer: " + buffer.size()); }
+ checkClosed();
- synchronized (mainLock)
- {
- // Now we cancel anything left in the buffer. The reason we do this now is that otherwise
- // the deliveries wouldn't get cancelled until session close (since we don't cancel
- // consumer's deliveries until then), which is too late - since we need to preserve the
- // order of messages delivered in a session.
-
- if (shouldAck && !buffer.isEmpty())
- {
- // Now we cancel any deliveries that might be waiting in our buffer. This is because
- // otherwise the messages wouldn't get cancelled until the corresponding session died.
- // So if another consumer in another session tried to consume from the channel before
- // that session died it wouldn't receive those messages.
- // We can't just cancel all the messages in the SCE since some of those messages might
- // have actually been delivered (unlike these) and we may want to acknowledge them
- // later, after this consumer has been closed
+ return this.noLocal;
+ }
+
+ public Destination getDestination() throws JMSException
+ {
+ checkClosed();
+
+ return this.destination;
+ }
+
+ public String getMessageSelector() throws JMSException
+ {
+ checkClosed();
+
+ return this.selector;
+ }
- List cancels = new ArrayList();
-
- for(Iterator i = buffer.iterator(); i.hasNext();)
- {
- JBossMessage mp = (JBossMessage)i.next();
-
- CancelImpl cancel =
- new CancelImpl(mp.getDeliveryId(), mp.getDeliveryCount(), false, false);
-
- cancels.add(cancel);
- }
-
- if (trace) { log.trace("Calling cancelDeliveries"); }
- session.cancelDeliveries(cancels);
- if (trace) { log.trace("Done call"); }
-
- buffer.clear();
- }
- }
+ public int getMaxDeliveries()
+ {
+ return maxDeliveries;
}
- private void close(long lastDeliveryId) throws JMSException
- {
- try
- {
- log.trace(this + " close");
-
- //Wait for the last delivery to arrive
- waitForLastDelivery(lastDeliveryId);
-
- //Important! We set the listener to null so the next ListenerRunner won't run
- if (listener != null)
- {
- setMessageListener(null);
- }
-
- //Now we wait for any current listener runners to run.
- waitForOnMessageToComplete();
-
- synchronized (mainLock)
- {
- if (closed)
- {
- return;
- }
-
- closed = true;
-
- if (receiverThread != null)
- {
- // Wake up any receive() thread that might be waiting
- mainLock.notify();
- }
-
- this.listener = null;
- }
-
- if (trace) { log.trace(this + " closed"); }
- }
- finally
- {
- session.removeChild(this.getID());
- }
+ public long getRedeliveryDelay()
+ {
+ return redeliveryDelay;
}
-
+
/**
- * Method used by the client thread to get a Message, if available.
+ * Method used by the client thread to synchronously get a Message, if available.
*
* @param timeout - the timeout value in milliseconds. A zero timeount never expires, and the
* call blocks indefinitely. A -1 timeout means receiveNoWait(): return the next message
@@ -572,14 +257,16 @@
* concurrently closed.
*/
public JBossMessage receive(long timeout) throws JMSException
- {
+ {
+ checkClosed();
+
JBossMessage m = null;
synchronized (mainLock)
{
if (trace) { log.trace(this + " receiving, timeout = " + timeout); }
- if (closed)
+ if (closing)
{
// If consumer is closed or closing calling receive returns null
if (trace) { log.trace(this + " closed, returning null"); }
@@ -642,7 +329,7 @@
if (trace) { log.trace(this + " received " + m + " after being blocked on buffer"); }
boolean ignore =
- checkExpiredOrReachedMaxdeliveries(m, session, maxDeliveries, shouldAck);
+ MessageHandler.checkExpiredOrReachedMaxdeliveries(m, session, maxDeliveries, shouldAck);
if (!isConnectionConsumer && !ignore)
{
@@ -703,9 +390,11 @@
return m;
}
-
+
public void addToFrontOfBuffer(JBossMessage proxy) throws JMSException
{
+ checkClosed();
+
synchronized (mainLock)
{
buffer.addFirst(proxy, proxy.getJMSPriority());
@@ -715,55 +404,137 @@
messageAdded();
}
}
-
- public void pause()
+
+ public boolean isShouldAck()
{
+ return this.shouldAck;
+ }
+
+ public void handleMessage(final JBossMessage message) throws Exception
+ {
synchronized (mainLock)
{
- paused = true;
+ if (closing)
+ {
+ // Sanity - this should never happen - we should always wait for all deliveries to arrive
+ // when closing
+ throw new IllegalStateException(this + " is closed, so ignoring message");
+ }
- sendChangeRateMessage(0f);
+ message.setSession(session, isConnectionConsumer);
+
+ message.doBeforeReceive();
+
+ //Add it to the buffer
+ buffer.addLast(message, message.getJMSPriority());
+
+ lastDeliveryId = message.getDeliveryId();
+
+ if (trace) { log.trace(this + " added message(s) to the buffer are now " + buffer.size() + " messages"); }
+
+ messageAdded();
}
}
-
- public void resume()
- {
- synchronized (mainLock)
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ private void close(long lastDeliveryId) throws JMSException
+ {
+ try
{
- paused = false;
-
- if (firstTime)
+ log.trace(this + " close");
+
+ //Wait for the last delivery to arrive
+ waitForLastDelivery(lastDeliveryId);
+
+ //Important! We set the listener to null so the next ListenerRunner won't run
+ if (listener != null)
{
- consumeCount = 0;
-
- firstTime = false;
+ setMessageListener(null);
}
- else
- {
- consumeCount = bufferSize / 3 - buffer.size();
+
+ //Now we wait for any current listener runners to run.
+ waitForOnMessageToComplete();
+
+ synchronized (mainLock)
+ {
+ if (closing)
+ {
+ return;
+ }
+
+ closing = true;
+
+ if (receiverThread != null)
+ {
+ // Wake up any receive() thread that might be waiting
+ mainLock.notify();
+ }
+
+ this.listener = null;
}
-
- sendChangeRateMessage(1f);
+
+ if (trace) { log.trace(this + " closed"); }
}
+ finally
+ {
+ session.removeChild(id);
+ }
}
- public boolean isShouldAck()
+ private void cancelBuffer() throws JMSException
{
- return this.shouldAck;
- }
-
+ if (trace) { log.trace("Cancelling buffer: " + buffer.size()); }
+
+ synchronized (mainLock)
+ {
+ // Now we cancel anything left in the buffer. The reason we do this now is that otherwise
+ // the deliveries wouldn't get cancelled until session close (since we don't cancel
+ // consumer's deliveries until then), which is too late - since we need to preserve the
+ // order of messages delivered in a session.
+
+ if (shouldAck && !buffer.isEmpty())
+ {
+ // Now we cancel any deliveries that might be waiting in our buffer. This is because
+ // otherwise the messages wouldn't get cancelled until the corresponding session died.
+ // So if another consumer in another session tried to consume from the channel before
+ // that session died it wouldn't receive those messages.
+ // We can't just cancel all the messages in the SCE since some of those messages might
+ // have actually been delivered (unlike these) and we may want to acknowledge them
+ // later, after this consumer has been closed
- // Package protected ----------------------------------------------------------------------------
+ List cancels = new ArrayList();
- // Protected ------------------------------------------------------------------------------------
+ for(Iterator i = buffer.iterator(); i.hasNext();)
+ {
+ JBossMessage mp = (JBossMessage)i.next();
+
+ CancelImpl cancel =
+ new CancelImpl(mp.getDeliveryId(), mp.getDeliveryCount(), false, false);
+
+ cancels.add(cancel);
+ }
+
+ if (trace) { log.trace("Calling cancelDeliveries"); }
+ session.cancelDeliveries(cancels);
+ if (trace) { log.trace("Done call"); }
- // Private --------------------------------------------------------------------------------------
+ buffer.clear();
+ }
+ }
+ }
private void checkSendChangeRate()
{
consumeCount++;
- if (!paused && consumeCount == bufferSize)
+ if (consumeCount == bufferSize)
{
consumeCount = 0;
@@ -823,8 +594,6 @@
{
try
{
- // this invocation will be sent asynchronously to the server; it's DelegateSupport.invoke()
- // job to detect it and turn it into a remoting one way invocation.
changeRate(newRate);
}
catch (JMSException e)
@@ -945,7 +714,7 @@
if (timeout == 0)
{
// wait for ever potentially
- while (!closed && buffer.isEmpty())
+ while (!closing && buffer.isEmpty())
{
if (trace) { log.trace(this + " waiting on main lock, no timeout"); }
@@ -959,7 +728,7 @@
// wait with timeout
long toWait = timeout;
- while (!closed && buffer.isEmpty() && toWait > 0)
+ while (!closing && buffer.isEmpty() && toWait > 0)
{
if (trace) { log.trace(this + " waiting on main lock, timeout " + toWait + " ms"); }
@@ -978,7 +747,7 @@
JBossMessage m = null;
- if (!closed && !buffer.isEmpty())
+ if (!closing && !buffer.isEmpty())
{
m = (JBossMessage)buffer.removeFirst();
@@ -988,6 +757,14 @@
return m;
}
+ private void checkClosed() throws IllegalStateException
+ {
+ if (closed)
+ {
+ throw new IllegalStateException("Consumer is closed");
+ }
+ }
+
// Inner classes --------------------------------------------------------------------------------
/*
@@ -1058,7 +835,7 @@
{
try
{
- callOnMessage(session, theListener, id,
+ MessageHandler.callOnMessage(session, theListener, id,
false, msg, session.getAcknowledgeMode(), maxDeliveries, null, shouldAck);
if (trace) { log.trace("Called callonMessage"); }
@@ -1092,6 +869,5 @@
if (trace) { log.trace("Exiting run()"); }
}
}
-
-
+
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientProducerImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientProducerImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -25,6 +25,7 @@
import javax.jms.BytesMessage;
import javax.jms.DeliveryMode;
+import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
@@ -32,7 +33,7 @@
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
-import org.jboss.jms.client.api.ClientConnection;
+
import org.jboss.jms.client.api.ClientProducer;
import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.destination.JBossDestination;
@@ -42,10 +43,9 @@
import org.jboss.jms.message.JBossObjectMessage;
import org.jboss.jms.message.JBossStreamMessage;
import org.jboss.jms.message.JBossTextMessage;
-import org.jboss.messaging.core.remoting.Client;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.DestinationType;
import org.jboss.messaging.core.impl.DestinationImpl;
+import org.jboss.messaging.util.Logger;
/**
* The client-side Producer delegate class.
@@ -58,91 +58,80 @@
*
* $Id: ClientProducerImpl.java 3602 2008-01-21 17:48:32Z timfox $
*/
-public class ClientProducerImpl extends CommunicationSupport implements ClientProducer
+public class ClientProducerImpl implements ClientProducer
{
// Constants ------------------------------------------------------------------------------------
- private static final long serialVersionUID = -6976930316308905681L;
private static final Logger log = Logger.getLogger(ClientProducerImpl.class);
// Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
- private ClientConnection connection;
private ClientSession session;
+
private JBossDestination destination;
private boolean disableMessageID = false;
+
private boolean disableMessageTimestamp = false;
+
private int priority = 4;
+
private long timeToLive = 0;
+
private int deliveryMode = DeliveryMode.PERSISTENT;
-
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
+ private String id;
+ private volatile boolean closed;
+ // Static ---------------------------------------------------------------------------------------
- // DelegateSupport overrides --------------------------------------------------------------------
-
- public ClientProducerImpl(ClientConnection connection,
- ClientSession session, JBossDestination destination)
+ // Constructors ---------------------------------------------------------------------------------
+
+ public ClientProducerImpl(ClientSession session, JBossDestination destination)
{
- super(UUID.randomUUID().toString());
- this.connection = connection;
this.session = session;
+
this.destination = destination;
+
+ this.id = UUID.randomUUID().toString();
}
- // ProducerDelegate implementation --------------------------------------------------------------
-
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public void close() throws JMSException
+ public String getID()
{
- session.removeChild(this.getID());
- return;
+ return id;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public long closing(long sequence) throws JMSException
+ public synchronized void close() throws JMSException
{
- return -1;
+ if (closed)
+ {
+ return;
+ }
+ session.removeChild(id);
+
+ closed = true;
}
- public void setDestination(JBossDestination dest)
+ public synchronized long closing(long sequence) throws JMSException
{
- this.destination = dest;
+ return -1;
}
public JBossDestination getDestination() throws JMSException
{
+ checkClosed();
+
return this.destination;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public void send(JBossDestination destination, Message m, int deliveryMode,
- int priority, long timeToLive) throws JMSException
+ public void send(JBossDestination destination, Message m, int deliveryMode, int priority,
+ long timeToLive) throws JMSException
{
- send(destination, m, deliveryMode, priority, timeToLive, false);
- }
-
-
- public void send(JBossDestination destination, Message m, int deliveryMode, int priority, long timeToLive, boolean keepID) throws JMSException
- {
-
+ checkClosed();
+
// configure the message for sending, using attributes stored as metadata
if (deliveryMode == -1)
@@ -267,6 +256,8 @@
jbm = (JBossMessage)m;
}
+ final boolean keepID = false;
+
if (!keepID)
{
//Generate an id
@@ -315,82 +306,90 @@
public void setDeliveryMode(int deliveryMode) throws JMSException
{
+ checkClosed();
+
this.deliveryMode = deliveryMode;
}
public int getDeliveryMode() throws JMSException
{
+ checkClosed();
+
return this.deliveryMode;
}
-
-
-
+
public boolean isDisableMessageID() throws JMSException
{
+ checkClosed();
+
return this.disableMessageID;
}
public void setDisableMessageID(boolean value) throws JMSException
{
+ checkClosed();
+
this.disableMessageID = value;
}
public boolean isDisableMessageTimestamp() throws JMSException
- {
+ {
+ checkClosed();
+
return this.disableMessageTimestamp;
}
public void setDisableMessageTimestamp(boolean value) throws JMSException
{
+ checkClosed();
+
this.disableMessageTimestamp = value;
}
public void setPriority(int priority) throws JMSException
{
+ checkClosed();
+
this.priority = priority;
}
public int getPriority() throws JMSException
{
+ checkClosed();
+
return this.priority;
}
public long getTimeToLive() throws JMSException
{
- return this.timeToLive;
+ checkClosed();
+
+ return this.timeToLive;
}
-
public void setTimeToLive(long timeToLive) throws JMSException
{
+ checkClosed();
+
this.timeToLive = timeToLive;
}
// Public ---------------------------------------------------------------------------------------
- public String toString()
- {
- return "ProducerDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
- }
-
// Protected ------------------------------------------------------------------------------------
-
- @Override
- protected Client getClient()
- {
- return connection.getClient();
- }
// Package Private ------------------------------------------------------------------------------
- @Override
- protected byte getVersion()
- {
- return connection.getVersion();
- }
-
// Private --------------------------------------------------------------------------------------
+ private void checkClosed() throws IllegalStateException
+ {
+ if (closed)
+ {
+ throw new IllegalStateException("Producer is closed");
+ }
+ }
+
// Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClientSessionImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClientSessionImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,10 @@
*/
package org.jboss.jms.client.impl;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -35,7 +32,6 @@
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
-import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.TransactionInProgressException;
import javax.transaction.xa.XAResource;
@@ -47,6 +43,7 @@
import org.jboss.jms.client.api.ClientConsumer;
import org.jboss.jms.client.api.ClientProducer;
import org.jboss.jms.client.api.ClientSession;
+import org.jboss.jms.client.remoting.MessagingRemotingConnection;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTopic;
@@ -60,8 +57,8 @@
import org.jboss.jms.tx.MessagingXAResource;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.messaging.core.Destination;
+import org.jboss.messaging.core.DestinationType;
import org.jboss.messaging.core.Message;
-import org.jboss.messaging.core.remoting.Client;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveriesMessage;
import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveryRequest;
@@ -83,13 +80,10 @@
import org.jboss.messaging.core.remoting.wireformat.UnsubscribeMessage;
import org.jboss.messaging.util.ClearableQueuedExecutor;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.util.ProxyFactory;
import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
/**
- * The client-side Session delegate class.
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
@@ -99,7 +93,7 @@
*
* $Id: ClientSessionImpl.java 3603 2008-01-21 18:49:20Z timfox $
*/
-public class ClientSessionImpl extends CommunicationSupport implements ClientSession
+public class ClientSessionImpl implements ClientSession
{
// Constants ------------------------------------------------------------------------------------
@@ -107,17 +101,17 @@
private boolean trace = log.isTraceEnabled();
- private static final long serialVersionUID = -8096852898620279131L;
-
// Attributes -----------------------------------------------------------------------------------
+ private String id;
+
private int dupsOKBatchSize;
private boolean strictTck;
private ClientConnection connection;
- protected Map<String, Closeable> children = new ConcurrentHashMap<String, Closeable>();
+ private Map<String, Closeable> children = new ConcurrentHashMap<String, Closeable>();
private int acknowledgeMode;
@@ -126,6 +120,7 @@
private boolean xa;
private MessagingXAResource xaResource;
+
private Object currentTxId;
// Executor used for executing onMessage methods
@@ -133,17 +128,10 @@
private boolean recoverCalled;
- // List<DeliveryInfo>
- private List<Ack> clientAckList;
+ private List<Ack> clientAckList = new ArrayList<Ack>();
private DeliveryInfo autoAckInfo;
- //private Map callbackHandlers = new ConcurrentHashMap();
-
- private LinkedList asfMessages = new LinkedList();
-
- //The distinguished message listener - for ASF
- private MessageListener sessionListener;
-
+
//This is somewhat strange - but some of the MQ and TCK tests expect an XA session to behavior as AUTO_ACKNOWLEDGE when not enlisted in
//a transaction
//This is the opposite behavior as what is required when the XA session handles MDB delivery or when using the message bridge.
@@ -153,26 +141,24 @@
private long npSendSequence;
- // Constructors ---------------------------------------------------------------------------------
+ private MessagingRemotingConnection remotingConnection;
- public ClientSessionImpl(ClientConnection connection, String objectID, int dupsOKBatchSize)
- {
- super(objectID);
- this.connection = connection;
- this.dupsOKBatchSize = dupsOKBatchSize;
- }
+ private volatile boolean closed;
- public ClientSessionImpl(ClientConnectionImpl connection, String objectID, int dupsOKBatchSize, boolean strictTCK,
+ // Constructors ---------------------------------------------------------------------------------
+
+ public ClientSessionImpl(ClientConnection connection, String id, int dupsOKBatchSize, boolean strictTCK,
boolean transacted, int acknowledgmentMode, boolean xa)
{
- super(objectID);
-
+ this.id = id;
this.connection = connection;
+ this.remotingConnection = connection.getRemotingConnection();
this.dupsOKBatchSize = dupsOKBatchSize;
this.strictTck = strictTCK;
this.transacted = transacted;
this.xa = xa;
this.acknowledgeMode = acknowledgmentMode;
+
executor = new ClearableQueuedExecutor(new LinkedQueue());
if (xa)
@@ -180,26 +166,31 @@
// Create an XA resource
xaResource = new MessagingXAResource(connection.getResourceManager(), this);
}
-
if (transacted)
{
// Create a local tx
currentTxId = connection.getResourceManager().createLocalTx();
}
-
- clientAckList = new ArrayList();
}
-
- public ClientSessionImpl()
+
+ // ClientSession implementation ----------------------------------------------------
+
+ public String getID()
{
+ return id;
}
- public void close() throws JMSException
+ public synchronized void close() throws JMSException
{
+ if (closed)
+ {
+ return;
+ }
+
try
{
- sendBlocking(new CloseMessage());
+ remotingConnection.sendBlocking(id, new CloseMessage());
Object xid = getCurrentTxId();
@@ -211,34 +202,23 @@
// We must explicitly shutdown the executor
- getExecutor().shutdownNow();
+ executor.shutdownNow();
}
finally
{
- connection.removeChild(this.getID());
+ connection.removeChild(id);
+
+ closed = true;
}
}
-
- private long invokeClosing(long sequence) throws JMSException
- {
- long seq = getNPSendSequence();
- ClosingRequest request = new ClosingRequest(seq);
- ClosingResponse response = (ClosingResponse) sendBlocking(request);
- return response.getID();
- }
-
- private void closeChildren() throws JMSException
+
+ public long closing(long sequence) throws JMSException
{
- Set<Closeable> chilrenValues = new HashSet<Closeable>(children.values());
- for (Closeable child: chilrenValues)
+ if (closed)
{
- child.closing(-1);
- child.close();
+ return -1;
}
- }
-
- public long closing(long sequence) throws JMSException
- {
+
if (trace) { log.trace("handleClosing()"); }
closeChildren();
@@ -276,21 +256,19 @@
{
//Acknowledge or cancel any outstanding auto ack
- DeliveryInfo remainingAutoAck = getAutoAckInfo();
-
- if (remainingAutoAck != null)
+ if (autoAckInfo != null)
{
- if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
+ if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + autoAckInfo); }
try
{
- ackDelivery(remainingAutoAck);
+ ackDelivery(autoAckInfo);
if (trace) { log.trace(this + " acked it"); }
}
finally
{
- setAutoAckInfo(null);
+ autoAckInfo = null;
}
}
}
@@ -298,17 +276,17 @@
{
//Ack any remaining deliveries
- if (!getClientAckList().isEmpty())
+ if (!clientAckList.isEmpty())
{
try
{
- acknowledgeDeliveries(getClientAckList());
+ acknowledgeDeliveries(clientAckList);
}
finally
{
- getClientAckList().clear();
+ clientAckList.clear();
- setAutoAckInfo(null);
+ autoAckInfo = null;
}
}
}
@@ -322,9 +300,9 @@
// CLIENT_ACKNOWLEDGE cannot be used with MDBs (i.e. no connection consumer)
// so is always safe to cancel on this session
- internalCancelDeliveries(getClientAckList());
+ internalCancelDeliveries(clientAckList);
- getClientAckList().clear();
+ clientAckList.clear();
}
else if (isTransacted() && !isXA())
{
@@ -336,59 +314,62 @@
internalCancelDeliveries(dels);
}
- return invokeClosing(sequence);
-
+ ClosingRequest request = new ClosingRequest(npSendSequence);
+
+ ClosingResponse response = (ClosingResponse)remotingConnection.sendBlocking(id, request);
+
+ return response.getID();
}
- // SessionDelegate implementation ---------------------------------------------------------------
-
public ClientConnection getConnection()
{
return connection;
}
- public void setConnection(ClientConnection connection)
- {
- this.connection = connection;
- }
-
-
public boolean acknowledgeDelivery(Ack ack) throws JMSException
{
+ checkClosed();
+
AcknowledgeDeliveryRequest request = new AcknowledgeDeliveryRequest(ack.getDeliveryID());
- AcknowledgeDeliveryResponse response = (AcknowledgeDeliveryResponse) sendBlocking(request);
+
+ AcknowledgeDeliveryResponse response =
+ (AcknowledgeDeliveryResponse)remotingConnection.sendBlocking(id, request);
return response.isAcknowledged();
}
public void acknowledgeDeliveries(List<Ack> acks) throws JMSException
{
- sendBlocking(new AcknowledgeDeliveriesMessage(acks));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new AcknowledgeDeliveriesMessage(acks));
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public void acknowledgeAll() throws JMSException
{
- if (!getClientAckList().isEmpty())
+ checkClosed();
+
+ if (!clientAckList.isEmpty())
{
//CLIENT_ACKNOWLEDGE can't be used with a MDB so it is safe to always acknowledge all
//on this session (rather than the connection consumer session)
- acknowledgeDeliveries(getClientAckList());
+ acknowledgeDeliveries(clientAckList);
- getClientAckList().clear();
+ clientAckList.clear();
}
}
public void addTemporaryDestination(Destination destination) throws JMSException
{
- sendBlocking(new AddTemporaryDestinationMessage(destination));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new AddTemporaryDestinationMessage(destination));
}
public void commit() throws JMSException
{
+ checkClosed();
+
if (!isTransacted())
{
throw new IllegalStateException("Cannot commit a non-transacted session");
@@ -411,160 +392,177 @@
}
-
- public ClientBrowser createBrowserDelegate(Destination queue, String messageSelector)
+ public ClientBrowser createClientBrowser(Destination queue, String messageSelector)
throws JMSException
{
+ checkClosed();
+
String coreSelector = SelectorTranslator.convertToJBMFilterString(messageSelector);
+
CreateBrowserRequest request = new CreateBrowserRequest(queue, coreSelector);
- CreateBrowserResponse response = (CreateBrowserResponse) sendBlocking(request);
- ClientBrowserImpl delegate = new ClientBrowserImpl(this, response.getBrowserID(), queue, messageSelector);
- ClientBrowser proxy = (ClientBrowser)ProxyFactory.proxy(delegate, ClientBrowser.class);
- children.put(delegate.getID(), proxy);
- return proxy;
+
+ CreateBrowserResponse response = (CreateBrowserResponse)remotingConnection.sendBlocking(id, request);
+
+ ClientBrowser browser = new ClientBrowserImpl(remotingConnection, this, response.getBrowserID());
+
+ children.put(response.getBrowserID(), browser);
+
+ return browser;
}
-
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public JBossBytesMessage createBytesMessage() throws JMSException
- {
- JBossBytesMessage jbm = new JBossBytesMessage();
- return jbm;
- }
-
-
- public ClientConsumer createConsumerDelegate(Destination destination, String selector,
+
+ public ClientConsumer createClientConsumer(Destination destination, String selector,
boolean noLocal, String subscriptionName,
boolean isCC) throws JMSException
{
+ checkClosed();
+
String coreSelector = SelectorTranslator.convertToJBMFilterString(selector);
+
CreateConsumerRequest request =
new CreateConsumerRequest(destination, coreSelector, noLocal, subscriptionName, isCC);
- CreateConsumerResponse response = (CreateConsumerResponse) sendBlocking(request);
+ CreateConsumerResponse response = (CreateConsumerResponse)remotingConnection.sendBlocking(id, request);
+
+ boolean shouldAck = !(destination.getType() == DestinationType.TOPIC && subscriptionName == null);
- ClientConsumerImpl consumerDelegate =
+ ClientConsumer consumer =
new ClientConsumerImpl(this, response.getConsumerID(), response.getBufferSize(),
response.getMaxDeliveries(), response.getRedeliveryDelay(),
destination,
- selector, noLocal, subscriptionName,
- isCC, this.getExecutor());
+ selector, noLocal,
+ isCC, executor, remotingConnection, shouldAck);
- ClientConsumer proxy = (ClientConsumer)ProxyFactory.proxy(consumerDelegate, ClientConsumer.class);
-
- children.put(consumerDelegate.getID(), proxy);
+ children.put(response.getConsumerID(), consumer);
- PacketDispatcher.client.register(new ClientConsumerPacketHandler(consumerDelegate, consumerDelegate.getID()));
+ PacketDispatcher.client.register(new ClientConsumerPacketHandler(consumer, response.getConsumerID()));
//Now we have finished creating the client consumer, we can tell the SCD
//we are ready
- consumerDelegate.changeRate(1);
+ consumer.changeRate(1);
- return proxy;
+ return consumer;
}
+
+ public JBossBytesMessage createBytesMessage() throws JMSException
+ {
+ checkClosed();
+
+ JBossBytesMessage jbm = new JBossBytesMessage();
+
+ return jbm;
+ }
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public JBossMapMessage createMapMessage() throws JMSException
{
+ checkClosed();
+
JBossMapMessage jbm = new JBossMapMessage();
+
return jbm;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public JBossMessage createMessage() throws JMSException
{
+ checkClosed();
+
JBossMessage jbm = new JBossMessage();
+
return jbm;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public JBossObjectMessage createObjectMessage() throws JMSException
{
+ checkClosed();
+
JBossObjectMessage jbm = new JBossObjectMessage();
+
return jbm;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public JBossObjectMessage createObjectMessage(Serializable object) throws JMSException
{
+ checkClosed();
+
JBossObjectMessage jbm = new JBossObjectMessage();
+
jbm.setObject(object);
+
return jbm;
}
-
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public ClientProducer createProducerDelegate(JBossDestination destination) throws JMSException
+ public ClientProducer createClientProducer(JBossDestination destination) throws JMSException
{
- // ProducerDelegates are not created on the server
-
- ClientProducerImpl producerDelegate = new ClientProducerImpl(connection, this, destination );
- ClientProducer proxy = (ClientProducer) ProxyFactory.proxy(producerDelegate, ClientProducer.class);
- children.put(producerDelegate.getID(), proxy);
- return proxy;
+ checkClosed();
+
+ ClientProducer producer = new ClientProducerImpl(this, destination);
+
+ children.put(producer.getID(), producer);
+
+ return producer;
}
public JBossQueue createQueue(String queueName) throws JMSException
{
- CreateDestinationRequest request = new CreateDestinationRequest(queueName, true);
- CreateDestinationResponse response = (CreateDestinationResponse) sendBlocking(request);
+ checkClosed();
+
+ CreateDestinationRequest request = new CreateDestinationRequest(queueName, true);
+
+ CreateDestinationResponse response = (CreateDestinationResponse)remotingConnection.sendBlocking(id, request);
+
return (JBossQueue) response.getDestination();
}
public JBossStreamMessage createStreamMessage() throws JMSException
{
+ checkClosed();
+
JBossStreamMessage jbm = new JBossStreamMessage();
+
return jbm;
}
public JBossTextMessage createTextMessage() throws JMSException
{
+ checkClosed();
+
JBossTextMessage jbm = new JBossTextMessage();
+
return jbm;
}
public JBossTextMessage createTextMessage(String text) throws JMSException
{
+ checkClosed();
+
JBossTextMessage jbm = new JBossTextMessage();
+
jbm.setText(text);
+
return jbm;
}
public JBossTopic createTopic(String topicName) throws JMSException
{
- CreateDestinationRequest request = new CreateDestinationRequest(topicName, false);
- CreateDestinationResponse response = (CreateDestinationResponse) sendBlocking(request);
+ checkClosed();
+
+ CreateDestinationRequest request = new CreateDestinationRequest(topicName, false);
+
+ CreateDestinationResponse response = (CreateDestinationResponse)remotingConnection.sendBlocking(id, request);
+
return (JBossTopic) response.getDestination();
}
public void deleteTemporaryDestination(Destination destination) throws JMSException
{
- sendBlocking(new DeleteTemporaryDestinationMessage(destination));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new DeleteTemporaryDestinationMessage(destination));
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public boolean postDeliver() throws JMSException
{
+ checkClosed();
+
int ackMode = getAcknowledgeMode();
boolean res = true;
@@ -576,16 +574,14 @@
// It is possible that session.recover() is called inside a message listener onMessage
// method - i.e. between the invocations of preDeliver and postDeliver. In this case we
// don't want to acknowledge the last delivered messages - since it will be redelivered.
- if (!isRecoverCalled())
+ if (!recoverCalled)
{
- DeliveryInfo delivery = getAutoAckInfo();
-
- if (delivery == null)
+ if (autoAckInfo == null)
{
throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
}
- if (trace) { log.trace(this + " auto acknowledging delivery " + delivery); }
+ if (trace) { log.trace(this + " auto acknowledging delivery " + autoAckInfo); }
// We clear the state in a finally so then we don't get a knock on
// exception on the next ack since we haven't cleared the state. See
@@ -596,39 +592,38 @@
try
{
- res = ackDelivery(delivery);
+ res = ackDelivery(autoAckInfo);
}
finally
{
- setAutoAckInfo(null);
+ autoAckInfo = null;
}
}
else
{
if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
- setRecoverCalled(false);
+ recoverCalled = false;
}
}
else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
{
- List acks = getClientAckList();
-
- if (!isRecoverCalled())
+ if (!recoverCalled)
{
- if (acks.size() >= getDupsOKBatchSize())
+ if (clientAckList.size() >= getDupsOKBatchSize())
{
// We clear the state in a finally
// http://jira.jboss.org/jira/browse/JBMESSAGING-852
try
{
- acknowledgeDeliveries(acks);
+ acknowledgeDeliveries(clientAckList);
}
finally
{
- acks.clear();
- setAutoAckInfo(null);
+ clientAckList.clear();
+
+ autoAckInfo = null;
}
}
}
@@ -636,20 +631,19 @@
{
if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }
- setRecoverCalled(false);
+ recoverCalled = false;
}
- setAutoAckInfo(null);
+
+ autoAckInfo = null;
}
return Boolean.valueOf(res);
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public void preDeliver(DeliveryInfo info) throws JMSException
{
+ checkClosed();
+
int ackMode = getAcknowledgeMode();
if (ackMode == Session.CLIENT_ACKNOWLEDGE)
@@ -665,7 +659,7 @@
"CLIENT_ACKNOWLEDGE cannot be used with a connection consumer");
}
- getClientAckList().add(info);
+ clientAckList.add(info);
}
// if XA and there is no transaction enlisted on XA we will act as AutoAcknowledge
// However if it's a MDB (if there is a DistinguishedListener) we should behaved as transacted
@@ -675,16 +669,16 @@
if (trace) { log.trace(this + " added " + info + " to session state"); }
- setAutoAckInfo(info);
+ autoAckInfo = info;
}
else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
{
if (trace) { log.trace(this + " added to DUPS_OK_ACKNOWLEDGE list delivery " + info); }
- getClientAckList().add(info);
+ clientAckList.add(info);
//Also set here - this would be used for recovery in a message listener
- setAutoAckInfo(info);
+ autoAckInfo = info;
}
else
{
@@ -703,25 +697,21 @@
// session ID
- ClientSession connectionConsumerDelegate =
+ ClientSession connectionConsumerSession =
info.getConnectionConsumerSession();
- String sessionId = connectionConsumerDelegate != null ?
- connectionConsumerDelegate.getID() : this.getID();
+ String sessionId = connectionConsumerSession != null ?
+ connectionConsumerSession.getID() : this.getID();
connection.getResourceManager().addAck(txID, sessionId, info);
}
}
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public void recover() throws JMSException
{
- if (trace) { log.trace("recover called"); }
-
+ checkClosed();
+
if (isTransacted() && !isXAAndConsideredNonTransacted())
{
throw new IllegalStateException("Cannot recover a transacted session");
@@ -733,67 +723,37 @@
if (ackMode == Session.CLIENT_ACKNOWLEDGE)
{
- List dels = getClientAckList();
+ List<Ack> dels = clientAckList;
- setClientAckList(new ArrayList());
+ clientAckList = new ArrayList<Ack>();
redeliver(dels);
- setRecoverCalled(true);
+ recoverCalled = true;
}
else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE || isXAAndConsideredNonTransacted())
- {
- DeliveryInfo info = getAutoAckInfo();
-
+ {
//Don't recover if it's already to cancel
- if (info != null)
+ if (autoAckInfo != null)
{
- List redels = new ArrayList();
+ List<Ack> redels = new ArrayList<Ack>();
- redels.add(info);
+ redels.add(autoAckInfo);
redeliver(redels);
- setAutoAckInfo(null);
+ autoAckInfo = null;
- setRecoverCalled(true);
+ recoverCalled = true;
}
}
}
- /**
- * Redelivery occurs in two situations:
- *
- * 1) When session.recover() is called (JMS1.1 4.4.11)
- *
- * "A session's recover method is used to stop a session and restart it with its first
- * unacknowledged message. In effect, the session's series of delivered messages is reset to the
- * point after its last acknowledged message."
- *
- * An important note here is that session recovery is LOCAL to the session. Session recovery DOES
- * NOT result in delivered messages being cancelled back to the channel where they can be
- * redelivered - since that may result in them being picked up by another session, which would
- * break the semantics of recovery as described in the spec.
- *
- * 2) When session rollback occurs (JMS1.1 4.4.7). On rollback of a session the spec is clear
- * that session recovery occurs:
- *
- * "If a transaction rollback is done, its produced messages are destroyed and its consumed
- * messages are automatically recovered. For more information on session recovery, see Section
- * 4.4.11 'Message Acknowledgment.'"
- *
- * So on rollback we do session recovery (local redelivery) in the same as if session.recover()
- * was called.
- *
- * All cancellation at rollback is driven from the client side - we always attempt to redeliver
- * messages to their original consumers if they are still open, or then cancel them to the server
- * if they are not. Cancelling them to the server explicitly allows the delivery count to be updated.
- *
- *
- */
public void redeliver(List toRedeliver) throws JMSException
{
+ checkClosed();
+
// We put the messages back in the front of their appropriate consumer buffers
if (trace) { log.trace(this + " handleRedeliver() called: " + toRedeliver); }
@@ -828,12 +788,10 @@
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public void rollback() throws JMSException
{
+ checkClosed();
+
if (!isTransacted())
{
throw new IllegalStateException("Cannot rollback a non-transacted session");
@@ -857,110 +815,29 @@
}
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public void run() throws JMSException
- {
- if (trace) { log.trace("run()"); }
-
- int ackMode = getAcknowledgeMode();
-
- LinkedList msgs = getAsfMessages();
-
- while (msgs.size() > 0)
- {
- AsfMessageHolder holder = (AsfMessageHolder)msgs.removeFirst();
-
- if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
-
- ClientConsumerImpl.callOnMessage(this, getDistinguishedListener(), holder.consumerID,
- false,
- holder.msg, ackMode, holder.maxDeliveries,
- holder.connectionConsumerDelegate, holder.shouldAck);
- }
- }
-
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public void setMessageListener(MessageListener listener) throws JMSException
- {
- if (trace) { log.trace("setMessageListener()"); }
-
- if (listener == null)
- {
- throw new IllegalStateException("Cannot set a null MessageListener on the session");
- }
-
- setDistinguishedListener(listener);
- }
-
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public MessageListener getMessageListener() throws JMSException
- {
- if (trace) { log.trace("getMessageListener()"); }
-
- return getDistinguishedListener();
- }
-
-
-
public void unsubscribe(String subscriptionName) throws JMSException
{
- sendBlocking(new UnsubscribeMessage(subscriptionName));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new UnsubscribeMessage(subscriptionName));
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
public XAResource getXAResource()
{
return xaResource;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public int getAcknowledgeMode()
+ public int getAcknowledgeMode() throws JMSException
{
+ checkClosed();
+
return acknowledgeMode;
}
- /**
- * This invocation should either be handled by the client-side interceptor chain or by the
- * server-side endpoint.
- */
- public void addAsfMessage(JBossMessage m, String theConsumerID, String queueName, int maxDeliveries,
- ClientSession connectionConsumerDelegate, boolean shouldAck) throws JMSException
- {
- // Load the session with a message to be processed during a subsequent call to run()
-
- if (m == null)
- {
- throw new IllegalStateException("Cannot add a null message to the session");
- }
-
- AsfMessageHolder holder = new AsfMessageHolder();
- holder.msg = m;
- holder.consumerID = theConsumerID;
- holder.queueName = queueName;
- holder.maxDeliveries = maxDeliveries;
- holder.connectionConsumerDelegate = connectionConsumerDelegate;
- holder.shouldAck = shouldAck;
-
- getAsfMessages().add(holder);
- }
-
public void send(Message m) throws JMSException
{
+ checkClosed();
+
Object txID = getCurrentTxId();
// If there is no GlobalTransaction we run it as local transacted
@@ -985,105 +862,131 @@
if (trace) { log.trace("sending message NON-transactionally"); }
invokeSend(m);
-
}
- public void removeChild(String key)
+ public void removeChild(String key) throws JMSException
{
+ checkClosed();
+
children.remove(key);
}
-
- private void invokeSend(Message m) throws JMSException
- {
- long seq;
-
- if (m.isDurable() || strictTck)
- {
- seq = -1;
- }
- else
- {
- seq = this.getNPSendSequence();
-
- this.incNpSendSequence();
- }
-
- SendMessage message = new SendMessage(m, seq);
-
- if (seq == -1)
- {
- sendBlocking(message);
- }
- else
- {
- sendOneWay(message);
- }
- }
-
+
public void cancelDeliveries(List<Cancel> cancels) throws JMSException
{
- sendBlocking(new CancelDeliveriesMessage(cancels));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new CancelDeliveriesMessage(cancels));
}
public void cancelDelivery(Cancel cancel) throws JMSException
{
- sendBlocking(new CancelDeliveryMessage(cancel));
+ checkClosed();
+
+ remotingConnection.sendBlocking(id, new CancelDeliveryMessage(cancel));
}
-
- // Streamable overrides -------------------------------------------------------------------------
-
- public void read(DataInputStream in) throws Exception
+
+ public int getDupsOKBatchSize() throws JMSException
{
- super.read(in);
-
- dupsOKBatchSize = in.readInt();
+ checkClosed();
+
+ return dupsOKBatchSize;
}
- public void write(DataOutputStream out) throws Exception
+ public boolean isStrictTck() throws JMSException
{
- super.write(out);
-
- out.writeInt(dupsOKBatchSize);
+ checkClosed();
+
+ return strictTck;
}
-
- // Public ---------------------------------------------------------------------------------------
-
- public int getDupsOKBatchSize()
+
+ public boolean isXA() throws JMSException
{
- return dupsOKBatchSize;
+ checkClosed();
+
+ return xa;
}
-
- public boolean isStrictTck()
+
+ public Object getCurrentTxId()
{
- return strictTck;
+ return currentTxId;
}
-
- public String toString()
+
+ public void setCurrentTxId(Object currentTxId)
{
- return "SessionDelegate[" + System.identityHashCode(this) + ", ID=" + id + "]";
+ this.currentTxId = currentTxId;
}
- // Protected ------------------------------------------------------------------------------------
-
- @Override
- protected Client getClient()
+ public void setTreatAsNonTransactedWhenNotEnlisted(
+ boolean treatAsNonTransactedWhenNotEnlisted)
{
- return connection.getClient();
+ this.treatAsNonTransactedWhenNotEnlisted = treatAsNonTransactedWhenNotEnlisted;
}
- @Override
- protected byte getVersion()
+ public boolean isTransacted() throws JMSException
{
- return connection.getVersion();
+ checkClosed();
+
+ return transacted;
}
-
-
+ public boolean isClosed()
+ {
+ return closed;
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
// Package Private ------------------------------------------------------------------------------
// Private --------------------------------------------------------------------------------------
- /** http://jira.jboss.org/jira/browse/JBMESSAGING-946 - To accomodate TCK and the MQ behavior
+ private void checkClosed() throws IllegalStateException
+ {
+ if (closed)
+ {
+ throw new IllegalStateException("Session is closed");
+ }
+ }
+
+ private void invokeSend(Message m) throws JMSException
+ {
+ long seq;
+
+ if (m.isDurable() || strictTck)
+ {
+ seq = -1;
+ }
+ else
+ {
+ seq = npSendSequence++;
+ }
+
+ SendMessage message = new SendMessage(m, seq);
+
+ if (seq == -1)
+ {
+ remotingConnection.sendBlocking(id, message);
+ }
+ else
+ {
+ remotingConnection.sendOneWay(id, message);
+ }
+ }
+
+ private void closeChildren() throws JMSException
+ {
+ Set<Closeable> chilrenValues = new HashSet<Closeable>(children.values());
+ for (Closeable child: chilrenValues)
+ {
+ child.closing(-1);
+ child.close();
+ }
+ }
+
+ /** http://jira.jboss.org/jira/browse/JBMESSAGING-946 -
+ * To accomodate TCK and the MQ behavior
* we should behave as non transacted, AUTO_ACK when there is no transaction enlisted
* However when the Session is being used by ASF we should consider the case where
* we will convert LocalTX to GlobalTransactions.
@@ -1098,10 +1001,10 @@
* integration tests and TCK!!! Hence getTreatAsNonTransactedWhenNotEnlisted()
*
* */
- private boolean isXAAndConsideredNonTransacted()
+ private boolean isXAAndConsideredNonTransacted() throws JMSException
{
- return isXA() && (getCurrentTxId() instanceof LocalTx) && getTreatAsNonTransactedWhenNotEnlisted()
- && getDistinguishedListener() == null;
+ return isXA() && (getCurrentTxId() instanceof LocalTx)
+ && treatAsNonTransactedWhenNotEnlisted;
}
@@ -1186,178 +1089,4 @@
// Inner Classes --------------------------------------------------------------------------------
-
- private static class AsfMessageHolder
- {
- private JBossMessage msg;
- private String consumerID;
- private String queueName;
- private int maxDeliveries;
- private ClientSession connectionConsumerDelegate;
- private boolean shouldAck;
- }
-
-
- // TODO verify what should be exposed or not!
- public boolean isXA()
- {
- return xa;
- }
-
- public void setXA(boolean xa)
- {
- this.xa = xa;
- }
-
- public Object getCurrentTxId()
- {
- return currentTxId;
- }
-
- public void setCurrentTxId(Object currentTxId)
- {
- this.currentTxId = currentTxId;
- }
-
- public boolean isRecoverCalled()
- {
- return recoverCalled;
- }
-
- public void setRecoverCalled(boolean recoverCalled)
- {
- this.recoverCalled = recoverCalled;
- }
-
- public List<Ack> getClientAckList()
- {
- return clientAckList;
- }
-
- public void setClientAckList(List<Ack> clientAckList)
- {
- this.clientAckList = clientAckList;
- }
-
- public DeliveryInfo getAutoAckInfo()
- {
- return autoAckInfo;
- }
-
- public void setAutoAckInfo(DeliveryInfo autoAckInfo)
- {
- this.autoAckInfo = autoAckInfo;
- }
-
-// public Map getCallbackHandlers()
-// {
-// return callbackHandlers;
-// }
-//
-// public void setCallbackHandlers(Map callbackHandlers)
-// {
-// this.callbackHandlers = callbackHandlers;
-// }
-
- public LinkedList getAsfMessages()
- {
- return asfMessages;
- }
-
- public void setAsfMessages(LinkedList asfMessages)
- {
- this.asfMessages = asfMessages;
- }
-
- public MessageListener getSessionListener()
- {
- return sessionListener;
- }
-
- public void setSessionListener(MessageListener sessionListener)
- {
- this.sessionListener = sessionListener;
- }
-
- public boolean isTreatAsNonTransactedWhenNotEnlisted()
- {
- return treatAsNonTransactedWhenNotEnlisted;
- }
-
- public void setTreatAsNonTransactedWhenNotEnlisted(
- boolean treatAsNonTransactedWhenNotEnlisted)
- {
- this.treatAsNonTransactedWhenNotEnlisted = treatAsNonTransactedWhenNotEnlisted;
- }
-
- public long getNpSendSequence()
- {
- return npSendSequence;
- }
-
- public void setNpSendSequence(long npSendSequence)
- {
- this.npSendSequence = npSendSequence;
- }
-
- public ClearableQueuedExecutor getExecutor()
- {
- return executor;
- }
-
- public void setDupsOKBatchSize(int dupsOKBatchSize)
- {
- this.dupsOKBatchSize = dupsOKBatchSize;
- }
-
- public void setStrictTck(boolean strictTck)
- {
- this.strictTck = strictTck;
- }
-
- public void setAcknowledgeMode(int acknowledgeMode)
- {
- this.acknowledgeMode = acknowledgeMode;
- }
-
- public boolean isTransacted()
- {
- return transacted;
- }
-
-
-
-
- public void setTransacted(boolean transacted)
- {
- this.transacted = transacted;
- }
-
- public long getNPSendSequence()
- {
- return npSendSequence;
- }
-
- public void incNpSendSequence()
- {
- npSendSequence++;
- }
-
- public boolean getTreatAsNonTransactedWhenNotEnlisted()
- {
- return treatAsNonTransactedWhenNotEnlisted;
- }
-
-
- public MessageListener getDistinguishedListener()
- {
- return this.sessionListener;
- }
-
- public void setDistinguishedListener(MessageListener listener)
- {
- this.sessionListener = listener;
- }
-
-
}
Deleted: trunk/src/main/org/jboss/jms/client/impl/ClosedInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/ClosedInterceptor.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/ClosedInterceptor.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,236 +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.client.impl;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import javax.jms.IllegalStateException;
-
-import org.jboss.messaging.util.Logger;
-
-
-/**
- * An interceptor for checking closed state. It waits for other invocations to complete before
- * allowing the close. I.e. it performs the function of a "valve".
- *
- * This interceptor is PER_INSTANCE.
- *
- * @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:ovidiu at feodorov.com>Ovidiu Feodorov</a>
- *
- * $Id$
- */
-public class ClosedInterceptor implements InvocationHandler
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(ClosedInterceptor.class);
- private static boolean trace = log.isTraceEnabled();
-
- private static final int NOT_CLOSED = 0;
- private static final int IN_CLOSING = 1;
- private static final int CLOSING = 2;
- private static final int IN_CLOSE = 3; // performing the close
- private static final int CLOSED = -1;
-
- // Attributes ----------------------------------------------------
-
-
- // The current state of the object guarded by this interceptor
- private int state = NOT_CLOSED;
-
- // The inuse count
- private int inUseCount;
-
-
- private Object target;
-
- // Static --------------------------------------------------------
-
- public static String stateToString(int state)
- {
- return state == NOT_CLOSED ? "NOT_CLOSED" :
- state == IN_CLOSING ? "IN_CLOSING" :
- state == CLOSING ? "CLOSING" :
- state == IN_CLOSE ? "IN_CLOSE" :
- state == CLOSED ? "CLOSED" : "UNKNOWN";
- }
-
- // Constructors --------------------------------------------------
-
- public ClosedInterceptor(Object target)
- {
- state = NOT_CLOSED;
- inUseCount = 0;
- this.target=target;
- }
-
- // Public --------------------------------------------------------
-
-
- public Object getTarget()
- {
- return target;
- }
-
- public String toString()
- {
- return "ClosedInterceptor for (" + target + ")";
- }
-
- // Interceptor implementation -----------------------------------
-
- public String getName()
- {
- return "ClosedInterceptor";
- }
-
- public Object invoke(Object o, Method method, Object[] args) throws Throwable
- {
- String methodName = method.getName();
-
- boolean isClosing = methodName.equals("closing");
- boolean isClose = methodName.equals("close");
-
- synchronized(this)
- {
- // object "in use", increment inUseCount
- if (state == CLOSED)
- {
- if (isClosing || isClose)
- {
- return new Long(-1);
- }
- log.error(this + ": method " + methodName + "() did not go through, " +
- "the interceptor is " + stateToString(state));
-
- throw new IllegalStateException("The object is closed");
- }
- ++inUseCount;
- }
-
- try
- {
- return method.invoke(target, args);
- }
- catch (InvocationTargetException exT)
- {
- Throwable t = exT.getCause();
-
- if (isClosing || isClose)
- {
- log.warn(t.getMessage(), t);
- //We swallow exceptions in close/closing, this is because if the connection fails, it is naturally for code to then close
- //in a finally block, it would not then be appropriate to throw an exception. This is a common technique
- //Close should ALWAYS (well apart from Errors) succeed irrespective of whether the actual connection to the server is alive.
- return new Long(-1);
- }
- throw t;
- }
- finally
- {
- if (isClose)
- {
- closed();
- }
- else
- {
- done();
- }
- }
- }
-
- // Protected ------------------------------------------------------
-
- /**
- * Check the closing notification has not already been done
- *
- * @return true when already closing or closed
- */
- protected synchronized boolean checkClosingAlreadyDone() throws Throwable
- {
- if (state != NOT_CLOSED)
- {
- return true;
- }
- state = IN_CLOSING;
- return false;
- }
-
- /**
- * Closing the object
- */
- protected synchronized void closing() throws Throwable
- {
- state = CLOSING;
- }
-
- /**
- * Check the close has not already been done and
- * wait for all invocations to complete
- *
- * @return true when already closed
- */
- protected synchronized boolean checkCloseAlreadyDone() throws Throwable
- {
- if (state != CLOSING)
- {
- return true;
- }
- while (inUseCount > 0)
- {
- wait();
- }
- state = IN_CLOSE;
- return false;
- }
-
- /**
- * Closed the object
- */
- protected synchronized void closed() throws Throwable
- {
- state = CLOSED;
- log.trace(this + " closed");
- }
-
- /**
- * Mark the object as no longer inuse
- */
- protected synchronized void done() throws Throwable
- {
- if (--inUseCount == 0)
- {
- notifyAll();
- }
- }
-
- // Package Private ------------------------------------------------
-
- // Private --------------------------------------------------------
-
- // Inner Classes --------------------------------------------------
-
-}
-
Deleted: trunk/src/main/org/jboss/jms/client/impl/CommunicationSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/CommunicationSupport.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/CommunicationSupport.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.jms.client.impl;
-
-import static org.jboss.messaging.core.remoting.Assert.assertValidID;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-
-import javax.jms.JMSException;
-
-import org.jboss.jms.exception.MessagingJMSException;
-import org.jboss.jms.exception.MessagingNetworkFailureException;
-import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.remoting.Client;
-import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
-import org.jboss.messaging.core.remoting.wireformat.JMSExceptionMessage;
-import org.jboss.messaging.util.Streamable;
-import org.jgroups.persistence.CannotConnectException;
-import org.jboss.messaging.util.Version;
-
-/**
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * // TODO find a better name for this class
- */
-public abstract class CommunicationSupport implements Streamable, Serializable
-{
- private static final Logger log = Logger.getLogger(CommunicationSupport.class);
-
- private static boolean trace = log.isTraceEnabled();
-
- // Attributes -----------------------------------------------------------------------------------
-
- // This is set on the server.
- protected String id;
-
-
- transient private boolean firstTime = true;
-
-
- // getVersion cached (instead of calling it every time)
- transient private byte cacheVersion;
-
- public CommunicationSupport(String id)
- {
- super();
- this.id = id;
- }
-
- public CommunicationSupport()
- {
- this("NO_ID_SET");
- }
-
- // Streamable implementation --------------------------------------------------------------------
-
- public void read(DataInputStream in) throws Exception
- {
- id = in.readUTF();
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- out.writeUTF(id);
- }
-
- // Fields ---------------------------------------------------------------------------------------
-
- protected abstract Client getClient();
-
- protected byte getVersion()
- {
- return Version.instance().getProviderIncrementingVersion();
- }
-
- public String getID()
- {
- return id;
- }
-
- public void setId(String id)
- {
- this.id = id;
- }
-
- // Protected Methods-----------------------------------------------------------------------------
-
- protected void sendOneWay(AbstractPacket packet) throws JMSException
- {
- sendOneWay(getClient(), id, lookupVersion(), packet);
- }
-
- protected static void sendOneWay(Client client, String targetID, byte version, AbstractPacket packet) throws JMSException
- {
- assert client != null;
- assertValidID(targetID);
- assert packet != null;
-
- packet.setVersion(version);
- packet.setTargetID(targetID);
-
- client.sendOneWay(packet);
- }
-
-
- protected AbstractPacket sendBlocking(AbstractPacket request) throws JMSException
- {
- return sendBlocking(getClient(), id, lookupVersion(), request);
- }
-
- protected static AbstractPacket sendBlocking(Client client, String targetID, byte version, AbstractPacket request) throws JMSException
- {
- assert client != null;
- assertValidID(targetID);
- assert request != null;
-
- request.setVersion(version);
- request.setTargetID(targetID);
- try
- {
- AbstractPacket response = (AbstractPacket) client.sendBlocking(request);
- if (response instanceof JMSExceptionMessage)
- {
- JMSExceptionMessage message = (JMSExceptionMessage) response;
- throw message.getException();
- } else {
- return response;
- }
- } catch (Throwable t)
- {
- throw handleThrowable(t);
- }
- }
-
- private byte lookupVersion()
- {
- if (firstTime)
- {
- firstTime=false;
- cacheVersion = getVersion();
- }
- return cacheVersion;
- }
-
- protected static JMSException handleThrowable(Throwable t)
- {
- // ConnectionFailedException could happen during ConnectionFactory.createConnection.
- // IOException could happen during an interrupted exception.
- // CannotConnectionException could happen during a communication error between a connected
- // remoting client and the server (what means any new invocation).
-
- if (t instanceof JMSException)
- {
- return (JMSException)t;
- }
- else if ((t instanceof IOException))
- {
- return new MessagingNetworkFailureException((Exception)t);
- }
- //This can occur if failure happens when Client.connect() is called
- //Ideally remoting should have a consistent API
- else if (t instanceof RuntimeException)
- {
- RuntimeException re = (RuntimeException)t;
-
- Throwable initCause = re.getCause();
-
- if (initCause != null)
- {
- do
- {
- if ((initCause instanceof CannotConnectException) ||
- (initCause instanceof IOException))
- {
- return new MessagingNetworkFailureException((Exception)initCause);
- }
- initCause = initCause.getCause();
- }
- while (initCause != null);
- }
- }
-
- return new MessagingJMSException("Failed to invoke", t);
- }
-
-
-
-}
Deleted: trunk/src/main/org/jboss/jms/client/impl/CreateConnectionResult.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/impl/CreateConnectionResult.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/impl/CreateConnectionResult.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,152 +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.client.impl;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-import org.jboss.jms.client.api.ClientConnection;
-import org.jboss.messaging.util.ProxyFactory;
-import org.jboss.messaging.util.Streamable;
-
-/**
- *
- * A CreateConnectionResult
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class CreateConnectionResult implements Streamable
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- private static final int NULL = 0;
-
- private static final int NOT_NULL = 1;
-
- // Attributes ----------------------------------------------------
-
- private ClientConnectionImpl delegate;
-
- private int actualFailoverNodeID;
-
- // TODO: Get rid of this
- transient private ClientConnection proxiedDelegate;
-
-
- // Constructors --------------------------------------------------
-
- public CreateConnectionResult()
- {
- }
-
- public CreateConnectionResult(ClientConnectionImpl delegate)
- {
- this(delegate, Integer.MIN_VALUE);
- }
-
- public CreateConnectionResult(int actualFailoverNodeID)
- {
- this(null, actualFailoverNodeID);
- }
-
- private CreateConnectionResult(ClientConnectionImpl delegate,
- int actualFailoverNodeId)
- {
- this.delegate = delegate;
- this.actualFailoverNodeID = actualFailoverNodeId;
- }
-
- // Public --------------------------------------------------------
-
- public ClientConnection getInternalDelegate()
- {
- return delegate;
- }
-
- public ClientConnection getProxiedDelegate()
- {
- // TODO: Get rid of this Proxy
- if (proxiedDelegate == null)
- {
- proxiedDelegate = (ClientConnection) ProxyFactory.proxy(delegate, ClientConnection.class);
-
- }
- return proxiedDelegate;
- }
-
- public int getActualFailoverNodeID()
- {
- return actualFailoverNodeID;
- }
-
- public String toString()
- {
- return "CreateConnectionResult[" + delegate + ", failover node " + actualFailoverNodeID + "]";
- }
-
- // Streamable implementation ------------------------------------
-
- public void read(DataInputStream in) throws Exception
- {
- actualFailoverNodeID = in.readInt();
-
- int b = in.readByte();
-
- if (b == NOT_NULL)
- {
- delegate = new ClientConnectionImpl();
-
- delegate.read(in);
- }
- }
-
- public void write(DataOutputStream out) throws Exception
- {
- out.writeInt(actualFailoverNodeID);
-
- if (delegate == null)
- {
- out.writeByte(NULL);
- }
- else
- {
- out.writeByte(NOT_NULL);
-
- delegate.write(out);
- }
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -13,14 +13,11 @@
import org.jboss.messaging.util.Logger;
/**
- * The ONLY remoting connection listener for a JMS connection's underlying remoting connection.
- * Added to the remoting connection when the JMS connection is created, and removed when the
- * JMS connection is closed. Any second tier listeners (the JMS connection ExceptionListener,
- * and the HA's connection failure detector) are registered with this consolidated listener and not
- * with the remoting connection directly.
*
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
+ *
+ * FIXME - get rid of this class - it's not needed
*
* $Id$
*/
Deleted: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,196 +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.client.remoting;
-
-import static org.jboss.messaging.core.remoting.ConnectorRegistrySingleton.REGISTRY;
-
-import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.remoting.Client;
-import org.jboss.messaging.core.remoting.NIOConnector;
-import org.jboss.messaging.core.remoting.ServerLocator;
-import org.jboss.messaging.core.remoting.impl.ClientImpl;
-
-/**
- *
- * TODO: This class should disappear in favor of Connection/Client
- * Encapsulates the state and behaviour from MINA needed for a JMS connection.
- *
- * Each JMS connection maintains a single Client instance for invoking on the server.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class JMSRemotingConnection
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(JMSRemotingConnection.class);
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- private ServerLocator serverLocator;
-
- private Client client;
-
- //private CallbackManager callbackManager;
-
- // When a failover is performed, this flag is set to true
- protected boolean failed = false;
-
- // Maintaining a reference to the remoting connection listener for cases when we need to
- // explicitly remove it from the remoting client
- private ConsolidatedRemotingConnectionListener remotingConnectionListener;
-
- // Constructors ---------------------------------------------------------------------------------
-
- public JMSRemotingConnection(String serverLocatorURI) throws Exception
- {
- this.serverLocator = new ServerLocator(serverLocatorURI);
-
- log.trace(this + " created");
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void start() throws Throwable
- {
- if (log.isTraceEnabled()) { log.trace(this + " created client"); }
-
- //callbackManager = new CallbackManager();
-
- NIOConnector connector = REGISTRY.getConnector(serverLocator);
- client = new ClientImpl(connector, serverLocator);
- client.connect();
-
- if (log.isDebugEnabled())
- log.debug("Using " + connector.getServerURI() + " to connect to " + serverLocator);
-
- log.trace(this + " started");
- }
-
- public void stop()
- {
- log.trace(this + " stop");
-
- try
- {
- client.disconnect();
- NIOConnector connector = REGISTRY.removeConnector(serverLocator);
- if (connector != null)
- connector.disconnect();
- }
- catch (Throwable ignore)
- {
- log.trace(this + " failed to disconnect the new client", ignore);
- }
-
- client = null;
-
- log.trace(this + " closed");
- }
-
- public Client getRemotingClient()
- {
- return client;
- }
-
-// public CallbackManager getCallbackManager()
-// {
-// return callbackManager;
-// }
-//
-
- public synchronized boolean isFailed()
- {
- return failed;
- }
-
- /**
- * Used by the FailoverCommandCenter to mark this remoting connection as "condemned", following
- * a failure detected by either a failed invocation, or the ConnectionListener.
- */
- public synchronized void setFailed()
- {
- failed = true;
-
- stop();
- }
-
- /**
- * @return true if the listener was correctly installed, or false if the add attepmt was ignored
- * because there is already another listener installed.
- */
- public synchronized boolean addConnectionListener(ConsolidatedRemotingConnectionListener listener)
- {
- if (remotingConnectionListener != null)
- {
- return false;
- }
-
- client.addConnectionListener(listener);
- remotingConnectionListener = listener;
-
- return true;
- }
-
- public synchronized ConsolidatedRemotingConnectionListener getConnectionListener()
- {
- return remotingConnectionListener;
- }
-
- /**
- * May return null, if no connection listener was previously installed.
- */
- public synchronized ConsolidatedRemotingConnectionListener removeConnectionListener()
- {
- if (remotingConnectionListener == null)
- {
- return null;
- }
-
- client.removeConnectionListener(remotingConnectionListener);
-
- log.trace(this + " removed consolidated connection listener from " + client);
- ConsolidatedRemotingConnectionListener toReturn = remotingConnectionListener;
- remotingConnectionListener = null;
- return toReturn;
- }
-
- public String toString()
- {
- return "JMSRemotingConnection[" + serverLocator.getURI() + "]";
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Copied: trunk/src/main/org/jboss/jms/client/remoting/MessagingRemotingConnection.java (from rev 3610, trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java)
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/MessagingRemotingConnection.java (rev 0)
+++ trunk/src/main/org/jboss/jms/client/remoting/MessagingRemotingConnection.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -0,0 +1,243 @@
+/*
+ * 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.client.remoting;
+
+import static org.jboss.messaging.core.remoting.ConnectorRegistrySingleton.REGISTRY;
+
+import java.io.IOException;
+
+import javax.jms.JMSException;
+
+import org.jboss.jms.exception.MessagingJMSException;
+import org.jboss.jms.exception.MessagingNetworkFailureException;
+import org.jboss.messaging.core.remoting.Client;
+import org.jboss.messaging.core.remoting.NIOConnector;
+import org.jboss.messaging.core.remoting.ServerLocator;
+import org.jboss.messaging.core.remoting.impl.ClientImpl;
+import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
+import org.jboss.messaging.core.remoting.wireformat.JMSExceptionMessage;
+import org.jboss.messaging.util.Logger;
+import org.jboss.messaging.util.Version;
+import org.jgroups.persistence.CannotConnectException;
+
+/**
+ *
+ * TODO: This class should disappear in favor of Connection/Client
+ * Encapsulates the state and behaviour from MINA needed for a JMS connection.
+ *
+ * Each JMS connection maintains a single Client instance for invoking on the server.
+ *
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision$</tt>
+ * $Id$
+ */
+public class MessagingRemotingConnection
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(MessagingRemotingConnection.class);
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private ServerLocator serverLocator;
+
+ private Client client;
+
+ // Maintaining a reference to the remoting connection listener for cases when we need to
+ // explicitly remove it from the remoting client
+ private ConsolidatedRemotingConnectionListener remotingConnectionListener;
+
+ private Version version;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public MessagingRemotingConnection(Version version, String serverLocatorURI) throws Exception
+ {
+ this.version = version;
+
+ serverLocator = new ServerLocator(serverLocatorURI);
+
+ log.trace(this + " created");
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public void start() throws Throwable
+ {
+ if (log.isTraceEnabled()) { log.trace(this + " created client"); }
+
+ //callbackManager = new CallbackManager();
+
+ NIOConnector connector = REGISTRY.getConnector(serverLocator);
+ client = new ClientImpl(connector, serverLocator);
+ client.connect();
+
+ if (log.isDebugEnabled())
+ log.debug("Using " + connector.getServerURI() + " to connect to " + serverLocator);
+
+ log.trace(this + " started");
+ }
+
+ public void stop()
+ {
+ log.trace(this + " stop");
+
+ try
+ {
+ client.disconnect();
+ NIOConnector connector = REGISTRY.removeConnector(serverLocator);
+ if (connector != null)
+ connector.disconnect();
+ }
+ catch (Throwable ignore)
+ {
+ log.trace(this + " failed to disconnect the new client", ignore);
+ }
+
+ client = null;
+
+ log.trace(this + " closed");
+ }
+
+ public String getSessionID()
+ {
+ return client.getSessionID();
+ }
+
+ public void sendOneWay(String id, AbstractPacket packet) throws JMSException
+ {
+ packet.setTargetID(id);
+
+ packet.setVersion(version.getProviderIncrementingVersion());
+
+ client.sendOneWay(packet);
+ }
+
+ public AbstractPacket sendBlocking(String id, AbstractPacket packet) throws JMSException
+ {
+ packet.setTargetID(id);
+
+ packet.setVersion(version.getProviderIncrementingVersion());
+
+ try
+ {
+ AbstractPacket response = (AbstractPacket) client.sendBlocking(packet);
+
+ if (response instanceof JMSExceptionMessage)
+ {
+ JMSExceptionMessage message = (JMSExceptionMessage) response;
+
+ throw message.getException();
+ }
+ else
+ {
+ return response;
+ }
+ }
+ catch (Throwable t)
+ {
+ throw handleThrowable(t);
+ }
+ }
+
+ public synchronized void addConnectionListener(ConsolidatedRemotingConnectionListener listener)
+ {
+ this.remotingConnectionListener = listener;
+ }
+
+ public synchronized ConsolidatedRemotingConnectionListener getConnectionListener()
+ {
+ return remotingConnectionListener;
+ }
+
+ /**
+ * May return null, if no connection listener was previously installed.
+ */
+ public synchronized ConsolidatedRemotingConnectionListener removeConnectionListener()
+ {
+ if (remotingConnectionListener == null)
+ {
+ return null;
+ }
+
+ client.removeConnectionListener(remotingConnectionListener);
+
+ log.trace(this + " removed consolidated connection listener from " + client);
+ ConsolidatedRemotingConnectionListener toReturn = remotingConnectionListener;
+ remotingConnectionListener = null;
+ return toReturn;
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ private JMSException handleThrowable(Throwable t)
+ {
+ // ConnectionFailedException could happen during ConnectionFactory.createConnection.
+ // IOException could happen during an interrupted exception.
+ // CannotConnectionException could happen during a communication error between a connected
+ // remoting client and the server (what means any new invocation).
+
+ if (t instanceof JMSException)
+ {
+ return (JMSException)t;
+ }
+ else if ((t instanceof IOException))
+ {
+ return new MessagingNetworkFailureException((Exception)t);
+ }
+ //This can occur if failure happens when Client.connect() is called
+ //Ideally remoting should have a consistent API
+ else if (t instanceof RuntimeException)
+ {
+ RuntimeException re = (RuntimeException)t;
+
+ Throwable initCause = re.getCause();
+
+ if (initCause != null)
+ {
+ do
+ {
+ if ((initCause instanceof CannotConnectException) ||
+ (initCause instanceof IOException))
+ {
+ return new MessagingNetworkFailureException((Exception)initCause);
+ }
+ initCause = initCause.getCause();
+ }
+ while (initCause != null);
+ }
+ }
+
+ return new MessagingJMSException("Failed to invoke", t);
+ }
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java
===================================================================
--- trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/jndi/JNDIObjectDeployer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -202,7 +202,7 @@
boolean useStrict = messagingServer.getConfiguration().isStrictTck() || connectionFactory.isStrictTck();
ClientConnectionFactoryImpl delegate =
- new ClientConnectionFactoryImpl(connectionFactory.getName(), id, messagingServer.getConfiguration().getMessagingServerID(),
+ new ClientConnectionFactoryImpl(id, messagingServer.getConfiguration().getMessagingServerID(),
serverLocator.getURI(), version, false, useStrict);
log.debug(this + " created local delegate " + delegate);
Modified: trunk/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/JBossMessage.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/message/JBossMessage.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -38,9 +38,10 @@
import javax.jms.MessageNotReadableException;
import javax.jms.MessageNotWriteableException;
+import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.exception.MessagingJMSException;
+import org.jboss.messaging.core.impl.MessageImpl;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.impl.MessageImpl;
/**
*
@@ -147,8 +148,7 @@
//The underlying message
protected org.jboss.messaging.core.Message message;
- //The SessionDelegate - we need this when acknowledging the message directly
- private org.jboss.jms.client.api.ClientSession delegate;
+ private ClientSession session;
//From a connection consumer?
private boolean cc;
@@ -761,7 +761,7 @@
if (!cc)
{
//Only acknowledge for client ack if is not in connection consumer
- delegate.acknowledgeAll();
+ session.acknowledgeAll();
}
}
@@ -815,15 +815,16 @@
return JBossMessage.TYPE;
}
- public void setSessionDelegate(org.jboss.jms.client.api.ClientSession sd, boolean isConnectionConsumer)
+ public void setSession(ClientSession sd, boolean isConnectionConsumer)
{
- this.delegate = sd;
+ this.session = sd;
+
this.cc = isConnectionConsumer;
}
- public org.jboss.jms.client.api.ClientSession getSessionDelegate()
+ public ClientSession getSession()
{
- return delegate;
+ return session;
}
public int getDeliveryCount()
Modified: trunk/src/main/org/jboss/jms/server/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/Configuration.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/Configuration.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,17 +21,17 @@
*/
package org.jboss.jms.server;
-import org.jboss.jms.server.security.Role;
-import org.jboss.messaging.util.XMLUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.net.URL;
import java.util.HashSet;
+import org.jboss.jms.server.security.Role;
+import org.jboss.messaging.util.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
/**
* This is the JBM configuration. It is used to configure the ServerPeer.
* It does this by parsing the jbm-configuration.xml configuration file. It also uses PropertyChangeSupport so users of
Modified: trunk/src/main/org/jboss/jms/server/SecurityStore.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/SecurityStore.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/SecurityStore.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,16 @@
*/
package org.jboss.jms.server;
+import java.util.HashSet;
+
+import javax.jms.JMSSecurityException;
+import javax.security.auth.Subject;
+
import org.jboss.jms.server.security.CheckType;
import org.jboss.jms.server.security.Role;
import org.jboss.messaging.core.Destination;
import org.jboss.messaging.util.HierarchicalRepository;
-import javax.jms.JMSSecurityException;
-import javax.security.auth.Subject;
-import java.util.HashSet;
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/src/main/org/jboss/jms/server/bridge/Bridge.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/bridge/Bridge.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/bridge/Bridge.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -46,9 +47,8 @@
import org.jboss.jms.client.JBossSession;
import org.jboss.jms.message.JBossMessage;
+import org.jboss.messaging.core.MessagingComponent;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.MessagingComponent;
-import org.jboss.messaging.util.ProxyFactory;
import org.jboss.tm.TransactionManagerLocator;
/**
Modified: trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/bridge/BridgeService.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,11 @@
*/
package org.jboss.jms.server.bridge;
+import javax.management.ObjectName;
+
+import org.jboss.messaging.core.MessagingComponent;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.MessagingComponent;
-import javax.management.ObjectName;
-
/**
* A BridgeService
*
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -6,11 +6,11 @@
*/
package org.jboss.jms.server.connectionfactory;
+import java.util.List;
+
import org.jboss.jms.client.plugin.LoadBalancingFactory;
import org.jboss.messaging.util.Logger;
-import java.util.List;
-
/**
* A deployable JBoss Messaging connection factory.
*
Modified: trunk/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -35,9 +35,9 @@
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.endpoint.ConnectionEndpoint;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.util.ConcurrentHashSet;
+import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.Util;
/**
Modified: trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/container/SecurityAspect.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,16 +21,17 @@
*/
package org.jboss.jms.server.container;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.JMSSecurityException;
+
import org.jboss.jms.server.SecurityStore;
import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
import org.jboss.jms.server.security.CheckType;
import org.jboss.messaging.core.Destination;
import org.jboss.messaging.util.Logger;
-import javax.jms.JMSSecurityException;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* This aspect enforces the JBossMessaging JMS security policy.
*
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -24,8 +24,8 @@
import javax.jms.JMSException;
import org.jboss.jms.client.Closeable;
-import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.tx.TransactionRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateSessionResponse;
import org.jboss.messaging.core.tx.MessagingXid;
@@ -40,9 +40,9 @@
*/
public interface ConnectionEndpoint extends Closeable
{
- ClientSession createSessionDelegate(boolean transacted,
- int acknowledgmentMode,
- boolean isXA) throws JMSException;
+ CreateSessionResponse createSession(boolean transacted,
+ int acknowledgmentMode,
+ boolean isXA) throws JMSException;
String getClientID() throws JMSException;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -23,7 +23,7 @@
import javax.jms.JMSException;
-import org.jboss.jms.client.impl.CreateConnectionResult;
+import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
/**
* Represents the set of methods from the ConnectionFactoryDelegate that are handled on the server.
@@ -37,13 +37,10 @@
*/
public interface ConnectionFactoryEndpoint
{
- /**
- * @param failedNodeID - zero or positive values mean the connection creation attempt is result
- * of failover. Negative values are ignored (mean regular connection creation attempt).
- */
- CreateConnectionResult createConnectionDelegate(String username,
- String password,
- int failedNodeID)
- throws JMSException;
+ CreateConnectionResponse createConnectionDelegate(String username,
+ String password,
+ String remotingSessionID,
+ String clientVMID,
+ byte versionToUse) throws JMSException;
}
Deleted: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryInternalEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryInternalEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryInternalEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,46 +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.endpoint;
-
-import javax.jms.JMSException;
-
-import org.jboss.jms.client.impl.CreateConnectionResult;
-
-/**
- * The interface only exists so the connection factory requests can call through the AOP stack
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public interface ConnectionFactoryInternalEndpoint extends ConnectionFactoryEndpoint
-{
- CreateConnectionResult createConnectionDelegate(String username,
- String password,
- int failedNodeID,
- String remotingSessionID,
- String clientVMID,
- byte versionToUse)
- throws JMSException;
-}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerBrowserEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -36,7 +36,6 @@
import javax.jms.JMSException;
import org.jboss.jms.exception.MessagingJMSException;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
@@ -53,6 +52,7 @@
import org.jboss.messaging.core.remoting.wireformat.NullPacket;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
import org.jboss.messaging.util.ExceptionUtil;
+import org.jboss.messaging.util.Logger;
/**
* Concrete implementation of BrowserEndpoint.
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -46,8 +46,6 @@
import javax.jms.JMSException;
import javax.transaction.xa.Xid;
-import org.jboss.jms.client.api.ClientSession;
-import org.jboss.jms.client.impl.ClientSessionImpl;
import org.jboss.jms.exception.MessagingJMSException;
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.SecurityStore;
@@ -147,9 +145,6 @@
private byte usingVersion;
- // a non-null value here means connection is a fail-over connection
- private Integer failedNodeID;
-
// Constructors ---------------------------------------------------------------------------------
/**
@@ -160,8 +155,7 @@
String username, String password, int prefetchSize,
int defaultTempQueueFullSize,
int defaultTempQueuePageSize,
- int defaultTempQueueDownCacheSize,
- int failedNodeID,
+ int defaultTempQueueDownCacheSize,
ServerConnectionFactoryEndpoint cfendpoint,
String remotingSessionID,
String clientVMID,
@@ -195,11 +189,6 @@
this.username = username;
this.password = password;
- if (failedNodeID > 0)
- {
- this.failedNodeID = new Integer(failedNodeID);
- }
-
this.remotingClientSessionID = remotingSessionID;
this.jmsClientVMID = clientVMID;
@@ -211,9 +200,9 @@
// ConnectionDelegate implementation ------------------------------------------------------------
- public ClientSession createSessionDelegate(boolean transacted,
- int acknowledgmentMode,
- boolean isXA)
+ public CreateSessionResponse createSession(boolean transacted,
+ int acknowledgmentMode,
+ boolean isXA)
throws JMSException
{
try
@@ -244,13 +233,7 @@
messagingServer.getMinaService().getDispatcher().register(ep.newHandler());
- log.trace("created and registered " + ep);
-
- org.jboss.jms.client.api.ClientSession d = new ClientSessionImpl(null, sessionID, dupsOKBatchSize);
-
- log.trace("created " + d);
-
- return d;
+ return new CreateSessionResponse(sessionID, dupsOKBatchSize);
}
catch (Throwable t)
{
@@ -695,24 +678,6 @@
// Protected ------------------------------------------------------------------------------------
- /**
- * Give access to children enpoints to the failed node ID, in case this is a failover connection.
- * Return null if the connection is regular (not failover).
- */
- Integer getFailedNodeID()
- {
- return failedNodeID;
- }
-
- /**
- * Tell children enpoints (and anybody from this package, for that matter) whether this
- * connection is a regular or failover connection.
- */
- boolean isFailoverConnection()
- {
- return failedNodeID != null;
- }
-
// Private --------------------------------------------------------------------------------------
private void setStarted(boolean s) throws Exception
@@ -792,12 +757,9 @@
if (type == REQ_CREATESESSION)
{
CreateSessionRequest request = (CreateSessionRequest) packet;
- ClientSessionImpl sessionDelegate = (ClientSessionImpl) createSessionDelegate(
+ response = createSession(
request.isTransacted(), request.getAcknowledgementMode(),
request.isXA());
-
- response = new CreateSessionResponse(sessionDelegate.getID(),
- sessionDelegate.getDupsOKBatchSize());
} else if (type == MSG_STARTCONNECTION)
{
start();
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,22 +21,28 @@
*/
package org.jboss.jms.server.endpoint;
+
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_UPDATECALLBACK;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONNECTION;
+
+import java.util.Map;
+
+import javax.jms.JMSException;
+
import org.jboss.jms.client.impl.ClientConnectionFactoryImpl;
-import org.jboss.jms.client.impl.ClientConnectionImpl;
-import org.jboss.jms.client.impl.CreateConnectionResult;
import org.jboss.jms.exception.MessagingJMSException;
import org.jboss.messaging.core.MessagingServer;
import org.jboss.messaging.core.remoting.PacketHandler;
import org.jboss.messaging.core.remoting.PacketSender;
-import org.jboss.messaging.core.remoting.wireformat.*;
-import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_UPDATECALLBACK;
-import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONNECTION;
+import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
+import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
+import org.jboss.messaging.core.remoting.wireformat.JMSExceptionMessage;
+import org.jboss.messaging.core.remoting.wireformat.PacketType;
+import org.jboss.messaging.core.remoting.wireformat.UpdateCallbackMessage;
import org.jboss.messaging.util.ExceptionUtil;
import org.jboss.messaging.util.Logger;
-import javax.jms.JMSException;
-import java.util.Map;
-
/**
* Concrete implementation of ConnectionFactoryEndpoint
*
@@ -106,23 +112,8 @@
// ConnectionFactoryDelegate implementation -----------------------------------------------------
- public CreateConnectionResult createConnectionDelegate(String username,
- String password,
- int failedNodeID)
-
- throws JMSException
- {
- //This is never called directly
- throw new IllegalStateException("createConnectionDelegate should never be called directly");
- }
-
- /**
- * @param failedNodeID - zero or positive values mean connection creation attempt is result of
- * failover. -1 are ignored (mean regular connection creation attempt).
- */
- public CreateConnectionResult createConnectionDelegate(String username,
- String password,
- int failedNodeID,
+ public CreateConnectionResponse createConnectionDelegate(String username,
+ String password,
String remotingSessionID,
String clientVMID,
byte versionToUse)
@@ -130,12 +121,10 @@
{
try
{
- // Just a standard createConnection
- ClientConnectionImpl cd =
- createConnectionDelegateInternal(username, password, failedNodeID,
+ return
+ createConnectionDelegateInternal(username, password,
remotingSessionID, clientVMID,
- versionToUse);
- return new CreateConnectionResult(cd);
+ versionToUse);
}
catch (Throwable t)
{
@@ -144,14 +133,9 @@
}
- /**
- * @param failedNodeID - zero or positive values mean connection creation attempt is result of
- * failover. Negative values are ignored (mean regular connection creation attempt).
- */
- private ClientConnectionImpl
+ private CreateConnectionResponse
createConnectionDelegateInternal(String username,
- String password,
- int failedNodeID,
+ String password,
String remotingSessionID, String clientVMID,
byte versionToUse)
throws Exception
@@ -187,17 +171,17 @@
final ServerConnectionEndpoint endpoint =
new ServerConnectionEndpoint(messagingServer, clientIDUsed, username, password, prefetchSize,
defaultTempQueueFullSize, defaultTempQueuePageSize,
- defaultTempQueueDownCacheSize, failedNodeID, this,
+ defaultTempQueueDownCacheSize, this,
remotingSessionID, clientVMID, versionToUse,
dupsOKBatchSize);
- final String connectionID = endpoint.getConnectionID();
+ String connectionID = endpoint.getConnectionID();
messagingServer.getMinaService().getDispatcher().register(endpoint.newHandler());
log.trace("created and registered " + endpoint);
- return new ClientConnectionImpl(connectionID, messagingServer.getConfiguration().getMessagingServerID());
+ return new CreateConnectionResponse(connectionID);
}
public void addSender(String VMID, String remotingSessionID,
@@ -263,13 +247,9 @@
if (type == REQ_CREATECONNECTION)
{
CreateConnectionRequest request = (CreateConnectionRequest) packet;
- CreateConnectionResult del = createConnectionDelegate(request
- .getUsername(), request.getPassword(), request
- .getFailedNodeID(), request.getRemotingSessionID(),
+ response = createConnectionDelegate(request
+ .getUsername(), request.getPassword(), request.getRemotingSessionID(),
request.getClientVMID(), request.getVersion());
-
- response = new CreateConnectionResponse(del.getInternalDelegate()
- .getID(), del.getInternalDelegate().getServerID());
}
else if (type == MSG_UPDATECALLBACK)
{
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,37 +21,92 @@
*/
package org.jboss.jms.server.endpoint;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
-import org.jboss.jms.client.api.ClientBrowser;
-import org.jboss.jms.client.impl.*;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_ACKDELIVERIES;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_ADDTEMPORARYDESTINATION;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_CANCELDELIVERIES;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_CANCELDELIVERY;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_CLOSE;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_DELETETEMPORARYDESTINATION;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_SENDMESSAGE;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_UNSUBSCRIBE;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_ACKDELIVERY;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CLOSING;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEBROWSER;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONSUMER;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEDESTINATION;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.jms.IllegalStateException;
+import javax.jms.InvalidDestinationException;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+
+import org.jboss.jms.client.impl.Ack;
+import org.jboss.jms.client.impl.AckImpl;
+import org.jboss.jms.client.impl.Cancel;
+import org.jboss.jms.client.impl.DeliveryInfo;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTopic;
import org.jboss.jms.exception.MessagingJMSException;
import org.jboss.jms.server.container.SecurityAspect;
import org.jboss.jms.server.security.CheckType;
-import org.jboss.messaging.core.*;
+import org.jboss.messaging.core.Binding;
+import org.jboss.messaging.core.Condition;
+import org.jboss.messaging.core.Destination;
+import org.jboss.messaging.core.DestinationType;
+import org.jboss.messaging.core.Filter;
+import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.MessagingServer;
+import org.jboss.messaging.core.PostOffice;
import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.core.Transaction;
+import org.jboss.messaging.core.TransactionSynchronization;
import org.jboss.messaging.core.impl.ConditionImpl;
import org.jboss.messaging.core.impl.TransactionImpl;
import org.jboss.messaging.core.impl.filter.FilterImpl;
import org.jboss.messaging.core.remoting.PacketHandler;
import org.jboss.messaging.core.remoting.PacketSender;
-import org.jboss.messaging.core.remoting.wireformat.*;
-import static org.jboss.messaging.core.remoting.wireformat.PacketType.*;
+import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
+import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveriesMessage;
+import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveryRequest;
+import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveryResponse;
+import org.jboss.messaging.core.remoting.wireformat.AddTemporaryDestinationMessage;
+import org.jboss.messaging.core.remoting.wireformat.CancelDeliveriesMessage;
+import org.jboss.messaging.core.remoting.wireformat.CancelDeliveryMessage;
+import org.jboss.messaging.core.remoting.wireformat.ClosingRequest;
+import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateConsumerRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateConsumerResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateDestinationRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateDestinationResponse;
+import org.jboss.messaging.core.remoting.wireformat.DeleteTemporaryDestinationMessage;
+import org.jboss.messaging.core.remoting.wireformat.DeliverMessage;
+import org.jboss.messaging.core.remoting.wireformat.JMSExceptionMessage;
+import org.jboss.messaging.core.remoting.wireformat.NullPacket;
+import org.jboss.messaging.core.remoting.wireformat.PacketType;
+import org.jboss.messaging.core.remoting.wireformat.SendMessage;
+import org.jboss.messaging.core.remoting.wireformat.UnsubscribeMessage;
import org.jboss.messaging.util.ExceptionUtil;
import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.MessageQueueNameHelper;
-import javax.jms.IllegalStateException;
-import javax.jms.InvalidDestinationException;
-import javax.jms.InvalidSelectorException;
-import javax.jms.JMSException;
-import java.lang.ref.WeakReference;
-import java.util.*;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
/**
* Session implementation
@@ -190,7 +245,7 @@
}
}
- public ClientBrowser createBrowserDelegate(Destination destination,
+ public CreateBrowserResponse createBrowserDelegate(Destination destination,
String filterString)
throws JMSException
{
@@ -1376,7 +1431,7 @@
return response;
}
- private ClientBrowser createBrowserDelegateInternal(Destination destination,
+ private CreateBrowserResponse createBrowserDelegateInternal(Destination destination,
String selector) throws Exception
{
if (closed)
@@ -1422,11 +1477,10 @@
connectionEndpoint.getMessagingServer().getMinaService().getDispatcher().register(ep.newHandler());
- ClientBrowserImpl stub = new ClientBrowserImpl(browserID);
-
+
log.trace(this + " created and registered " + ep);
- return stub;
+ return new CreateBrowserResponse(browserID);
}
// Inner classes --------------------------------------------------------------------------------
@@ -1621,10 +1675,8 @@
} else if (type == REQ_CREATEBROWSER)
{
CreateBrowserRequest request = (CreateBrowserRequest) packet;
- ClientBrowserImpl browser = (ClientBrowserImpl) createBrowserDelegate(
+ response = createBrowserDelegate(
request.getDestination(), request.getSelector());
-
- response = new CreateBrowserResponse(browser.getID());
} else if (type == REQ_ACKDELIVERY)
{
AcknowledgeDeliveryRequest request = (AcknowledgeDeliveryRequest) packet;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -27,13 +27,13 @@
import javax.jms.JMSException;
import org.jboss.jms.client.Closeable;
-import org.jboss.jms.client.api.ClientBrowser;
import org.jboss.jms.client.impl.Ack;
import org.jboss.jms.client.impl.Cancel;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTopic;
import org.jboss.messaging.core.Destination;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerResponse;
/**
@@ -51,7 +51,7 @@
boolean noLocal, String subscriptionName,
boolean connectionConsumer) throws JMSException;
- ClientBrowser createBrowserDelegate(Destination queue, String messageSelector) throws JMSException;
+ CreateBrowserResponse createBrowserDelegate(Destination queue, String messageSelector) throws JMSException;
/**
* Creates a queue identity given a Queue name. Does NOT create the physical queue. The physical
Modified: trunk/src/main/org/jboss/jms/server/jndi/InVMContext.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/jndi/InVMContext.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/jndi/InVMContext.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,30 @@
*/
package org.jboss.jms.server.jndi;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+
+import org.jboss.messaging.microcontainer.NonSerializableFactory;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.microcontainer.NonSerializableFactory;
import org.jboss.messaging.util.NotYetImplementedException;
-import javax.naming.*;
-import java.io.Serializable;
-import java.util.*;
-
/**
* used as a contect for when we run embedded in the local configuration.
*
Modified: trunk/src/main/org/jboss/jms/server/jndi/InVMInitialContextFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/jndi/InVMInitialContextFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/jndi/InVMInitialContextFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,11 @@
*/
package org.jboss.jms.server.jndi;
+import java.util.Hashtable;
+
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
-import java.util.Hashtable;
/**
* The context factory we use when we run embedded in the default local configuration.
Modified: trunk/src/main/org/jboss/jms/server/jndi/InVMNameParser.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/jndi/InVMNameParser.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/jndi/InVMNameParser.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,13 @@
*/
package org.jboss.jms.server.jndi;
+import java.io.Serializable;
+import java.util.Properties;
+
import javax.naming.CompoundName;
import javax.naming.Name;
import javax.naming.NameParser;
import javax.naming.NamingException;
-import java.io.Serializable;
-import java.util.Properties;
/**
* used by the default context when running with thelocal configuration
Modified: trunk/src/main/org/jboss/jms/server/plugin/JDBCJMSUserManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/plugin/JDBCJMSUserManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/plugin/JDBCJMSUserManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,21 @@
*/
package org.jboss.jms.server.plugin;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
import org.jboss.jms.server.plugin.contract.JMSUserManager;
+import org.jboss.messaging.core.impl.JDBCSupport;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.impl.JDBCSupport;
-import java.sql.*;
-import java.util.*;
-
/**
* A JDBCJMSUserManager
*
Modified: trunk/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/recovery/MessagingXAResourceWrapper.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,17 @@
*/
package org.jboss.jms.server.recovery;
-import org.jboss.messaging.util.Logger;
-
-import javax.jms.*;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
+import javax.jms.XASession;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.jboss.messaging.util.Logger;
+
/**
* XAResourceWrapper.
*
Modified: trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/server/security/SecurityMetadataStore.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,6 +21,15 @@
*/
package org.jboss.jms.server.security;
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.JMSSecurityException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.security.auth.Subject;
+
import org.jboss.jms.server.SecurityStore;
import org.jboss.messaging.core.Destination;
import org.jboss.messaging.core.DestinationType;
@@ -32,14 +41,6 @@
import org.jboss.security.SimplePrincipal;
import org.jboss.security.SubjectSecurityManager;
-import javax.jms.JMSSecurityException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.security.auth.Subject;
-import java.security.Principal;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* A security metadate store for JMS. Stores security information for destinations and delegates
* authentication and authorization to a JaasSecurityManager.
Modified: trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -33,9 +33,9 @@
import org.jboss.jms.client.impl.Ack;
import org.jboss.jms.client.impl.AckImpl;
import org.jboss.jms.client.impl.DeliveryInfo;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.impl.MessageImpl;
+import org.jboss.messaging.util.Logger;
/**
* Holds the state of a transaction on the client side
Modified: trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,15 @@
*/
package org.jboss.jms.tx;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.exception.MessagingXAException;
+import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
/**
* An XAResource implementation.
*
Modified: trunk/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -42,8 +42,8 @@
import org.jboss.jms.exception.MessagingXAException;
import org.jboss.jms.message.JBossMessage;
import org.jboss.jms.tx.ClientTransaction.SessionTxState;
+import org.jboss.messaging.core.Message;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.Message;
/**
@@ -617,7 +617,7 @@
JBossMessage mp = info.getMessage();
- ClientSession del = mp.getSessionDelegate();
+ ClientSession del = mp.getSession();
del.redeliver(acks);
}
Modified: trunk/src/main/org/jboss/messaging/core/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/Configuration.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/Configuration.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,17 +21,17 @@
*/
package org.jboss.messaging.core;
-import org.jboss.jms.server.security.Role;
-import org.jboss.messaging.util.XMLUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.net.URL;
import java.util.HashSet;
+import org.jboss.jms.server.security.Role;
+import org.jboss.messaging.util.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
/**
* This is the JBM configuration. It is used to configure the MessagingServer.
*
Modified: trunk/src/main/org/jboss/messaging/core/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/MessagingServer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/MessagingServer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,6 +21,10 @@
*/
package org.jboss.messaging.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.SecurityStore;
import org.jboss.jms.server.TransactionRepository;
@@ -31,9 +35,6 @@
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.Version;
-import java.util.Collection;
-import java.util.HashSet;
-
/**
* This interface defines the internal interface of the Messaging Server exposed
* to other components of the server.
Modified: trunk/src/main/org/jboss/messaging/core/PersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/PersistenceManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/PersistenceManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -25,8 +25,6 @@
import javax.transaction.xa.Xid;
-import org.jboss.messaging.core.tx.MessagingXid;
-
/**
*
* A PersistenceManager
Modified: trunk/src/main/org/jboss/messaging/core/impl/BindingImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/BindingImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/BindingImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -23,7 +23,6 @@
import org.jboss.messaging.core.Binding;
import org.jboss.messaging.core.Condition;
-import org.jboss.messaging.core.DestinationType;
import org.jboss.messaging.core.Queue;
/**
Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCSupport.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCSupport.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,19 +21,24 @@
*/
package org.jboss.messaging.core.impl;
-import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.MessagingComponent;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
import javax.sql.DataSource;
import javax.transaction.Status;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.*;
+import org.jboss.messaging.core.MessagingComponent;
+import org.jboss.messaging.util.Logger;
+
/**
* Common functionality for messaging components that need to access a database.
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/MessageImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/MessageImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -31,12 +31,10 @@
import java.util.Map;
import java.util.concurrent.Semaphore;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.jms.message.JBossTextMessage;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.StreamUtils;
/**
Modified: trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/MessageReferenceImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,11 @@
*/
package org.jboss.messaging.core.impl;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.PersistenceManager;
import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.util.Logger;
/**
* Implementation of a MessageReference
Modified: trunk/src/main/org/jboss/messaging/core/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/QueueImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/QueueImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -29,7 +29,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.jms.server.MessagingTimeoutFactory;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Consumer;
import org.jboss.messaging.core.DistributionPolicy;
import org.jboss.messaging.core.Filter;
@@ -37,6 +36,7 @@
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.PriorityLinkedList;
import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.util.Logger;
import org.jboss.util.timeout.Timeout;
import org.jboss.util.timeout.TimeoutTarget;
Modified: trunk/src/main/org/jboss/messaging/core/impl/TransactionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/TransactionImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/TransactionImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,12 +26,12 @@
import javax.transaction.xa.Xid;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.PersistenceManager;
import org.jboss.messaging.core.Transaction;
import org.jboss.messaging.core.TransactionSynchronization;
+import org.jboss.messaging.util.Logger;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/bdbje/BDBJEPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/bdbje/BDBJEPersistenceManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/bdbje/BDBJEPersistenceManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -34,7 +34,6 @@
import javax.transaction.xa.Xid;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Binding;
import org.jboss.messaging.core.Condition;
import org.jboss.messaging.core.Filter;
@@ -47,6 +46,7 @@
import org.jboss.messaging.core.impl.ConditionImpl;
import org.jboss.messaging.core.impl.MessageImpl;
import org.jboss.messaging.core.impl.filter.FilterImpl;
+import org.jboss.messaging.util.Logger;
import org.jboss.messaging.util.Pair;
/**
Modified: trunk/src/main/org/jboss/messaging/core/impl/bdbje/integration/RealBDBJEEnvironment.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/bdbje/integration/RealBDBJEEnvironment.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/bdbje/integration/RealBDBJEEnvironment.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -31,10 +31,10 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.impl.bdbje.BDBJEDatabase;
import org.jboss.messaging.core.impl.bdbje.BDBJEEnvironment;
import org.jboss.messaging.core.impl.bdbje.BDBJETransaction;
+import org.jboss.messaging.util.Logger;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
Modified: trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/filter/FilterImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -24,9 +24,9 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Filter;
import org.jboss.messaging.core.Message;
+import org.jboss.messaging.util.Logger;
/**
* This class implements a JBoss Messaging filter
Modified: trunk/src/main/org/jboss/messaging/core/impl/memory/SimpleMemoryManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/memory/SimpleMemoryManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/memory/SimpleMemoryManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,8 +21,8 @@
*/
package org.jboss.messaging.core.impl.memory;
+import org.jboss.messaging.core.MemoryManager;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.MemoryManager;
/**
* A MemoryManager
Modified: trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounter.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounter.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -29,8 +29,8 @@
import java.util.Iterator;
import java.util.List;
+import org.jboss.messaging.core.Queue;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.Queue;
/**
* This class stores message count informations for a given queue
Modified: trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounterManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounterManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/messagecounter/MessageCounterManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,17 @@
*/
package org.jboss.messaging.core.impl.messagecounter;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.jboss.messaging.core.MessagingComponent;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.MessagingComponent;
-import java.util.*;
-
/**
*
* A MessageCounterManager
Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/PostOfficeImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -29,10 +29,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import javax.jms.TextMessage;
-
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Binding;
import org.jboss.messaging.core.Condition;
import org.jboss.messaging.core.Filter;
@@ -45,6 +41,7 @@
import org.jboss.messaging.core.TransactionSynchronization;
import org.jboss.messaging.core.impl.BindingImpl;
import org.jboss.messaging.util.ConcurrentHashSet;
+import org.jboss.messaging.util.Logger;
/**
*
Modified: trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/impl/server/MessagingServerImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,6 +21,14 @@
*/
package org.jboss.messaging.core.impl.server;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.MessagingTimeoutFactory;
@@ -32,7 +40,16 @@
import org.jboss.jms.server.security.Role;
import org.jboss.jms.server.security.SecurityMetadataStore;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.*;
+import org.jboss.messaging.core.Binding;
+import org.jboss.messaging.core.Condition;
+import org.jboss.messaging.core.Configuration;
+import org.jboss.messaging.core.DestinationType;
+import org.jboss.messaging.core.MemoryManager;
+import org.jboss.messaging.core.MessagingServer;
+import org.jboss.messaging.core.PersistenceManager;
+import org.jboss.messaging.core.PostOffice;
+import org.jboss.messaging.core.Queue;
+import org.jboss.messaging.core.QueueSettings;
import org.jboss.messaging.core.impl.ConditionImpl;
import org.jboss.messaging.core.impl.QueueFactoryImpl;
import org.jboss.messaging.core.impl.memory.SimpleMemoryManager;
@@ -46,14 +63,6 @@
import org.jboss.messaging.util.HierarchicalRepository;
import org.jboss.messaging.util.Version;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
/**
* A Messaging Server
*
Modified: trunk/src/main/org/jboss/messaging/core/remoting/PacketDispatcher.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/PacketDispatcher.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/PacketDispatcher.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -12,8 +12,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
Modified: trunk/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -19,13 +19,13 @@
import java.nio.charset.CharacterCodingException;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.Destination;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.impl.DestinationImpl;
import org.jboss.messaging.core.impl.MessageImpl;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
Modified: trunk/src/main/org/jboss/messaging/core/remoting/codec/BrowserNextMessageResponseCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/codec/BrowserNextMessageResponseCodec.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/codec/BrowserNextMessageResponseCodec.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -8,7 +8,6 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_BROWSER_NEXTMESSAGE;
-import org.jboss.jms.message.JBossMessage;
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.remoting.wireformat.BrowserNextMessageResponse;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionRequestCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionRequestCodec.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionRequestCodec.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -41,14 +41,12 @@
byte version = request.getVersion();
String remotingSessionID = request.getRemotingSessionID();
String clientVMID = request.getClientVMID();
- int failedNodeID = request.getFailedNodeID();
String username = request.getUsername();
String password = request.getPassword();
int bodyLength = 1 // version
+ sizeof(remotingSessionID)
+ sizeof(clientVMID)
- + INT_LENGTH // failedNodeID
+ sizeof(username)
+ sizeof(password);
@@ -56,7 +54,6 @@
out.put(version);
out.putNullableString(remotingSessionID);
out.putNullableString(clientVMID);
- out.putInt(failedNodeID);
out.putNullableString(username);
out.putNullableString(password);
}
@@ -73,12 +70,11 @@
byte version = in.get();
String remotingSessionID = in.getNullableString();
String clientVMID = in.getNullableString();
- int failedNodeID = in.getInt();
String username = in.getNullableString();
String password = in.getNullableString();
return new CreateConnectionRequest(version, remotingSessionID,
- clientVMID, failedNodeID, username, password);
+ clientVMID, username, password);
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionResponseCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionResponseCodec.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/codec/ConnectionFactoryCreateConnectionResponseCodec.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -39,13 +39,11 @@
throws Exception
{
String id = response.getConnectionID();
- int serverID = response.getServerID();
-
- int bodyLength = sizeof(id) + INT_LENGTH;
+ int bodyLength = sizeof(id);
+
out.putInt(bodyLength);
out.putNullableString(id);
- out.putInt(serverID);
}
@Override
@@ -58,9 +56,8 @@
return null;
}
String id = in.getNullableString();
- int serverID = in.getInt();
-
- return new CreateConnectionResponse(id, serverID);
+
+ return new CreateConnectionResponse(id);
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ClientImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ClientImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ClientImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -16,12 +16,12 @@
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.exception.MessagingNetworkFailureException;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.Client;
import org.jboss.messaging.core.remoting.NIOConnector;
import org.jboss.messaging.core.remoting.NIOSession;
import org.jboss.messaging.core.remoting.ServerLocator;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -13,7 +13,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.ConnectorRegistry;
import org.jboss.messaging.core.remoting.NIOConnector;
import org.jboss.messaging.core.remoting.PacketDispatcher;
@@ -21,6 +20,7 @@
import org.jboss.messaging.core.remoting.TransportType;
import org.jboss.messaging.core.remoting.impl.invm.INVMConnector;
import org.jboss.messaging.core.remoting.impl.mina.MinaConnector;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaConnector.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -17,7 +17,6 @@
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import org.apache.mina.common.CloseFuture;
@@ -27,14 +26,13 @@
import org.apache.mina.common.IoService;
import org.apache.mina.common.IoServiceListener;
import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.executor.ExecutorFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.NIOConnector;
import org.jboss.messaging.core.remoting.NIOSession;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.TransportType;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaHandler.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -9,10 +9,10 @@
import org.apache.mina.common.IoHandlerAdapter;
import org.apache.mina.common.IoSession;
import org.apache.mina.filter.reqres.Response;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.PacketSender;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaService.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -18,10 +18,10 @@
import org.apache.mina.common.DefaultIoFilterChainBuilder;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.ServerLocator;
import org.jboss.messaging.core.remoting.TransportType;
+import org.jboss.messaging.util.Logger;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionRequest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionRequest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,14 +26,13 @@
private final String clientVMID;
private final String username;
private final String password;
- private final int failedNodeID;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
public CreateConnectionRequest(byte version,
- String remotingSessionID, String clientVMID, int failedNodeID, String username, String password)
+ String remotingSessionID, String clientVMID, String username, String password)
{
super(REQ_CREATECONNECTION);
@@ -43,7 +42,6 @@
this.version = version;
this.remotingSessionID = remotingSessionID;
this.clientVMID = clientVMID;
- this.failedNodeID = failedNodeID;
this.username = username;
this.password = password;
}
@@ -65,11 +63,6 @@
return clientVMID;
}
- public int getFailedNodeID()
- {
- return failedNodeID;
- }
-
public String getUsername()
{
return username;
@@ -87,7 +80,6 @@
buf.append(", version=" + version);
buf.append(", remotingSessionID=" + remotingSessionID);
buf.append(", clientVMID=" + clientVMID);
- buf.append(", failedNodeID=" + failedNodeID);
buf.append(", username=" + username);
buf.append(", password=" + password);
buf.append("]");
Modified: trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionResponse.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionResponse.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/core/remoting/wireformat/CreateConnectionResponse.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,20 +22,18 @@
// Attributes ----------------------------------------------------
private final String connectionID;
- private final int serverID;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public CreateConnectionResponse(String connectionID, int serverID)
+ public CreateConnectionResponse(String connectionID)
{
super(RESP_CREATECONNECTION);
assertValidID(connectionID);
this.connectionID = connectionID;
- this.serverID = serverID;
}
// Public --------------------------------------------------------
@@ -45,17 +43,6 @@
return connectionID;
}
- public int getServerID()
- {
- return serverID;
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", id=" + connectionID + ", serverID=" + serverID + "]";
- }
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/microcontainer/AuthenticationManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/AuthenticationManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/AuthenticationManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,14 @@
*/
package org.jboss.messaging.microcontainer;
-import org.jboss.security.RealmMapping;
-
-import javax.security.auth.Subject;
import java.security.Principal;
import java.util.Map;
import java.util.Set;
+import javax.security.auth.Subject;
+
+import org.jboss.security.RealmMapping;
+
/**
* This is an implementation of AuthenticationManager and RealmMapping to use when we run embedded. The one we use when in jBoss
* is not available. currently this does not have any functionality. This needs implementing or aleternatively a user can
Modified: trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/JBMBootstrapServer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,20 +21,30 @@
*/
package org.jboss.messaging.microcontainer;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
-import org.jboss.kernel.spi.config.KernelConfig;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-
-import javax.jms.*;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import java.net.URL;
import java.util.List;
import java.util.ListIterator;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.spi.config.KernelConfig;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+
/**
* This is the method in which the JBM server can be deployed externall outside of jBoss. Alternatively a user can embed
* by using the same code as in main
Modified: trunk/src/main/org/jboss/messaging/microcontainer/JndiBinder.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/JndiBinder.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/JndiBinder.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,14 @@
*/
package org.jboss.messaging.microcontainer;
-import org.jboss.util.naming.Util;
+import java.io.Serializable;
+import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import java.io.Serializable;
-import java.util.Hashtable;
+import org.jboss.util.naming.Util;
+
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
*/
Modified: trunk/src/main/org/jboss/messaging/microcontainer/NonSerializableFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/NonSerializableFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/NonSerializableFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,21 @@
*/
package org.jboss.messaging.microcontainer;
-import org.jboss.util.naming.Util;
-
-import javax.naming.*;
-import javax.naming.spi.ObjectFactory;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.naming.spi.ObjectFactory;
+
+import org.jboss.util.naming.Util;
+
/**
* used by the default context when running in embedded local configuration
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/src/main/org/jboss/messaging/microcontainer/ServiceLocator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/ServiceLocator.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/ServiceLocator.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,16 +21,16 @@
*/
package org.jboss.messaging.microcontainer;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.tm.TransactionManagerLocator;
-
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import javax.transaction.TransactionManager;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+import org.jboss.tm.TransactionManagerLocator;
+
/**
* This is a layer that is used for injecting services into other objects. depending on the configuration we are running
* we can get these from more than one place or even inject them.
Modified: trunk/src/main/org/jboss/messaging/microcontainer/factory/Connector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/microcontainer/factory/Connector.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/microcontainer/factory/Connector.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,11 @@
*/
package org.jboss.messaging.microcontainer.factory;
+import java.util.Map;
+
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvocationHandler;
-import java.util.Map;
-
/**
* The connector interface is onlyextended to allow the easy injection of the server invocation handler.
*
Modified: trunk/src/main/org/jboss/messaging/util/AbstractHashSet.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/AbstractHashSet.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/AbstractHashSet.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -23,8 +23,8 @@
package org.jboss.messaging.util;
import java.util.AbstractSet;
+import java.util.Iterator;
import java.util.Map;
-import java.util.Iterator;
/**
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
Modified: trunk/src/main/org/jboss/messaging/util/ConcurrentReaderHashSet.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ConcurrentReaderHashSet.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/ConcurrentReaderHashSet.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,6 +22,7 @@
package org.jboss.messaging.util;
import java.util.Map;
+
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
/**
Modified: trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/ExceptionUtil.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,7 +26,6 @@
import javax.jms.JMSException;
import org.jboss.jms.exception.MessagingJMSException;
-import org.jboss.messaging.util.Logger;
/**
* A ExceptionUtil
Modified: trunk/src/main/org/jboss/messaging/util/Future.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Future.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/Future.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,7 +21,6 @@
*/
package org.jboss.messaging.util;
-import org.jboss.messaging.util.Logger;
/**
* A Future
Deleted: trunk/src/main/org/jboss/messaging/util/ProxyFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ProxyFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/ProxyFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,32 +0,0 @@
-package org.jboss.messaging.util;
-
-import java.lang.reflect.Proxy;
-
-import org.jboss.jms.client.impl.ClosedInterceptor;
-
-public class ProxyFactory
-{
- public static Object proxy(Object delegate, Class targetInterface)
- {
-
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{targetInterface},
- new ClosedInterceptor(delegate));
-
- }
-
- // This operation won't be necessary after we have completed the refactoring... as the interfaces should contain all the API
- // and as we won't have a need for States
- public static Object getDelegate(Object proxy)
- {
- if (proxy==null)
- {
- return null;
- }
- else
- {
- ClosedInterceptor closed = (ClosedInterceptor)Proxy.getInvocationHandler(proxy);
- return closed.getTarget();
- }
- }
-
-}
Modified: trunk/src/main/org/jboss/messaging/util/Util.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Util.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/Util.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -29,7 +29,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.jboss.messaging.util.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
Modified: trunk/src/main/org/jboss/messaging/util/Version.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/Version.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/Version.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -12,8 +12,6 @@
import java.io.Serializable;
import java.util.Properties;
-import org.jboss.messaging.util.Logger;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/jboss/messaging/util/XMLUtil.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/src/main/org/jboss/messaging/util/XMLUtil.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -17,7 +17,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.jboss.messaging.util.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
Modified: trunk/tests/src/org/jboss/messaging/core/impl/bdbje/integration/test/unit/BDBSpeedTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/impl/bdbje/integration/test/unit/BDBSpeedTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/messaging/core/impl/bdbje/integration/test/unit/BDBSpeedTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,19 +21,6 @@
*/
package org.jboss.messaging.core.impl.bdbje.integration.test.unit;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.transaction.xa.Xid;
-
-import org.jboss.messaging.core.Message;
-import org.jboss.messaging.core.MessageReference;
-import org.jboss.messaging.core.Queue;
-import org.jboss.messaging.core.impl.MessageImpl;
-import org.jboss.messaging.core.impl.QueueImpl;
-import org.jboss.messaging.core.impl.bdbje.BDBJEPersistenceManager;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.test.unit.UnitTestCase;
/**
Modified: trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterParserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterParserTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/messaging/core/impl/filter/test/unit/FilterParserTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -25,11 +25,11 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.impl.filter.FilterParser;
import org.jboss.messaging.core.impl.filter.Identifier;
import org.jboss.messaging.core.impl.filter.Operator;
import org.jboss.messaging.test.unit.UnitTestCase;
+import org.jboss.messaging.util.Logger;
/**
Tests of the JavaCC LL(1) parser for the JBoss Messaging filters
Modified: trunk/tests/src/org/jboss/messaging/core/remoting/wireformat/test/unit/PacketTypeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/remoting/wireformat/test/unit/PacketTypeTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/messaging/core/remoting/wireformat/test/unit/PacketTypeTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -84,8 +84,8 @@
import org.apache.mina.common.IoBuffer;
import org.jboss.jms.client.impl.Ack;
-import org.jboss.jms.client.impl.Cancel;
import org.jboss.jms.client.impl.AckImpl;
+import org.jboss.jms.client.impl.Cancel;
import org.jboss.jms.client.impl.CancelImpl;
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.destination.JBossTopic;
@@ -416,18 +416,17 @@
byte version = randomByte();
String remotingSessionID = randomString();
String clientVMID = randomString();
- int failedNodeID = 0;
String username = null;
String password = null;
CreateConnectionRequest request = new CreateConnectionRequest(version,
- remotingSessionID, clientVMID, failedNodeID, username, password);
+ remotingSessionID, clientVMID, username, password);
addVersion(request);
AbstractPacketCodec<CreateConnectionRequest> codec = new ConnectionFactoryCreateConnectionRequestCodec();
SimpleRemotingBuffer buffer = encode(request, codec);
checkHeader(buffer, request);
- checkBody(buffer, version, remotingSessionID, clientVMID, failedNodeID, username, password);
+ checkBody(buffer, version, remotingSessionID, clientVMID, username, password);
buffer.rewind();
AbstractPacket decodedPacket = codec.decode(buffer);
@@ -440,7 +439,6 @@
assertEquals(request.getRemotingSessionID(), decodedRequest
.getRemotingSessionID());
assertEquals(request.getClientVMID(), decodedRequest.getClientVMID());
- assertEquals(request.getFailedNodeID(), decodedRequest.getFailedNodeID());
assertEquals(request.getUsername(), decodedRequest.getUsername());
assertEquals(request.getPassword(), decodedRequest.getPassword());
}
@@ -448,13 +446,13 @@
public void testCreateConnectionResponse() throws Exception
{
CreateConnectionResponse response = new CreateConnectionResponse(
- randomString(), randomInt());
+ randomString());
addVersion(response);
AbstractPacketCodec<CreateConnectionResponse> codec = new ConnectionFactoryCreateConnectionResponseCodec();
SimpleRemotingBuffer buffer = encode(response, codec);
checkHeader(buffer, response);
- checkBody(buffer, response.getConnectionID(), response.getServerID());
+ checkBody(buffer, response.getConnectionID());
buffer.rewind();
AbstractPacket decodedPacket = codec.decode(buffer);
@@ -464,7 +462,6 @@
assertEquals(RESP_CREATECONNECTION, decodedResponse.getType());
assertEquals(response.getConnectionID(), decodedResponse
.getConnectionID());
- assertEquals(response.getServerID(), decodedResponse.getServerID());
}
Modified: trunk/tests/src/org/jboss/messaging/test/unit/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/test/unit/UnitTestCase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/messaging/test/unit/UnitTestCase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -32,8 +32,6 @@
import java.util.List;
import java.util.Map;
-import javax.transaction.xa.Xid;
-
import junit.framework.TestCase;
import org.jboss.messaging.core.Message;
Modified: trunk/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/JBMBaseTestCase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -41,15 +42,8 @@
import javax.transaction.TransactionManager;
import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.JBossSession;
-import org.jboss.jms.client.JBossMessageConsumer;
-import org.jboss.jms.client.api.ClientConsumer;
-import org.jboss.jms.client.impl.ClientConnectionImpl;
-import org.jboss.jms.client.impl.ClientConsumerImpl;
-import org.jboss.jms.client.impl.ClientSessionImpl;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.microcontainer.JBMBootstrapServer;
-import org.jboss.messaging.util.ProxyFactory;
+import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.util.ProxyAssertSupport;
import org.jboss.tm.TransactionManagerLocator;
@@ -167,23 +161,9 @@
return msgIds;
}
- public ClientConsumerImpl getDelegate(MessageConsumer cons)
- {
- return (ClientConsumerImpl)ProxyFactory.getDelegate(((JBossMessageConsumer)cons).getDelegate());
- }
- public ClientSessionImpl getDelegate(Session sess)
+ protected List getReferenceIds(long channelId) throws Throwable
{
- return (ClientSessionImpl)ProxyFactory.getDelegate(((JBossSession)sess).getDelegate());
- }
-
- public ClientConnectionImpl getDelegate(Connection conn)
- {
- return (ClientConnectionImpl)ProxyFactory.getDelegate(((JBossConnection)conn).getDelegate());
- }
-
- protected List getReferenceIds(long channelId) throws Throwable
- {
InitialContext ctx = getInitialContext();
TransactionManager mgr = TransactionManagerLocator.locateTransactionManager();
Modified: trunk/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/AcknowledgementTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -35,10 +35,12 @@
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
import org.jboss.jms.client.JBossSession;
+import org.jboss.jms.client.api.ClientSession;
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -344,7 +346,7 @@
assertRemainingMessages(NUM_MESSAGES);
- log.trace("Session recover called");
+ log.info("Session recover called");
Message m = null;
@@ -352,8 +354,7 @@
for(; i < NUM_MESSAGES; i++)
{
m = consumer.receive();
- log.trace("Received message " + i);
-
+ log.trace("Received message " + i);
}
assertRemainingMessages(NUM_MESSAGES);
@@ -689,7 +690,7 @@
JBossSession sess = (JBossSession)conn.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
- org.jboss.jms.client.api.ClientSession del = getDelegate(sess);
+ ClientSession del = sess.getDelegate();
assertEquals(1000, del.getDupsOKBatchSize());
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,6 +21,22 @@
*/
package org.jboss.test.messaging.jms;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.InvalidSelectorException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.jms.message.SimpleJMSBytesMessage;
@@ -28,8 +44,6 @@
import org.jboss.test.messaging.jms.message.SimpleJMSTextMessage;
import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
-import javax.jms.*;
-
/**
* Safeguards for previously detected TCK failures.
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ClientExitTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ClientExitTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ClientExitTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,21 @@
*/
package org.jboss.test.messaging.jms;
-import org.jboss.messaging.util.Logger;
-import org.jboss.test.messaging.JBMServerTestCase;
-
-import javax.jms.*;
-import javax.naming.InitialContext;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.messaging.util.Logger;
+import org.jboss.test.messaging.JBMServerTestCase;
+
/**
* A test that makes sure that a Messaging client gracefully exists after the last connection is
* closed. Test for http://jira.jboss.org/jira/browse/JBMESSAGING-417.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ClientInRestrictedSecurityEnvironmentTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,17 @@
*/
package org.jboss.test.messaging.jms;
+import java.net.SocketPermission;
+
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.misc.ConfigurableSecurityManager;
-import javax.jms.*;
-import java.net.SocketPermission;
-
/**
* This test runs the JMS client in a restricted security environments.
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,7 +21,17 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionConsumerTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,20 @@
*/
package org.jboss.test.messaging.jms;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ServerSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
import org.jboss.jms.client.JBossConnectionConsumer;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
+import EDU.oswego.cs.dl.util.concurrent.Latch;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,21 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.*;
-import javax.management.ObjectName;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -33,8 +33,6 @@
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
-import org.jboss.jms.client.impl.ClientConnectionImpl;
-import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.messaging.util.Logger;
@@ -70,38 +68,7 @@
// Public --------------------------------------------------------
- public void testResourceManagersForSameServer() throws Exception
- {
- Connection conn1 = cf.createConnection();
-
- ClientConnectionImpl del1 = getDelegate(conn1);
-
- ResourceManager rm1 = del1.getResourceManager();
-
- Connection conn2 = cf.createConnection();
-
- ClientConnectionImpl del2 = getDelegate(conn2);
-
- ResourceManager rm2 = del2.getResourceManager();
-
- //Two connections for same server should share the same resource manager
-
- assertTrue(rm1 == rm2);
-
- assertTrue(ResourceManagerFactory.instance.containsResourceManager(del2.getServerID()));
-
- conn1.close();
-
- //Check reference counting
- assertTrue(ResourceManagerFactory.instance.containsResourceManager(del2.getServerID()));
-
- conn2.close();
-
- assertFalse(ResourceManagerFactory.instance.containsResourceManager(del2.getServerID()));
-
- assertEquals(0, ResourceManagerFactory.instance.size());
- }
-
+
public void testResourceManagerFactory()
{
ResourceManagerFactory.instance.checkOutResourceManager(1);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/DLQTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,16 +21,26 @@
*/
package org.jboss.test.messaging.jms;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.management.ObjectName;
+
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.message.JBossMessage;
import org.jboss.messaging.core.impl.server.MessagingServerImpl;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
-import javax.management.ObjectName;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* A DLQTest
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,24 @@
*/
package org.jboss.test.messaging.jms;
-import org.jboss.messaging.core.impl.server.SubscriptionInfo;
+import java.util.List;
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
import javax.jms.IllegalStateException;
-import javax.naming.NamingException;
-import java.util.List;
+import javax.jms.InvalidDestinationException;
+import javax.jms.InvalidSelectorException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+import org.jboss.messaging.core.impl.server.SubscriptionInfo;
+
/**
* Tests focused on durable subscription behavior. More durable subscription tests can be found in
* MessageConsumerTest.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ExpiryQueueTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,25 @@
*/
package org.jboss.test.messaging.jms;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.ObjectName;
+
import org.jboss.jms.destination.JBossQueue;
import org.jboss.jms.message.JBossMessage;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
-import javax.management.ObjectName;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* A ExpiryQueueTest
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/GracefulClient.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/GracefulClient.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/GracefulClient.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,16 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.*;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+
/**
* Code to be run in an external VM, via main().
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/JMSTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/JMSTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/JMSTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,18 @@
*/
package org.jboss.test.messaging.jms;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
import EDU.oswego.cs.dl.util.concurrent.Slot;
-import javax.jms.*;
-import javax.naming.InitialContext;
-
/**
* The most comprehensive, yet simple, unit test.
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -1,10 +1,10 @@
package org.jboss.test.messaging.jms;
+import javax.naming.InitialContext;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.naming.InitialContext;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: $</tt>23 Jul 2007
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MemLeakTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,22 +21,37 @@
*/
package org.jboss.test.messaging.jms;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.MBeanServer;
+import javax.naming.InitialContext;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.messaging.util.Logger;
import org.jboss.profiler.jvmti.InventoryDataPoint;
import org.jboss.profiler.jvmti.JVMTIInterface;
-import org.jboss.remoting.*;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import javax.management.MBeanServer;
-import javax.naming.InitialContext;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Map;
-
/**
*
* These tests should be run manually with a profiler running.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,34 @@
*/
package org.jboss.test.messaging.jms;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
-import org.jboss.jms.destination.JBossTopic;
-
-import javax.jms.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueReceiver;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+
+import org.jboss.jms.destination.JBossTopic;
+
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageProducerTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,14 +26,12 @@
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
-import javax.jms.InvalidDestinationException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
-import org.jboss.jms.destination.JBossTopic;
import org.jboss.test.messaging.jms.message.SimpleJMSMessage;
import org.jboss.test.messaging.jms.message.SimpleJMSTextMessage;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageProxyTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageProxyTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageProxyTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,18 +21,7 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.test.messaging.tools.ServerManagement;
-
/**
*
* A MessageProxyTest
Modified: trunk/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/PersistenceTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,7 +21,12 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
/**
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,17 @@
*/
package org.jboss.test.messaging.jms;
-import javax.jms.*;
import java.util.HashSet;
import java.util.Set;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,7 @@
*/
package org.jboss.test.messaging.jms;
-import org.jboss.jms.message.JBossMessage;
-import javax.jms.*;
-
/**
*
* A ScheduledDeliveryTest
Modified: trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/SecurityTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,7 +21,10 @@
*/
package org.jboss.test.messaging.jms;
+import java.util.HashSet;
+
import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.IllegalStateException;
import javax.jms.JMSSecurityException;
@@ -39,16 +42,10 @@
import org.jboss.jms.exception.MessagingXAException;
import org.jboss.jms.server.security.Role;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.tx.MessagingXid;
-import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
-import javax.jms.IllegalStateException;
-import javax.transaction.xa.XAResource;
-import java.util.HashSet;
-
/**
* Test JMS Security.
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/SessionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/SessionTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/SessionTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,28 @@
*/
package org.jboss.test.messaging.jms;
-import org.jboss.jms.client.impl.ClientSessionImpl;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
+import javax.jms.XAConnection;
+import javax.jms.XASession;
+
+import org.jboss.jms.client.JBossSession;
+import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -63,7 +79,7 @@
cons.receive();
sess.commit();
- ClientSessionImpl del = getDelegate(sess);
+ ClientSession del = ((JBossSession)sess).getDelegate();
//SessionState state = (SessionState)del.getState();
//ConnectionState cState = (ConnectionState)state.getParent();
Modified: trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/TransactedSessionTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -29,9 +29,6 @@
import javax.jms.TextMessage;
import javax.management.ObjectName;
-import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.impl.ClientConnectionImpl;
-import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
/**
@@ -56,89 +53,7 @@
// Public --------------------------------------------------------
- public void testResourceManagerMemoryLeakOnCommit() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = cf.createConnection();
-
- JBossConnection jbConn = (JBossConnection)conn;
-
- ClientConnectionImpl del = getDelegate(jbConn);
-
- ResourceManager rm = del.getResourceManager();
-
- Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
-
- for (int i = 0; i < 100; i++)
- {
- assertEquals(1, rm.size());
-
- session.commit();
-
- assertEquals(1, rm.size());
- }
-
- assertEquals(1, rm.size());
-
- conn.close();
-
- conn = null;
-
- assertEquals(0, rm.size());
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- public void testResourceManagerMemoryLeakOnRollback() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = cf.createConnection();
-
- ClientConnectionImpl del = getDelegate(conn);
-
- ResourceManager rm = del.getResourceManager();
-
- Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
-
- for (int i = 0; i < 100; i++)
- {
- assertEquals(1, rm.size());
-
- session.commit();
-
- assertEquals(1, rm.size());
- }
-
- assertEquals(1, rm.size());
-
- conn.close();
-
- conn = null;
-
- assertEquals(0, rm.size());
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
-
+
public void testSimpleRollback() throws Exception
{
// send a message
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,23 @@
*/
package org.jboss.test.messaging.jms;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.jta.xa.XidImple;
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.XAConnection;
+import javax.jms.XASession;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.messaging.core.tx.MessagingXid;
-import javax.jms.*;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.jta.xa.XidImple;
/**
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,7 +21,11 @@
*/
package org.jboss.test.messaging.jms;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+import javax.jms.Queue;
+import javax.naming.InitialContext;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.test.messaging.JBMServerTestCase;
@@ -29,11 +33,7 @@
import org.jboss.test.messaging.tools.container.ServiceContainer;
import org.jboss.tm.TxUtils;
-import javax.jms.*;
-import javax.naming.InitialContext;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
/**
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XATest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XATest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,6 +22,7 @@
package org.jboss.test.messaging.jms;
import java.util.ArrayList;
+
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.JMSException;
@@ -43,24 +44,25 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.JBossSession;
-import org.jboss.jms.client.impl.ClientConnectionImpl;
+import org.jboss.jms.client.api.ClientConnection;
+import org.jboss.jms.client.api.ClientSession;
import org.jboss.jms.tx.LocalTx;
import org.jboss.jms.tx.MessagingXAResource;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
+import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
-import org.jboss.messaging.util.ProxyFactory;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.ServiceContainer;
import org.jboss.tm.TransactionManagerLocator;
import org.jboss.tm.TxUtils;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+
/**
*
* A XATestBase
@@ -278,8 +280,8 @@
Transaction trans = tm.getTransaction();
- org.jboss.jms.client.api.ClientSession clientSession = getDelegate(xasession);
-
+ ClientSession clientSession = ((JBossSession)xasession).getDelegate();
+
// Validates TX convertion
assertTrue(clientSession.getCurrentTxId() instanceof LocalTx);
@@ -578,7 +580,7 @@
JBossConnection jbConn = (JBossConnection)xaConn;
- ClientConnectionImpl del = getDelegate(jbConn);
+ ClientConnection del = ((JBossConnection)jbConn).getDelegate();
ResourceManager rm = del.getResourceManager();
@@ -638,7 +640,7 @@
JBossConnection jbConn = (JBossConnection)xaConn;
- ClientConnectionImpl del = getDelegate(xaConn);
+ ClientConnection del = ((JBossConnection)xaConn).getDelegate();
ResourceManager rm = del.getResourceManager();
@@ -727,6 +729,7 @@
DummyListener listener = new DummyListener();
+ //We set the distinguised listener so it will convert
xaSession.setMessageListener(listener);
ServerSessionPool pool = new MockServerSessionPool(xaSession);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,16 +21,23 @@
*/
package org.jboss.test.messaging.jms.bridge;
+import java.io.ByteArrayOutputStream;
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
import org.jboss.jms.server.bridge.Bridge;
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import java.io.ByteArrayOutputStream;
-import java.util.Properties;
-
/**
* A BridgeMBeanTest
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,18 +21,32 @@
*/
package org.jboss.test.messaging.jms.bridge;
-import org.jboss.jms.server.bridge.*;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.jms.server.bridge.Bridge;
+import org.jboss.jms.server.bridge.ConnectionFactoryFactory;
+import org.jboss.jms.server.bridge.DestinationFactory;
+import org.jboss.jms.server.bridge.JNDIConnectionFactoryFactory;
+import org.jboss.jms.server.bridge.JNDIDestinationFactory;
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.ServiceContainer;
-import javax.jms.*;
-import javax.naming.InitialContext;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
/**
*
* A BridgeTestBase
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectWithRecoveryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,11 @@
*/
package org.jboss.test.messaging.jms.bridge;
-import org.jboss.jms.server.bridge.Bridge;
+import java.util.Properties;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import java.util.Properties;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision: 1.1 $</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,20 +21,19 @@
*/
package org.jboss.test.messaging.jms.crash;
+import javax.jms.ConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
import org.jboss.jms.server.ConnectionManager;
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.LocalTestServer;
import org.jboss.test.messaging.tools.container.Server;
import org.jboss.test.messaging.tools.container.ServiceContainer;
-import javax.jms.ConnectionFactory;
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
/**
*
* A ClientCrashTest.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/manual/FailoverTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,14 @@
*/
package org.jboss.test.messaging.jms.manual;
-import junit.framework.TestCase;
-import org.jboss.messaging.util.Logger;
-
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
+import junit.framework.TestCase;
+
+import org.jboss.messaging.util.Logger;
+
public class FailoverTest extends TestCase
{
private static final Logger log = Logger.getLogger(FailoverTest.class);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -6,11 +6,15 @@
*/
package org.jboss.test.messaging.jms.message;
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSPriorityHeaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSPriorityHeaderTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSPriorityHeaderTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,15 @@
*/
package org.jboss.test.messaging.jms.message;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,16 @@
*/
package org.jboss.test.messaging.jms.message;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
+import javax.jms.XASession;
import javax.naming.InitialContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -34,6 +38,12 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.jboss.test.messaging.JBMServerTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.container.ServiceContainer;
+
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+
/**
*
* A JMSXDeliveryCountTest
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/MessageBodyTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/MessageBodyTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/MessageBodyTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,26 @@
*/
package org.jboss.test.messaging.jms.message;
-import org.jboss.test.messaging.JBMServerTestCase;
-
-import javax.jms.*;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.HashSet;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.MapMessage;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+
+import org.jboss.test.messaging.JBMServerTestCase;
+
/**
*
* A MessageBodyTest
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTestBase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/MessageHeaderTestBase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,32 @@
*/
package org.jboss.test.messaging.jms.message;
+import java.util.Arrays;
+import java.util.Enumeration;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+
import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.message.*;
+import org.jboss.jms.message.JBossBytesMessage;
+import org.jboss.jms.message.JBossMapMessage;
+import org.jboss.jms.message.JBossMessage;
+import org.jboss.jms.message.JBossObjectMessage;
+import org.jboss.jms.message.JBossStreamMessage;
+import org.jboss.jms.message.JBossTextMessage;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import java.util.Arrays;
-import java.util.Enumeration;
-
/**
*
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/MessagePropertyConversionTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/MessagePropertyConversionTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/MessagePropertyConversionTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,15 @@
*/
package org.jboss.test.messaging.jms.message;
+import javax.jms.Connection;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-
/**
*
* Testing of message property conversion.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,16 @@
*/
package org.jboss.test.messaging.jms.message;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageDeliveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageDeliveryTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageDeliveryTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,18 @@
*/
package org.jboss.test.messaging.jms.message;
+import java.io.Serializable;
+
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TopicConnection;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import java.io.Serializable;
-
/**
*
* A ObjectMessageDeliveryTest
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/ObjectMessageTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,16 +21,17 @@
*/
package org.jboss.test.messaging.jms.message;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.StringTokenizer;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+
/**
* A test that sends/receives object messages to the JMS provider and verifies their integrity.
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignMessageTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignMessageTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,12 +21,12 @@
*/
package org.jboss.test.messaging.jms.message.foreign;
+import javax.jms.Message;
+
import org.jboss.test.messaging.jms.message.MessageTestBase;
import org.jboss.test.messaging.jms.message.SimpleJMSMessage;
-import javax.jms.Message;
-
/**
*
* Tests the delivery/receipt of a foreign message
Modified: trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,22 @@
*/
package org.jboss.test.messaging.jms.selector;
-import EDU.oswego.cs.dl.util.concurrent.Latch;
-import org.jboss.test.messaging.JBMServerTestCase;
-
-import javax.jms.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.jboss.test.messaging.JBMServerTestCase;
+
+import EDU.oswego.cs.dl.util.concurrent.Latch;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/ConcurrentCloseStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,16 +22,23 @@
package org.jboss.test.messaging.jms.stress;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.jms.ConnectionTest;
-import javax.jms.*;
-import javax.naming.InitialContext;
-import java.util.ArrayList;
-import java.util.Iterator;
-
/**
* This test was added to test regression on http://jira.jboss.com/jira/browse/JBMESSAGING-660
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/CorruptMessageStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -6,12 +6,18 @@
*/
package org.jboss.test.messaging.jms.stress;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import javax.naming.InitialContext;
-
/**
* A stress test written to investigate http://jira.jboss.org/jira/browse/JBMESSAGING-362
*
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/ManyConnectionsStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -6,15 +6,25 @@
*/
package org.jboss.test.messaging.jms.stress;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import javax.naming.InitialContext;
-import java.util.HashSet;
-import java.util.Set;
-
/**
*
* Create 500 connections each with a consumer, consuming from a topic
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,23 @@
*/
package org.jboss.test.messaging.jms.stress;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.util.id.GUID;
-import javax.jms.*;
-import javax.naming.InitialContext;
-
/**
*
* A OpenCloseStressTest.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -6,12 +6,21 @@
*/
package org.jboss.test.messaging.jms.stress;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.jms.*;
-import javax.naming.InitialContext;
-
/**
* Send messages to a topic with selector1, consumer them with multiple consumers and relay them
* back to the topic with a different selector, then consume that with more consumers.
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -22,17 +22,26 @@
package org.jboss.test.messaging.jms.stress;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Random;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.naming.Context;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import javax.jms.*;
-import javax.naming.Context;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Random;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
/**
* In order for this test to run, you will need to edit /etc/security/limits.conf and change your max sockets to something bigger than 1024
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/StressTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/StressTestBase.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/StressTestBase.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,14 @@
*/
package org.jboss.test.messaging.jms.stress;
-import org.jboss.test.messaging.JBMServerTestCase;
-
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Topic;
import javax.jms.XASession;
-import javax.naming.InitialContext;
+import org.jboss.jms.client.JBossSession;
+import org.jboss.test.messaging.JBMServerTestCase;
+
/**
*
* Base class for stress tests
@@ -149,6 +149,6 @@
protected void tweakXASession(XASession sess)
{
- getDelegate(sess).setTreatAsNonTransactedWhenNotEnlisted(false);
+ ((JBossSession)sess).getDelegate().setTreatAsNonTransactedWhenNotEnlisted(false);
}
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,8 +26,8 @@
import javax.jms.XASession;
import javax.transaction.xa.XAResource;
+import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.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 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -26,8 +26,8 @@
import javax.jms.XASession;
import javax.transaction.xa.XAResource;
+import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.core.tx.MessagingXid;
import org.jboss.util.id.GUID;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,18 +21,31 @@
*/
package org.jboss.test.messaging.tools;
-import org.jboss.messaging.util.Logger;
-import org.jboss.test.messaging.tools.container.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.rmi.Naming;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.transaction.UserTransaction;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.rmi.Naming;
-import java.util.*;
+import org.jboss.messaging.util.Logger;
+import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
+import org.jboss.test.messaging.tools.container.LocalTestServer;
+import org.jboss.test.messaging.tools.container.NotificationListenerID;
+import org.jboss.test.messaging.tools.container.RMITestServer;
+import org.jboss.test.messaging.tools.container.RemoteInitialContextFactory;
+import org.jboss.test.messaging.tools.container.Server;
+import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
+
+
/**
* Collection of static methods to use to start/stop and interact with the in-memory JMS server. It
* is also use to start/stop a remote server.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/TestJMSProviderAdaptor.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,11 @@
*/
package org.jboss.test.messaging.tools;
+import java.util.Properties;
+
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import java.util.Properties;
//import org.jboss.jms.jndi.JMSProviderAdapter;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/DatabaseClearer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,14 +21,15 @@
*/
package org.jboss.test.messaging.tools.container;
-import org.jboss.messaging.util.Logger;
-
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+
+import org.jboss.messaging.util.Logger;
+
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
*/
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/Example.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/Example.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/Example.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,12 @@
*/
package org.jboss.test.messaging.tools.container;
+import java.sql.Connection;
+import java.sql.ResultSet;
+
import javax.naming.InitialContext;
import javax.sql.DataSource;
import javax.transaction.TransactionManager;
-import java.sql.Connection;
-import java.sql.ResultSet;
/**
* An example how to use ServiceContainer to get access to an in-memory database.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/InVMContext.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,15 +21,31 @@
*/
package org.jboss.test.messaging.tools.container;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+
+import org.jboss.messaging.microcontainer.NonSerializableFactory;
import org.jboss.messaging.util.Logger;
-import org.jboss.messaging.microcontainer.NonSerializableFactory;
import org.jboss.messaging.util.NotYetImplementedException;
-import javax.naming.*;
-import java.io.Serializable;
-import java.util.*;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision: 2868 $</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/InVMInitialContextFactory.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/InVMInitialContextFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/InVMInitialContextFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,14 @@
*/
package org.jboss.test.messaging.tools.container;
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
/**
* An in-VM JNDI InitialContextFactory. Lightweight JNDI implementation used for testing.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/JBMPropertyKernelConfig.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,10 @@
*/
package org.jboss.test.messaging.tools.container;
+import java.util.Properties;
+
import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
-import java.util.Properties;
-
/**
* used for setting the server id and used by the configuration helper
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,6 +21,28 @@
*/
package org.jboss.test.messaging.tools.container;
+import java.io.File;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.jms.InvalidDestinationException;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.impl.ClientConnectionFactoryImpl;
import org.jboss.jms.destination.JBossQueue;
@@ -30,7 +52,11 @@
import org.jboss.jms.server.security.Role;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.*;
+import org.jboss.messaging.core.Binding;
+import org.jboss.messaging.core.Condition;
+import org.jboss.messaging.core.DestinationType;
+import org.jboss.messaging.core.MessagingServer;
+import org.jboss.messaging.core.MessagingServerManagement;
import org.jboss.messaging.core.impl.ConditionImpl;
import org.jboss.messaging.core.remoting.ServerLocator;
import org.jboss.messaging.microcontainer.JBMBootstrapServer;
@@ -41,21 +67,6 @@
import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
import org.jboss.tm.TransactionManagerLocator;
-import javax.jms.InvalidDestinationException;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-import java.io.File;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.*;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -663,7 +674,7 @@
boolean useStrict = getMessagingServer().getConfiguration().isStrictTck() || connectionFactory.isStrictTck();
ClientConnectionFactoryImpl delegate =
- new ClientConnectionFactoryImpl(connectionFactory.getName(), id, getMessagingServer().getConfiguration().getMessagingServerID(),
+ new ClientConnectionFactoryImpl(id, getMessagingServer().getConfiguration().getMessagingServerID(),
serverLocator.getURI(), version, false, useStrict);
log.debug(this + " created local delegate " + delegate);
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/MockJBossSecurityManager.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,6 @@
*/
package org.jboss.test.messaging.tools.container;
-import org.jboss.messaging.util.Logger;
-import org.jboss.security.*;
-
-import javax.security.auth.Subject;
-import javax.security.auth.message.MessageInfo;
import java.security.Principal;
import java.security.acl.Group;
import java.util.HashSet;
@@ -33,7 +28,19 @@
import java.util.Map;
import java.util.Set;
+import javax.security.auth.Subject;
+import javax.security.auth.message.MessageInfo;
+import org.jboss.messaging.util.Logger;
+import org.jboss.security.AnybodyPrincipal;
+import org.jboss.security.AuthenticationManager;
+import org.jboss.security.NobodyPrincipal;
+import org.jboss.security.RealmMapping;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+
+
/**
* Mock Security manager for testing JMS security.
*
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -37,9 +37,9 @@
import javax.transaction.UserTransaction;
import org.jboss.jms.server.security.Role;
-import org.jboss.messaging.util.Logger;
import org.jboss.messaging.core.MessagingServer;
import org.jboss.messaging.core.MessagingServerManagement;
+import org.jboss.messaging.util.Logger;
/**
* An RMI wrapper to access the ServiceContainer from a different address space.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RemoteInitialContextFactory.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,14 @@
*/
package org.jboss.test.messaging.tools.container;
-import org.jboss.messaging.util.Logger;
+import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
-import java.util.Hashtable;
+import org.jboss.messaging.util.Logger;
+
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision: 2868 $</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,10 +21,11 @@
*/
package org.jboss.test.messaging.tools.container;
-import javax.management.ObjectName;
import java.util.ArrayList;
import java.util.List;
+import javax.management.ObjectName;
+
/**
* An MBeanServer and a configurable set of services (TransactionManager, Remoting, etc) available
* for testing.
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,11 +21,11 @@
*/
package org.jboss.test.messaging.tools.container;
+import java.rmi.Naming;
+
import org.jboss.messaging.util.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
-import java.rmi.Naming;
-
/**
* A utility to stop runaway rmi servers.
*
Modified: trunk/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2008-01-22 16:00:28 UTC (rev 3613)
+++ trunk/tests/src/org/jboss/test/messaging/util/JNDIUtilTest.java 2008-01-22 16:41:40 UTC (rev 3614)
@@ -21,13 +21,13 @@
*/
package org.jboss.test.messaging.util;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
import org.jboss.messaging.util.JNDIUtil;
import org.jboss.test.messaging.JBMServerTestCase;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-
/**
* @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
More information about the jboss-cvs-commits
mailing list