[jboss-cvs] JBoss Messaging SVN: r1915 - in trunk: src/main/org/jboss/jms/client src/main/org/jboss/jms/client/container src/main/org/jboss/jms/client/delegate src/main/org/jboss/jms/client/remoting src/main/org/jboss/jms/client/state tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/jms/clustering tests/src/org/jboss/test/messaging/jms/clustering/base tests/src/org/jboss/test/messaging/tools
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Jan 6 07:29:50 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-01-06 07:29:40 -0500 (Sat, 06 Jan 2007)
New Revision: 1915
Modified:
trunk/src/main/org/jboss/jms/client/JBossConnection.java
trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java
trunk/src/main/org/jboss/jms/client/container/ExceptionInterceptor.java
trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/HAStressTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
Log:
various changes preparing the in-flight invocation failure detection
Modified: trunk/src/main/org/jboss/jms/client/JBossConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnection.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/JBossConnection.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -224,7 +224,7 @@
{
ConnectionState state = (ConnectionState)((ClientConnectionDelegate)delegate).getState();
- return state.getRemotingConnection().getInvokingClient().getSessionId();
+ return state.getRemotingConnection().getRemotingClient().getSessionId();
}
public ConnectionDelegate getDelegate()
Modified: trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -124,7 +124,7 @@
// add a connection listener to detect failure; the consolidated remoting connection
// listener must be already in place and configured
- state.getRemotingConnectionListener().
+ state.getRemotingConnection().getConnectionListener().
addDelegateListener(new ConnectionFailureListener(cd));
log.debug(this + " installed failure listener on " + cd);
Modified: trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -34,8 +34,6 @@
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.message.MessageIdGeneratorFactory;
import org.jboss.jms.tx.ResourceManagerFactory;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
/**
* Handles operations related to the connection
@@ -53,8 +51,6 @@
{
// Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(ConnectionAspect.class);
-
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
@@ -114,7 +110,7 @@
ConnectionState state = getConnectionState(invocation);
state.setJustCreated(false);
- return state.getRemotingConnectionListener().getJMSExceptionListener();
+ return state.getRemotingConnection().getConnectionListener().getJMSExceptionListener();
}
public Object handleSetExceptionListener(Invocation invocation) throws Throwable
@@ -124,7 +120,8 @@
MethodInvocation mi = (MethodInvocation)invocation;
ExceptionListener exceptionListener = (ExceptionListener)mi.getArguments()[0];
- state.getRemotingConnectionListener().addJMSExceptionListener(exceptionListener);
+ state.getRemotingConnection().getConnectionListener().
+ addJMSExceptionListener(exceptionListener);
return null;
}
@@ -173,15 +170,13 @@
JMSRemotingConnection remotingConnection = state.getRemotingConnection();
// remove the consolidated remoting connection listener
- ConsolidatedRemotingConnectionListener listener = state.getRemotingConnectionListener();
- listener.clear();
- Client client = remotingConnection.getInvokingClient();
- boolean removed = client.removeConnectionListener(listener);
+ ConsolidatedRemotingConnectionListener l = remotingConnection.removeConnectionListener();
+ if (l != null)
+ {
+ l.clear();
+ }
- log.debug(this + (removed ? " removed " : " failed to remove ") +
- "the consolidated remoting connection listener from " + client);
-
// Finished with the connection - we need to shutdown callback server
remotingConnection.stop();
Modified: trunk/src/main/org/jboss/jms/client/container/ExceptionInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ExceptionInterceptor.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/container/ExceptionInterceptor.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -32,6 +32,9 @@
*
* This interceptor is PER_VM
*
+ * TODO: This interceptor seem a bit useless. For logging, we can use the ClientLoggingInterceptor.
+ * Remove it?
+ *
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
@@ -40,21 +43,21 @@
*/
public class ExceptionInterceptor implements Interceptor
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ExceptionInterceptor.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
- // Interceptor implementation ------------------------------------
+ // Interceptor implementation -------------------------------------------------------------------
public String getName()
{
@@ -70,8 +73,7 @@
catch(JMSException e)
{
// JMSException should not be logged unless trace is on
- if (trace) { log.trace("Caught JMSException:", e); }
-
+ if (trace) { log.trace("Caught JMSException", e); }
throw e;
}
catch (Throwable t)
@@ -84,11 +86,11 @@
}
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private void log(Throwable e)
{
Modified: trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.ArrayList;
+import java.io.IOException;
/**
* An interceptor that acts as a failover valve: it allows all invocations to go through as long
@@ -201,7 +202,13 @@
if (trace) { log.trace(this + " allowed " + (exempt ? "exempt" : "") + " method " + methodName + "() to pass through"); }
return invocation.invokeNext();
+
}
+ catch(IOException e)
+ {
+ // transport-level failure detected while being in the middle of an invocation
+ throw e;
+ }
finally
{
if (!exempt)
@@ -217,7 +224,6 @@
activeMethods.remove(methodName);
}
}
-
}
}
Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -102,9 +102,11 @@
// install the consolidated remoting connection listener; it will be de-installed on
// connection closing by ConnectionAspect
- ConsolidatedRemotingConnectionListener listener = new ConsolidatedRemotingConnectionListener();
- remotingConnection.getInvokingClient().addConnectionListener(listener);
+ ConsolidatedRemotingConnectionListener listener =
+ new ConsolidatedRemotingConnectionListener();
+ remotingConnection.addConnectionListener(listener);
+
if (versionToUse == null)
{
throw new IllegalStateException("Connection version is null");
@@ -116,8 +118,9 @@
ConnectionState connectionState =
new ConnectionState(serverID, connectionDelegate,
- remotingConnection, listener, versionToUse, idGenerator);
+ remotingConnection, versionToUse, idGenerator);
+ listener.setConnectionState(connectionState);
connectionDelegate.setState(connectionState);
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -195,7 +195,7 @@
{
// Use the Client in the Connection's state
return ((ConnectionState)state.getParent().getParent()).getRemotingConnection().
- getInvokingClient();
+ getRemotingClient();
}
// Package Private ------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -353,7 +353,7 @@
protected Client getClient()
{
- return ((ConnectionState)state).getRemotingConnection().getInvokingClient();
+ return ((ConnectionState)state).getRemotingConnection().getRemotingClient();
}
// Package Private ------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -210,7 +210,7 @@
remotingConnection = new JMSRemotingConnection(serverLocatorURI, clientPing);
remotingConnection.start();
- client = remotingConnection.getInvokingClient();
+ client = remotingConnection.getRemotingClient();
md.addMetaData(MetaDataConstants.JMS,
MetaDataConstants.REMOTING_SESSION_ID,
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -255,7 +255,7 @@
{
// Use the Client in the Connection's state
return ((ConnectionState)state.getParent().getParent()).getRemotingConnection().
- getInvokingClient();
+ getRemotingClient();
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -514,7 +514,7 @@
protected Client getClient()
{
//Use the Client in the Connection's state
- return ((ConnectionState)state.getParent()).getRemotingConnection().getInvokingClient();
+ return ((ConnectionState)state.getParent()).getRemotingConnection().getRemotingClient();
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -90,7 +90,7 @@
this(Integer.MIN_VALUE);
}
- // Interceptor implementation ------------------------------------
+ // Interceptor implementation -------------------------------------------------------------------
public String getName()
{
@@ -99,8 +99,8 @@
}
/**
- * DelegateSupport also acts as an interceptor - the last interceptor in the chain which
- * invokes on the server.
+ * DelegateSupport also acts as an interceptor - the last interceptor in the chain which invokes
+ * on the server.
*/
public Object invoke(Invocation invocation) throws Throwable
{
@@ -111,11 +111,12 @@
new Integer(id),
PayloadKey.AS_IS);
+ Client client = getClient();
byte version = getState().getVersionToUse().getProviderIncrementingVersion();
-
MessagingMarshallable request = new MessagingMarshallable(version, invocation);
- MessagingMarshallable response = (MessagingMarshallable)getClient().invoke(request, null);
+ MessagingMarshallable response = (MessagingMarshallable)client.invoke(request, null);
+
if (trace) { log.trace(this + " got server response for " + ((MethodInvocation)invocation).getMethod().getName()); }
return response.getLoad();
Modified: trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/remoting/ConsolidatedRemotingConnectionListener.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -31,13 +31,13 @@
*/
public class ConsolidatedRemotingConnectionListener implements ConnectionListener
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ConsolidatedRemotingConnectionListener.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private ConnectionState state;
@@ -46,14 +46,14 @@
// List<ConnectionListener>
private List delegateListeners;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public ConsolidatedRemotingConnectionListener()
{
delegateListeners = new ArrayList();
}
- // ConnectionListener implementation -----------------------------
+ // ConnectionListener implementation ------------------------------------------------------------
public void handleConnectionException(Throwable throwable, Client client)
{
@@ -116,7 +116,7 @@
}
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public synchronized boolean addDelegateListener(ConnectionListener l)
{
@@ -159,12 +159,12 @@
return state + ".ConsolidatedListener";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -37,7 +37,8 @@
/**
* Encapsulates the state and behaviour from jboss remoting needed for a JMS connection.
*
- * Each JMS connection maintains a single Client instance for invoking on the server
+ * 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 jboss.org">Ovidiu Feodorov</a>
* @version 1.1
@@ -46,26 +47,30 @@
*/
public class JMSRemotingConnection
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
public static final String CALLBACK_POLL_PERIOD_DEFAULT = "100";
private static final Logger log = Logger.getLogger(JMSRemotingConnection.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
- protected Client client;
- protected boolean clientPing;
- protected InvokerLocator serverLocator;
- protected CallbackManager callbackManager;
+ private Client client;
+ private boolean clientPing;
+ private InvokerLocator serverLocator;
+ private CallbackManager callbackManager;
- /** When a failover is performed, this flag is set to true */
- protected boolean failed=false;
+ // When a failover is performed, this flag is set to true
+ protected boolean failed = false;
- // Constructors --------------------------------------------------
+ // 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, boolean clientPing) throws Throwable
{
serverLocator = new InvokerLocator(serverLocatorURI);
@@ -74,7 +79,7 @@
log.debug(this + " created");
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public void start() throws Throwable
{
@@ -104,14 +109,18 @@
// For socket transport allow true push callbacks, with callback Connector.
// For http transport, simulate push callbacks.
boolean doPushCallbacks = "socket".equals(serverLocator.getProtocol());
+
if (doPushCallbacks)
{
if (log.isTraceEnabled()) log.trace("doing push callbacks");
HashMap metadata = new HashMap();
metadata.put(InvokerLocator.DATATYPE, "jms");
- metadata.put(InvokerLocator.SERIALIZATIONTYPE, "jms"); //Not actually used at present - but it does no harm
- metadata.put(MicroSocketClientInvoker.CLIENT_SOCKET_CLASS_FLAG, "org.jboss.jms.client.remoting.ClientSocketWrapper");
- metadata.put(SocketServerInvoker.SERVER_SOCKET_CLASS_FLAG, "org.jboss.jms.server.remoting.ServerSocketWrapper");
+ // Not actually used at present - but it does no harm
+ metadata.put(InvokerLocator.SERIALIZATIONTYPE, "jms");
+ metadata.put(MicroSocketClientInvoker.CLIENT_SOCKET_CLASS_FLAG,
+ "org.jboss.jms.client.remoting.ClientSocketWrapper");
+ metadata.put(SocketServerInvoker.SERVER_SOCKET_CLASS_FLAG,
+ "org.jboss.jms.server.remoting.ServerSocketWrapper");
String bindAddress = System.getProperty("jboss.messaging.callback.bind.address");
if (bindAddress != null)
@@ -176,7 +185,7 @@
log.debug(this + " closed");
}
- public Client getInvokingClient()
+ public Client getRemotingClient()
{
return client;
}
@@ -186,7 +195,6 @@
return callbackManager;
}
-
public boolean isFailed()
{
return failed;
@@ -197,17 +205,60 @@
this.failed = failed;
}
+ /**
+ * @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;
+ }
+
+ if (!client.removeConnectionListener(remotingConnectionListener))
+ {
+ throw new IllegalStateException("Failed to remove remoting connection listener");
+ }
+
+ log.debug(this + " removed consolidated connection listener from " + client);
+ ConsolidatedRemotingConnectionListener toReturn = remotingConnectionListener;
+ remotingConnectionListener = null;
+ return toReturn;
+ }
+
public String toString()
{
return "JMSRemotingConnection[" + serverLocator.getLocatorURI() + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -30,7 +30,6 @@
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
-import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.FailoverListener;
import org.jboss.jms.delegate.ConnectionDelegate;
@@ -81,7 +80,6 @@
private String clientID;
private JMSRemotingConnection remotingConnection;
- private ConsolidatedRemotingConnectionListener remotingConnectionListener;
private ResourceManager resourceManager;
private MessageIdGenerator idGenerator;
@@ -102,7 +100,6 @@
public ConnectionState(int serverID, ConnectionDelegate delegate,
JMSRemotingConnection remotingConnection,
- ConsolidatedRemotingConnectionListener remotingConnectionListener,
Version versionToUse,
MessageIdGenerator gen)
throws Exception
@@ -116,9 +113,6 @@
this.remotingConnection = remotingConnection;
this.versionToUse = versionToUse;
- this.remotingConnectionListener = remotingConnectionListener;
- remotingConnectionListener.setConnectionState(this);
-
// Each connection has its own resource manager. If we can failover all connections with the
// same server id at the same time then we can maintain one rm per unique server as opposed
// to per connection.
@@ -201,11 +195,6 @@
return remotingConnection;
}
- public ConsolidatedRemotingConnectionListener getRemotingConnectionListener()
- {
- return remotingConnectionListener;
- }
-
public int getServerID()
{
return serverID;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/jms/RemotingConnectionConfigurationTest.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -103,7 +103,7 @@
ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
- Client client = remotingConnection.getInvokingClient();
+ Client client = remotingConnection.getRemotingClient();
Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
field.setAccessible(true);
@@ -163,7 +163,7 @@
ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
- Client client = remotingConnection.getInvokingClient();
+ Client client = remotingConnection.getRemotingClient();
Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
field.setAccessible(true);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -16,8 +16,10 @@
import org.jboss.jms.client.JBossQueueBrowser;
import org.jboss.jms.client.JBossMessageConsumer;
import org.jboss.jms.client.JBossMessageProducer;
+import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.state.ConnectionState;
import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import javax.jms.Connection;
import javax.jms.Session;
@@ -1570,6 +1572,42 @@
}
}
+ public void testTemp() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+ conn.close();
+
+ conn = cf.createConnection();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ // we "cripple" the remoting connection by removing ConnectionListener. This way, failures
+ // cannot be "cleanly" detected by the client-side pinger, and we'll fail on an invocation
+ JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn).
+ getDelegate()).getRemotingConnection();
+ rc.removeConnectionListener();
+
+ ServerManagement.killAndWait(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
public void testSimpleFailover() throws Exception
{
Connection conn = null;
@@ -1582,8 +1620,6 @@
conn = cf.createConnection();
conn.start();
- // create a producer/consumer on node 1
-
// make sure we're connecting to node 1
int nodeID = ((ConnectionState)((DelegateSupport)((JBossConnection)conn).
@@ -1602,7 +1638,6 @@
// kill node 1
-
ServerManagement.killAndWait(1);
log.info("########");
log.info("######## KILLED NODE 1");
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/HAStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/HAStressTest.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/HAStressTest.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -24,7 +24,6 @@
import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.client.JBossConnectionFactory;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.logging.Logger;
@@ -201,7 +200,7 @@
JBossConnection connTest = (JBossConnection) getConnection(new Connection[]{conn1, conn2, conn3}, i);
String locator = ((ClientConnectionDelegate) connTest.getDelegate()).getRemotingConnection().
- getInvokingClient().getInvoker().getLocator().getLocatorURI();
+ getRemotingClient().getInvoker().getLocator().getLocatorURI();
log.info("Server " + i + " has locator=" + locator);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/HATest.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -129,21 +129,21 @@
ConnectionState state3 = getConnectionState(conn3);
assertNotSame(state2.getRemotingConnection(), state3.getRemotingConnection());
- assertNotSame(state2.getRemotingConnection().getInvokingClient(), state3.getRemotingConnection().getInvokingClient());
+ assertNotSame(state2.getRemotingConnection().getRemotingClient(), state3.getRemotingConnection().getRemotingClient());
conn1.close();
assertNotNull(state2.getRemotingConnection());
- assertNotNull(state2.getRemotingConnection().getInvokingClient().getInvoker());
- assertTrue(state2.getRemotingConnection().getInvokingClient().getInvoker().isConnected());
+ assertNotNull(state2.getRemotingConnection().getRemotingClient().getInvoker());
+ assertTrue(state2.getRemotingConnection().getRemotingClient().getInvoker().isConnected());
conn2.close();
log.info("Closing connection 3 now");
assertNotNull(state3.getRemotingConnection());
- assertNotNull(state3.getRemotingConnection().getInvokingClient().getInvoker());
- assertTrue(state3.getRemotingConnection().getInvokingClient().getInvoker().isConnected());
+ assertNotNull(state3.getRemotingConnection().getRemotingClient().getInvoker());
+ assertTrue(state3.getRemotingConnection().getRemotingClient().getInvoker().isConnected());
// When I created the testcase this was failing, throwing exceptions. This was basically why I created this testcase
conn3.close();
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -133,7 +133,7 @@
protected String getLocatorURL(Connection conn)
{
return getConnectionState(conn).getRemotingConnection().
- getInvokingClient().getInvoker().getLocator().getLocatorURI();
+ getRemotingClient().getInvoker().getLocator().getLocatorURI();
}
protected int getServerId(Connection conn)
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-01-06 10:11:58 UTC (rev 1914)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-01-06 12:29:40 UTC (rev 1915)
@@ -275,7 +275,7 @@
while(true)
{
server.ping();
- log.debug("Server " + i + " still alive... pinging again");
+ log.debug("server " + i + " still alive ...");
Thread.sleep(10);
}
}
@@ -283,6 +283,8 @@
{
// e.printStackTrace();
}
+
+ log.debug("server " + i + " killed and dead");
}
/**
More information about the jboss-cvs-commits
mailing list