[jboss-cvs] JBoss Messaging SVN: r2591 - in branches/Branch_1_0_1_SP: src/main/org/jboss/jms/message and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 19 11:25:51 EDT 2007
Author: timfox
Date: 2007-04-19 11:25:51 -0400 (Thu, 19 Apr 2007)
New Revision: 2591
Removed:
branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
Modified:
branches/Branch_1_0_1_SP/build-messaging.xml
branches/Branch_1_0_1_SP/build-thirdparty.xml
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/message/JBossMessage.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ConnectionManager.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/DeliveryRunnable.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-929 and http://jira.jboss.org/jira/browse/JBMESSAGING-622 and update dependencies
Modified: branches/Branch_1_0_1_SP/build-messaging.xml
===================================================================
--- branches/Branch_1_0_1_SP/build-messaging.xml 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/build-messaging.xml 2007-04-19 15:25:51 UTC (rev 2591)
@@ -149,7 +149,9 @@
present in ./lib, it will take precedence over the corresponding repository instance.
-->
<path id="jboss.dependencies.classpath">
- <path refid="jboss.common.classpath"/>
+ <path refid="jboss/common.core.classpath"/>
+ <path refid="jboss/common.logging.log4j.classpath"/>
+ <path refid="jboss/common.logging.spi.classpath"/>
<path refid="jboss.aop.classpath"/>
<path refid="jboss.remoting.classpath"/>
<path refid="jboss.serialization.classpath"/>
Modified: branches/Branch_1_0_1_SP/build-thirdparty.xml
===================================================================
--- branches/Branch_1_0_1_SP/build-thirdparty.xml 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/build-thirdparty.xml 2007-04-19 15:25:51 UTC (rev 2591)
@@ -87,10 +87,12 @@
<componentref name="javassist" version="3.2.0.GA"/>
<componentref name="jgroups" version="2.3"/>
<componentref name="trove" version="1.0.2"/>
- <componentref name="jboss/common" version="snapshot"/>
+ <componentref name="jboss/common-core" version="2.0.2.GA"/>
+ <componentref name="jboss/common-logging-log4j" version="2.0.2.GA"/>
+ <componentref name="jboss/common-logging-spi" version="2.0.2.GA"/>
<componentref name="jboss/aop" version="1.5.0.GA"/>
<componentref name="jboss/serialization" version="1.0.3.GA"/>
- <componentref name="jboss/remoting" version="2.2.0.Alpha7"/>
+ <componentref name="jboss/remoting" version="2.2.0.SP1"/>
<!-- Need this otherwise project doesn't build in Eclipse -->
<componentref name="apache-logging" version="1.0.4.1jboss"/>
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/message/JBossMessage.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/message/JBossMessage.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -66,6 +66,7 @@
* @author David Maplesden (David.Maplesden at orion.co.nz)
* @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:bershath at yahoo.com">Tyronne Wickramarathne</a>
*
* $Id$
*/
@@ -435,11 +436,19 @@
public void setJMSReplyTo(Destination replyTo) throws JMSException
{
- if (!(replyTo instanceof JBossDestination))
+ //Need to be able to set nulls too
+ if (replyTo == null)
{
- throw new InvalidDestinationException("Replyto cannot be foreign");
+ this.replyToDestination = null;
}
- this.replyToDestination = (JBossDestination)replyTo;
+ else
+ {
+ if (!(replyTo instanceof JBossDestination))
+ {
+ throw new InvalidDestinationException("Replyto cannot be foreign");
+ }
+ this.replyToDestination = (JBossDestination)replyTo;
+ }
}
public Destination getJMSDestination() throws JMSException
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ConnectionManager.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ConnectionManager.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ConnectionManager.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -42,8 +42,6 @@
*/
ConnectionEndpoint unregisterConnection(String jmsClientVMId, String remotingClientSessionID);
- void handleClientFailure(String remotingSessionID);
-
boolean containsSession(String remotingClientSessionID);
/**
@@ -54,5 +52,7 @@
* @return List<ConnectionEndpoint>
*/
List getActiveConnections();
+
+ void handleClientFailure(String remotingSessionID);
}
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/ServerPeer.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -232,6 +232,10 @@
createRecoverable();
+ //Now everything is started we can tell the invocation handler to start handling invocations
+ //We do this right at the end otherwise it can start handling invocations before we are properly started
+ JMSServerInvocationHandler.setClosed(false);
+
started = true;
log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
@@ -255,6 +259,11 @@
log.debug(this + " stopping");
started = false;
+
+ //Tell the invocation handler we are closed - this is so we don't attempt to handle
+ //any invocations when we are in a partial closing down state - which can give strange
+ //"object not found with id" exceptions and stuff like that
+ JMSServerInvocationHandler.setClosed(true);
removeRecoverable();
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/connectionmanager/SimpleConnectionManager.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -126,6 +126,32 @@
return null;
}
+
+
+ public synchronized List getActiveConnections()
+ {
+ // I will make a copy to avoid ConcurrentModification
+ ArrayList list = new ArrayList();
+ list.addAll(activeConnectionEndpoints);
+ return list;
+ }
+
+ /*
+ * Used in testing only
+ */
+ public synchronized boolean containsSession(String remotingClientSessionID)
+ {
+ return sessions.containsKey(remotingClientSessionID);
+ }
+
+ /*
+ * Used in testing only
+ */
+ public synchronized Map getClients()
+ {
+ return Collections.unmodifiableMap(jmsClients);
+ }
+
public synchronized void handleClientFailure(String remotingSessionID)
{
String jmsClientId = (String)sessions.get(remotingSessionID);
@@ -182,30 +208,6 @@
}
}
- public synchronized List getActiveConnections()
- {
- // I will make a copy to avoid ConcurrentModification
- ArrayList list = new ArrayList();
- list.addAll(activeConnectionEndpoints);
- return list;
- }
-
- /*
- * Used in testing only
- */
- public synchronized boolean containsSession(String remotingClientSessionID)
- {
- return sessions.containsKey(remotingClientSessionID);
- }
-
- /*
- * Used in testing only
- */
- public synchronized Map getClients()
- {
- return Collections.unmodifiableMap(jmsClients);
- }
-
// ConnectionListener --------------------------------------------
/**
@@ -246,6 +248,8 @@
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
+
+
// Inner classes -------------------------------------------------
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/DeliveryRunnable.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/DeliveryRunnable.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/DeliveryRunnable.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -93,9 +93,8 @@
log.trace("Failed to deliver message", t);
}
- ConnectionManager mgr = connection.getServerPeer().getConnectionManager();
-
- mgr.handleClientFailure(connection.getRemotingClientSessionId());
+ // When the leaser detects the connection broken it will close the connection
+
}
}
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -818,12 +818,9 @@
}
catch(Throwable t)
{
- log.warn("Failed to deliver the message to the client. See the server log for more details.");
log.debug(ServerConsumerEndpoint.this + " failed to deliver the message to the client.", t);
-
- ConnectionManager mgr = connection.getServerPeer().getConnectionManager();
-
- mgr.handleClientFailure(connection.getRemotingClientSessionId());
+
+ //When the leaser detects the connection broken it will close the connection
}
}
Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -31,6 +31,7 @@
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.util.PayloadKey;
+import org.jboss.jms.util.MessagingJMSException;
import org.jboss.logging.Logger;
import org.jboss.messaging.util.Util;
import org.jboss.remoting.InvocationRequest;
@@ -62,7 +63,15 @@
protected Map callbackHandlers;
private boolean trace;
+
+ // We need some way the server peer can call the invocation handler to make it open/closed
+ private static boolean closed = true;
+ public static synchronized void setClosed(boolean closed)
+ {
+ JMSServerInvocationHandler.closed = closed;
+ }
+
// Constructors --------------------------------------------------
public JMSServerInvocationHandler()
@@ -89,46 +98,54 @@
{
if (trace) { log.trace("invoking " + invocation); }
- MessagingMarshallable mm = (MessagingMarshallable)invocation.getParameter();
-
- MethodInvocation i = (MethodInvocation)mm.getLoad();
-
- // put the version number into meta data for use in the InjectionInterceptor
- i.getMetaData().addMetaData(MetaDataConstants.JMS,
- MetaDataConstants.VERSION_NUMBER,
- new Byte(mm.getVersion()),
- PayloadKey.TRANSIENT);
-
- String s =
- (String)i.getMetaData(MetaDataConstants.JMS, MetaDataConstants.REMOTING_SESSION_ID);
-
- if (s != null)
- {
- Object callbackHandler = null;
- synchronized(callbackHandlers)
+ synchronized (JMSServerInvocationHandler.class)
+ {
+ if (closed)
{
- callbackHandler = callbackHandlers.get(s);
+ throw new MessagingJMSException("Cannot handle invocation since messaging server is not active (it is either starting up or shutting down)");
}
- if (callbackHandler != null)
+
+ MessagingMarshallable mm = (MessagingMarshallable)invocation.getParameter();
+
+ MethodInvocation i = (MethodInvocation)mm.getLoad();
+
+ // put the version number into meta data for use in the InjectionInterceptor
+ i.getMetaData().addMetaData(MetaDataConstants.JMS,
+ MetaDataConstants.VERSION_NUMBER,
+ new Byte(mm.getVersion()),
+ PayloadKey.TRANSIENT);
+
+ String s =
+ (String)i.getMetaData(MetaDataConstants.JMS, MetaDataConstants.REMOTING_SESSION_ID);
+
+ if (s != null)
{
- log.debug("found calllback handler for remoting session " + Util.guidToString(s));
-
- i.getMetaData().addMetaData(MetaDataConstants.JMS,
- MetaDataConstants.CALLBACK_HANDLER,
- callbackHandler, PayloadKey.TRANSIENT);
+ Object callbackHandler = null;
+ synchronized(callbackHandlers)
+ {
+ callbackHandler = callbackHandlers.get(s);
+ }
+ if (callbackHandler != null)
+ {
+ log.debug("found calllback handler for remoting session " + Util.guidToString(s));
+
+ i.getMetaData().addMetaData(MetaDataConstants.JMS,
+ MetaDataConstants.CALLBACK_HANDLER,
+ callbackHandler, PayloadKey.TRANSIENT);
+ }
+ else
+ {
+ throw new javax.jms.IllegalStateException("Cannot find callback handler " +
+ "for session id " + s);
+ }
}
- else
- {
- throw new javax.jms.IllegalStateException("Cannot find callback handler " +
- "for session id " + s);
- }
+
+ InvocationResponse resp = JMSDispatcher.instance.invoke(i);
+
+ byte version = mm.getVersion();
+
+ return new MessagingMarshallable(version, resp.getResponse());
}
-
- InvocationResponse resp = JMSDispatcher.instance.invoke(i);
-
- byte version = mm.getVersion();
-
- return new MessagingMarshallable(version, resp.getResponse());
}
public void addListener(InvokerCallbackHandler callbackHandler)
Deleted: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -1,169 +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.test.messaging.jms.crash;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.jms.server.ConnectionManager;
-import org.jboss.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.jms.CreateHangingConsumerCommand;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.jmx.ServiceContainer;
-import org.jboss.test.messaging.tools.jmx.rmi.LocalTestServer;
-import org.jboss.test.messaging.tools.jmx.rmi.Server;
-import org.jboss.test.messaging.tools.jndi.InVMInitialContextFactory;
-
-/**
- *
- * A CallbackFailureTest.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version 1.1
- *
- * CallbackFailureTest.java,v 1.1 2006/02/21 08:22:28 timfox Exp
- */
-public class CallbackFailureTest extends MessagingTestCase
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(CallbackFailureTest.class);
-
- // Attributes ----------------------------------------------------
-
- protected Server localServer;
-
- protected Server remoteServer;
-
- // Constructors --------------------------------------------------
-
- public CallbackFailureTest(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void setUp() throws Exception
- {
- super.setUp();
-
- //Start the local server
- localServer = new LocalTestServer();
-
- //Start all the services locally
- localServer.start("all");
-
- localServer.deployQueue("Queue", null);
-
- //Connect to the remote server, but don't start a servicecontainer on it
- //We are only using the remote server to open a client connection to the local server
- ServerManagement.create();
-
- remoteServer = ServerManagement.getServer();
- }
-
- public void tearDown() throws Exception
- {
- localServer.stop();
- }
-
- /*
- * Test that when a client callback fails, server side resources for connections are cleaned-up
- */
- public void testCallbackFailure() throws Exception
- {
- if (!ServerManagement.isRemote()) return;
-
- //We need to disable exception listener otherwise it will clear up the connection itself
-
- ObjectName connectorName = ServiceContainer.REMOTING_OBJECT_NAME;
-
- ConnectionManager cm = localServer.getServerPeer().getConnectionManager();
-
- localServer.getServerPeer().getServer().invoke(connectorName, "removeConnectionListener",
- new Object[] {cm},
- new String[] {"org.jboss.remoting.ConnectionListener"});
-
- InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
-
- ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
- Queue queue = (Queue)ic.lookup("/queue/Queue");
-
- CreateHangingConsumerCommand command = new CreateHangingConsumerCommand(cf, queue);
-
- String remotingSessionId = (String)remoteServer.executeCommand(command);
-
- remoteServer.exit();
-
- //we have removed the exception listener so the server side resouces shouldn't be cleared up
-
- Thread.sleep(20000);
-
- assertTrue(cm.containsSession(remotingSessionId));
-
- //Now we send a message which should prompt delivery to the dead consumer causing
- //an exception which should cause connection cleanup
-
- Connection conn = cf.createConnection();
-
- Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer prod = sess.createProducer(queue);
-
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
- prod.send(sess.createMessage());
-
- Thread.sleep(45000);
-
- assertFalse(cm.containsSession(remotingSessionId));
-
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
-
- // Inner classes -------------------------------------------------
-
-}
Modified: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java 2007-04-19 15:19:00 UTC (rev 2590)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java 2007-04-19 15:25:51 UTC (rev 2591)
@@ -67,7 +67,15 @@
assertEquals(tempQ, m.getJMSReplyTo());
}
-
+ public void testJMSDestinationNull() throws Exception
+ {
+ Message m = queueProducerSession.createMessage();
+ m.setJMSReplyTo(null);
+
+ queueProducer.send(m);
+ queueConsumer.receive();
+ assertNull(m.getJMSReplyTo());
+ }
// Package protected ---------------------------------------------
More information about the jboss-cvs-commits
mailing list