[jboss-cvs] JBoss Messaging SVN: r2821 - in trunk: src/main/org/jboss/jms/server and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 2 01:14:08 EDT 2007
Author: clebert.suconic at jboss.com
Date: 2007-07-02 01:14:07 -0400 (Mon, 02 Jul 2007)
New Revision: 2821
Added:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
Modified:
trunk/src/etc/xmdesc/ServerPeer-xmbean.xml
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
trunk/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-761
Modified: trunk/src/etc/xmdesc/ServerPeer-xmbean.xml
===================================================================
--- trunk/src/etc/xmdesc/ServerPeer-xmbean.xml 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/etc/xmdesc/ServerPeer-xmbean.xml 2007-07-02 05:14:07 UTC (rev 2821)
@@ -200,6 +200,13 @@
<type>int</type>
</attribute>
+ <attribute access="read-write" getMethod="isSupportsFailover" setMethod="setSupportsFailover">
+ <description>Should Server Side Failover be executed</description>
+ <name>SupportsFailover</name>
+ <type>boolean</type>
+ </attribute>
+
+
<!-- Managed operations -->
<operation>
@@ -408,7 +415,15 @@
</description>
<name>showPreparedTransactionsAsHTML</name>
<return-type>java.lang.String</return-type>
- </operation>
-
+ </operation>
+ <operation>
+ <description>
+ Show of all information about active clients
+ </description>
+ <name>showActiveClientsAsHTML</name>
+ <return-type>java.lang.String</return-type>
+ </operation>
+
+
</mbean>
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -23,6 +23,8 @@
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.io.CharArrayWriter;
+import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -44,6 +46,7 @@
import org.jboss.jms.server.connectormanager.SimpleConnectorManager;
import org.jboss.jms.server.destination.ManagedQueue;
import org.jboss.jms.server.endpoint.ServerSessionEndpoint;
+import org.jboss.jms.server.endpoint.ServerConnectionEndpoint;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.server.messagecounter.MessageCounterManager;
import org.jboss.jms.server.plugin.contract.JMSUserManager;
@@ -114,6 +117,8 @@
private int objectIDSequence = 1;
+ private boolean supportsFailover = true;
+
// The default maximum number of delivery attempts before sending to DLQ - can be overridden on
// the destination
private int defaultMaxDeliveryAttempts = 10;
@@ -994,7 +999,33 @@
buffer.append("</table>");
return buffer.toString();
}
-
+
+ public String showActiveClientsAsHTML() throws Exception
+ {
+ CharArrayWriter charArray = new CharArrayWriter();
+ PrintWriter out = new PrintWriter(charArray);
+
+ List endpoints = connectionManager.getActiveConnections();
+
+ out.println("<table><tr><td>ID</td><td>Host</td><td>User</td><td>#Sessions</td></tr>");
+ for (Iterator iter = endpoints.iterator(); iter.hasNext();)
+ {
+ ServerConnectionEndpoint endpoint = (ServerConnectionEndpoint) iter.next();
+
+ out.println("<tr>");
+ out.println("<td>" + endpoint.toString() + "</td>");
+ out.println("<td>" + endpoint.getCallbackHandler().getCallbackClient().getInvoker().getLocator().getHost() + "</td>");
+ out.println("<td>" + endpoint.getUsername() + "</td>");
+ out.println("<td>" + endpoint.getSessions().size() + "</td>");
+ out.println("</tr>");
+ }
+
+ out.println("</table>");
+
+
+ return charArray.toString();
+ }
+
// Public ---------------------------------------------------------------------------------------
public byte[] getClientAOPStack()
@@ -1219,7 +1250,23 @@
{
return objectIDSequence++;
}
-
+
+
+ public boolean isSupportsFailover()
+ {
+ return supportsFailover;
+ }
+
+ public void setSupportsFailover(boolean supportsFailover) throws Exception
+ {
+ if (started)
+ {
+ throw new IllegalAccessException("supportsFailover can only be changed when " +
+ "connection factory is stopped");
+ }
+ this.supportsFailover = supportsFailover;
+ }
+
public String toString()
{
return "ServerPeer[" + getServerPeerID() + "]";
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -110,7 +110,12 @@
String locatorURI = (String)server.getAttribute(connectorObjectName, "InvokerLocator");
ServerPeer serverPeer = (ServerPeer)server.getAttribute(serverPeerObjectName, "Instance");
-
+
+ if (!serverPeer.isSupportsFailover())
+ {
+ this.supportsFailover = false;
+ }
+
connectionFactoryManager = serverPeer.getConnectionFactoryManager();
connectorManager = serverPeer.getConnectorManager();
connectionManager = serverPeer.getConnectionManager();
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -28,6 +28,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.ArrayList;
import javax.jms.Destination;
import javax.jms.IllegalStateException;
@@ -551,6 +552,16 @@
return cfendpoint;
}
+ public Collection getSessions()
+ {
+ ArrayList list = new ArrayList();
+ synchronized (sessions)
+ {
+ list.addAll(sessions.values());
+ }
+ return list;
+ }
+
public String toString()
{
return "ConnectionEndpoint[" + id + "]";
Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -200,8 +200,10 @@
private Object waitForBindUnbindLock;
- private Map loadedBindings;
+ private Map loadedBindings;
+ private boolean supportsFailover = true;
+
// Constructors ---------------------------------------------------------------------------------
/*
@@ -253,7 +255,7 @@
channelIDMap = new HashMap();
nodeIDAddressMap = new ConcurrentHashMap();
-
+
waitForBindUnbindLock = new Object();
}
@@ -276,7 +278,8 @@
String groupName,
JChannelFactory jChannelFactory,
long stateTimeout, long castTimeout,
- FailoverMapper failoverMapper)
+ FailoverMapper failoverMapper,
+ boolean supportsFailover)
throws Exception
{
this(ds, tm, sqlProperties, createTablesOnStartup, nodeId, officeName, ms, pm, tr,
@@ -293,8 +296,10 @@
leftSet = new ConcurrentHashSet();
groupMember = new GroupMember(groupName, stateTimeout, castTimeout, jChannelFactory, this, this);
+
+ this.supportsFailover = supportsFailover;
- nbSupport = new NotificationBroadcasterSupport();
+ nbSupport = new NotificationBroadcasterSupport();
}
// MessagingComponent overrides -----------------------------------------------------------------
@@ -715,7 +720,7 @@
log.debug(this + ": node " + leftNodeID + " has " + (crashed ? "crashed" : "cleanly left the group"));
- if (crashed)
+ if (crashed && isSupportsFailover())
{
// Need to evaluate this before we regenerate the failover map
Integer failoverNode;
@@ -1055,6 +1060,11 @@
// Public ---------------------------------------------------------------------------------------
+ public boolean isSupportsFailover()
+ {
+ return supportsFailover;
+ }
+
public String printBindingInformation()
{
// StringWriter buffer = new StringWriter();
Modified: trunk/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -402,7 +402,8 @@
groupName,
jChannelFactory,
stateTimeout, castTimeout,
- mapper);
+ mapper,
+ serverPeer.isSupportsFailover());
}
else
{
Modified: trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -100,7 +100,7 @@
sc.getPostOfficeSQLProperties(), true, nodeID,
"Clustered", ms, pm, tr, ff, cf, idm, cn,
groupName, jChannelFactory,
- stateTimeout, castTimeout, mapper);
+ stateTimeout, castTimeout, mapper, true);
postOffice.start();
Added: trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java (rev 0)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -0,0 +1,79 @@
+/*
+ * 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.clustering;
+
+import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
+
+/**
+ * Test situations where supports failover is marked false
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision$</tt>
+ * $Id$
+ */
+public class NoFailoverTest extends ClusteringTestBase
+{
+
+ // Constants ------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public NoFailoverTest(String name)
+ {
+ super(name);
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public void testConnectionFactory()
+ {
+ JBossConnectionFactory cfLocal = (JBossConnectionFactory)cf;
+ assertFalse(((ClientClusteredConnectionFactoryDelegate)cfLocal.getDelegate()).isSupportsFailover());
+
+ }
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ config = "all-failover";
+ this.nodeCount=3;
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Property changes on: trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id LastChangedDate Author Revision
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -726,7 +726,7 @@
{
insureStarted();
servers[0].getServer().startServerPeer(serverPeerID, defaultQueueJNDIContext,
- defaultTopicJNDIContext, attrOverrids, false);
+ defaultTopicJNDIContext, attrOverrids, false, false);
}
public static void stopServerPeer() throws Exception
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -223,6 +223,7 @@
private boolean jca;
private boolean remoting;
private boolean security;
+ private boolean supportsFailover = true;
private boolean httpConnectionFactory;
private boolean multiplexer; // the JGroups channels multiplexer
@@ -859,7 +860,12 @@
{
return config.isClustered();
}
-
+
+ public boolean isSupportsFailover()
+ {
+ return supportsFailover;
+ }
+
public void installJMSProviderAdaptor(String jndi, JMSProviderAdapter adaptor) throws Exception
{
log.info("Binding adaptor " + adaptor + " in JNDI: " + jndi);
@@ -1625,6 +1631,8 @@
String tok = st.nextToken();
boolean minus = false;
+ supportsFailover = true;
+
if (tok.startsWith("-"))
{
tok = tok.substring(1);
@@ -1640,6 +1648,16 @@
security = true;
}
else
+ if ("all-failover".equals(tok))
+ {
+ transaction = true;
+ database = true;
+ jca = true;
+ remoting = true;
+ security = true;
+ supportsFailover = false;
+ }
+ else
if ("all+http".equals(tok))
{
transaction = true;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -151,7 +151,7 @@
if (startMessagingServer)
{
- startServerPeer(serverIndex, null, null, attrOverrides, sc.isClustered());
+ startServerPeer(serverIndex, null, null, attrOverrides, sc.isClustered(), sc.isSupportsFailover());
}
log.info("Server " + serverIndex + " started");
@@ -293,7 +293,8 @@
String defaultQueueJNDIContext,
String defaultTopicJNDIContext,
ServiceAttributeOverrides attrOverrides,
- boolean clustered) throws Exception
+ boolean clustered,
+ boolean supportsFailover) throws Exception
{
try
{
@@ -342,6 +343,8 @@
sc.setAttribute(serverPeerObjectName, "SecurityDomain",
MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
+ sc.setAttribute(serverPeerObjectName,"SupportsFailover", supportsFailover?"true":"false");
+
log.debug("starting JMS server");
sc.invoke(serverPeerObjectName, "create", new Object[0], new String[0]);
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -271,20 +271,21 @@
}
public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
- String defaultTopicJNDIContext, boolean clustered) throws Exception
+ String defaultTopicJNDIContext, boolean clustered, boolean supportsFailover) throws Exception
{
startServerPeer(serverPeerID, defaultQueueJNDIContext,
- defaultTopicJNDIContext, null, clustered);
+ defaultTopicJNDIContext, null, clustered, supportsFailover);
}
public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,
String defaultTopicJNDIContext,
- ServiceAttributeOverrides attrOverrides, boolean clustered)
+ ServiceAttributeOverrides attrOverrides, boolean clustered,
+ boolean supportsFailover)
throws Exception
{
server.startServerPeer(serverPeerID, defaultQueueJNDIContext,
- defaultTopicJNDIContext, attrOverrides, clustered);
+ defaultTopicJNDIContext, attrOverrides, clustered, supportsFailover);
}
public void stopServerPeer() throws Exception
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2007-06-30 15:31:32 UTC (rev 2820)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2007-07-02 05:14:07 UTC (rev 2821)
@@ -123,7 +123,8 @@
String defaultQueueJNDIContext,
String defaultTopicJNDIContext,
ServiceAttributeOverrides attrOverrides,
- boolean clustered) throws Exception;
+ boolean clustered,
+ boolean supportsFailover) throws Exception;
void stopServerPeer() throws Exception;
More information about the jboss-cvs-commits
mailing list