[jboss-cvs] JBoss Messaging SVN: r3661 - in branches/Branch_Stable_temp: src/main/org/jboss/jms/client/state and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Feb 4 05:05:23 EST 2008
Author: timfox
Date: 2008-02-04 05:05:22 -0500 (Mon, 04 Feb 2008)
New Revision: 3661
Added:
branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/RotatingID.java
Removed:
branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGenerator.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java
Modified:
branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ConnectionAspect.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ProducerAspect.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/StateCreationAspect.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/client/state/ConnectionState.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/message/JBossMessage.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/server/ServerPeer.java
branches/Branch_Stable_temp/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/MessagingTestCase.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/MessagingQueueTestBase.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java
Log:
Temp
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ConnectionAspect.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ConnectionAspect.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -32,7 +32,6 @@
import org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener;
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.message.MessageIdGeneratorFactory;
import org.jboss.jms.tx.ResourceManagerFactory;
/**
@@ -190,9 +189,6 @@
// Finished with the connection - we need to shutdown callback server
remotingConnection.stop();
- // Remove reference to message ID generator
- MessageIdGeneratorFactory.instance.checkInGenerator(state.getServerID());
-
// And to resource manager
ResourceManagerFactory.instance.checkInResourceManager(state.getServerID());
}
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ProducerAspect.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ProducerAspect.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/ProducerAspect.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -21,6 +21,8 @@
*/
package org.jboss.jms.client.container;
+import java.util.UUID;
+
import javax.jms.BytesMessage;
import javax.jms.Destination;
import javax.jms.InvalidDestinationException;
@@ -184,8 +186,6 @@
// Generate the message id
ConnectionState connectionState = (ConnectionState)sessionState.getParent();
- long id = -1;
-
JBossMessage messageToSend;
boolean foreign = false;
@@ -240,15 +240,6 @@
m.setJMSDestination(destination);
- if (keepID)
- {
- id = proxy.getMessage().getMessageID();
- }
-
- //The following line executed on the proxy should cause a copy to occur
- //if it is necessary
- proxy.setJMSMessageID(null);
-
//Get the underlying message
messageToSend = proxy.getMessage();
@@ -259,11 +250,11 @@
if (!keepID)
{
- id = connectionState.getIdGenerator().getId((ConnectionDelegate)connectionState.getDelegate());
+ String id = "ID:JBM-" + UUID.randomUUID().toString();
+
+ messageToSend.setJMSMessageID(id);
}
- messageToSend.setMessageId(id);
-
// This only really used for BytesMessages and StreamMessages to reset their state
messageToSend.doBeforeSend();
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -42,8 +42,6 @@
import org.jboss.jms.delegate.CreateConnectionResult;
import org.jboss.jms.delegate.ProducerDelegate;
import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.message.MessageIdGenerator;
-import org.jboss.jms.message.MessageIdGeneratorFactory;
import org.jboss.logging.Logger;
import org.jboss.messaging.util.Version;
@@ -107,13 +105,9 @@
throw new IllegalStateException("Connection version is null");
}
- // We have one message id generator per unique server
- MessageIdGenerator idGenerator =
- MessageIdGeneratorFactory.instance.checkOutGenerator(serverID);
-
ConnectionState connectionState =
new ConnectionState(serverID, connectionDelegate,
- remotingConnection, versionToUse, idGenerator);
+ remotingConnection, versionToUse);
listener.setConnectionState(connectionState);
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/client/state/ConnectionState.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/client/state/ConnectionState.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -31,7 +31,6 @@
import org.jboss.jms.client.remoting.JMSRemotingConnection;
import org.jboss.jms.delegate.ConnectionDelegate;
import org.jboss.jms.delegate.ConnectionFactoryDelegate;
-import org.jboss.jms.message.MessageIdGenerator;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
@@ -75,7 +74,6 @@
private JMSRemotingConnection remotingConnection;
private ResourceManager resourceManager;
- private MessageIdGenerator idGenerator;
// Cached by the connection state in case ClusteringAspect needs to re-try establishing
// connection on a different node
@@ -94,8 +92,7 @@
public ConnectionState(int serverID, ConnectionDelegate delegate,
JMSRemotingConnection remotingConnection,
- Version versionToUse,
- MessageIdGenerator gen)
+ Version versionToUse)
throws Exception
{
super(null, (DelegateSupport)delegate);
@@ -112,7 +109,6 @@
// to per connection.
this.resourceManager = ResourceManagerFactory.instance.checkOutResourceManager(serverID);
- this.idGenerator = gen;
this.serverID = serverID;
}
@@ -149,7 +145,6 @@
ConnectionState newState = (ConnectionState)ns;
remotingConnection = newState.remotingConnection;
- idGenerator = newState.idGenerator;
serverID = newState.serverID;
versionToUse = newState.versionToUse;
@@ -186,11 +181,6 @@
return resourceManager;
}
- public MessageIdGenerator getIdGenerator()
- {
- return idGenerator;
- }
-
public JMSRemotingConnection getRemotingConnection()
{
return remotingConnection;
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/message/JBossMessage.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/message/JBossMessage.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -278,8 +278,6 @@
protected transient String connectionID;
- protected transient String jmsMessageID;
-
//Optimisation - we could just store this as a header like everything else - but we store
//As an attribute so we can prevent an extra lookup on the server
private long scheduledDeliveryTime;
@@ -381,19 +379,7 @@
public String getJMSMessageID()
{
- if (jmsMessageID == null)
- {
- String headerID = (String)headers.get(JBM_MESSAGE_ID);
- if (headerID == null)
- {
- jmsMessageID = "ID:JBM-" + messageID;
- }
- else
- {
- jmsMessageID = headerID;
- }
- }
- return jmsMessageID;
+ return (String)headers.get(JBM_MESSAGE_ID);
}
public void setJMSMessageID(String jmsMessageID) throws JMSException
@@ -402,15 +388,7 @@
{
throw new JMSException("JMSMessageID must start with ID:");
}
- if (jmsMessageID == null)
- {
- headers.remove(JBM_MESSAGE_ID);
- }
- else
- {
- headers.put(JBM_MESSAGE_ID, jmsMessageID);
- }
- this.jmsMessageID = jmsMessageID;
+ headers.put(JBM_MESSAGE_ID, jmsMessageID);
}
public long getJMSTimestamp() throws JMSException
Deleted: branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGenerator.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGenerator.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGenerator.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -1,99 +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.message;
-
-import javax.jms.JMSException;
-
-import org.jboss.jms.delegate.ConnectionEndpoint;
-import org.jboss.jms.delegate.IDBlock;
-import org.jboss.logging.Logger;
-
-/**
- *
- * A MessageIdGenerator.
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class MessageIdGenerator
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(MessageIdGenerator.class);
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean trace = log.isTraceEnabled();
-
- protected long high = -1;
- protected long nextID;
- protected int blockSize;
-
- // Constructors --------------------------------------------------
-
- public MessageIdGenerator(int blockSize) throws JMSException
- {
- this.blockSize = blockSize;
- }
-
- // Public --------------------------------------------------------
-
- protected void getNextBlock(ConnectionEndpoint connection) throws JMSException
- {
- IDBlock block = connection.getIdBlock(blockSize);
-
- nextID = block.getLow();
- high = block.getHigh();
-
- if (trace) { log.trace("Got block of IDs from server, low=" + nextID + " high=" + high); }
- }
-
- public synchronized long getId(ConnectionEndpoint connection) throws JMSException
- {
- if (nextID == high + 1)
- {
- getNextBlock(connection);
- }
-
- long id = nextID;
-
- if (log.isTraceEnabled()) { log.trace("Getting next message id=" + id); }
-
- nextID++;
-
- return id;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/message/MessageIdGeneratorFactory.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -1,145 +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.message;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jms.JMSException;
-
-import org.jboss.logging.Logger;
-
-/**
- * This class manages instances of MessageIdGenerator. It ensures there is one instance per instance
- * of JMS server as specified by the server id.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class MessageIdGeneratorFactory
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(MessageIdGeneratorFactory.class);
-
- public static MessageIdGeneratorFactory instance = new MessageIdGeneratorFactory();
-
- //TODO Make configurable
- private static final int BLOCK_SIZE = 512;
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Map holders;
-
- // Constructors --------------------------------------------------
-
- private MessageIdGeneratorFactory()
- {
- holders = new HashMap();
- }
-
- // Public --------------------------------------------------------
-
- public synchronized boolean containsMessageIdGenerator(int serverId)
- {
- return holders.containsKey(new Integer(serverId));
- }
-
- public synchronized MessageIdGenerator checkOutGenerator(int serverId)
- throws JMSException
- {
- Integer in = new Integer(serverId);
-
- Holder h = (Holder)holders.get(in);
-
- if (h == null)
- {
- h = new Holder(new MessageIdGenerator(BLOCK_SIZE));
- holders.put(in, h);
- }
- else
- {
- h.refCount++;
- }
-
- log.trace("checked out MessageIdGenerator for " + serverId +
- ", reference count is " + h.refCount);
-
- return h.generator;
- }
-
- public synchronized void checkInGenerator(int serverId)
- {
- Integer in = new Integer(serverId);
-
- Holder h = (Holder)holders.get(in);
-
- if (h == null)
- {
- throw new IllegalArgumentException("Cannot find generator for serverid:" + serverId);
- }
-
- h.refCount--;
-
- if (h.refCount == 0)
- {
- holders.remove(in);
- log.trace("checked in and removed MessageIdGenerator for " + serverId);
- }
- else
- {
- log.trace("checked in MessageIdGenerator for " + serverId +
- ", reference count is " + h.refCount);
- }
- }
-
- public synchronized void clear()
- {
- holders.clear();
- log.trace("cleared MessageIdGeneratorFactory");
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
- private class Holder
- {
- private Holder(MessageIdGenerator gen)
- {
- this.generator = gen;
- }
-
- MessageIdGenerator generator;
-
- int refCount = 1;
- }
-
-}
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/server/ServerPeer.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/server/ServerPeer.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -21,7 +21,28 @@
*/
package org.jboss.jms.server;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.transaction.xa.Xid;
+
import org.jboss.aop.AspectXmlLoader;
import org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper;
import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
@@ -36,12 +57,19 @@
import org.jboss.jms.server.security.SecurityMetadataStore;
import org.jboss.jms.wireformat.JMSWireFormat;
import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.*;
+import org.jboss.messaging.core.contract.Binding;
+import org.jboss.messaging.core.contract.ClusterNotifier;
+import org.jboss.messaging.core.contract.MemoryManager;
+import org.jboss.messaging.core.contract.MessageStore;
+import org.jboss.messaging.core.contract.PersistenceManager;
+import org.jboss.messaging.core.contract.PostOffice;
import org.jboss.messaging.core.contract.Queue;
+import org.jboss.messaging.core.contract.Replicator;
import org.jboss.messaging.core.impl.DefaultClusterNotifier;
import org.jboss.messaging.core.impl.FailoverWaiter;
import org.jboss.messaging.core.impl.IDManager;
import org.jboss.messaging.core.impl.JDBCPersistenceManager;
+import org.jboss.messaging.core.impl.RotatingID;
import org.jboss.messaging.core.impl.clusterconnection.ClusterConnectionManager;
import org.jboss.messaging.core.impl.memory.SimpleMemoryManager;
import org.jboss.messaging.core.impl.message.SimpleMessageStore;
@@ -57,18 +85,7 @@
import org.jboss.util.JBossStringBuilder;
import org.w3c.dom.Element;
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.transaction.xa.Xid;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayWriter;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.*;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
/**
* A JMS server peer.
@@ -156,13 +173,13 @@
private ConnectorManager connectorManager;
private IDManager messageIDManager;
private IDManager channelIDManager;
- private IDManager transactionIDManager;
private MemoryManager memoryManager;
private MessageStore messageStore;
private MessageCounterManager messageCounterManager;
private ClusterConnectionManager clusterConnectionManager;
private ClusterNotifier clusterNotifier;
private FailoverWaiter failoverWaiter;
+ private RotatingID messageIDMgr = new RotatingID();
// plugins
@@ -235,7 +252,6 @@
// Create the wired components
messageIDManager = new IDManager("MESSAGE_ID", 4096, persistenceManager);
channelIDManager = new IDManager("CHANNEL_ID", 10, persistenceManager);
- transactionIDManager = new IDManager("TRANSACTION_ID", 1024, persistenceManager);
destinationJNDIMapper = new DestinationJNDIMapper(this);
connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
connectionManager = new SimpleConnectionManager();
@@ -243,7 +259,7 @@
memoryManager = new SimpleMemoryManager();
messageStore = new SimpleMessageStore();
txRepository =
- new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
+ new TransactionRepository(persistenceManager, messageStore);
messageCounterManager = new MessageCounterManager(messageCounterSamplePeriod);
clusterNotifier = new DefaultClusterNotifier();
@@ -276,7 +292,6 @@
messageIDManager.start();
channelIDManager.start();
- transactionIDManager.start();
destinationJNDIMapper.start();
connFactoryJNDIMapper.start();
connectionManager.start();
@@ -337,9 +352,7 @@
messageIDManager.stop();
messageIDManager = null;
channelIDManager.stop();
- channelIDManager = null;
- transactionIDManager.stop();
- transactionIDManager = null;
+ channelIDManager = null;;
destinationJNDIMapper.stop();
destinationJNDIMapper = null;
connFactoryJNDIMapper.stop();
@@ -717,6 +730,11 @@
messageCounterManager.resetAllCounterHistories();
}
+ public RotatingID getMessageIDMgr()
+ {
+ return messageIDMgr;
+ }
+
// JMX Operations -------------------------------------------------------------------------------
public String deployQueue(String name, String jndiName) throws Exception
Modified: branches/Branch_Stable_temp/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -546,6 +546,7 @@
}
}
+ /* We keep this in for now, so as not to break compatibilty with earlier clients */
public IDBlock getIdBlock(int size) throws JMSException
{
try
@@ -690,13 +691,13 @@
{
if (msg.isReliable())
{
- if (serverPeer.getPersistenceManagerInstance().referenceExists(msg.getMessageID()))
- {
- // Message is already stored... so just ignoring the call
- if (trace) { log.trace("Duplicate of " + msg + " exists in database - probably sent before failover"); }
-
- return;
- }
+// if (serverPeer.getPersistenceManagerInstance().referenceExists(msg.getMessageID()))
+// {
+// // Message is already stored... so just ignoring the call
+// if (trace) { log.trace("Duplicate of " + msg + " exists in database - probably sent before failover"); }
+//
+// return;
+// }
}
else
{
@@ -707,6 +708,10 @@
}
}
+ long msgID = serverPeer.getMessageIDMgr().getID();
+
+ msg.setMessageId(msgID);
+
JBossDestination dest = (JBossDestination)msg.getJMSDestination();
// This allows the no-local consumers to filter out the messages that come from the same
Modified: branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -93,8 +93,8 @@
private int maxParams;
- private short orderCount;
-
+ private RotatingID orderingID = new RotatingID();
+
private int nodeID;
private boolean nodeIDSet;
@@ -2030,7 +2030,7 @@
ps.setLong(2, ref.getMessage().getMessageID());
ps.setNull(3, Types.BIGINT);
ps.setString(4, "C");
- ps.setLong(5, getOrdering());
+ ps.setLong(5, orderingID.getID());
if (paged)
{
ps.setLong(6, ref.getPagingOrder());
@@ -2072,7 +2072,7 @@
ps.setLong(2, ref.getMessage().getMessageID());
ps.setLong(3, tx.getId());
ps.setString(4, "+");
- ps.setLong(5, getOrdering());
+ ps.setLong(5, orderingID.getID());
ps.setNull(6, Types.BIGINT);
ps.setInt(7, ref.getDeliveryCount());
ps.setLong(8, ref.getScheduledDeliveryTime());
@@ -2688,50 +2688,33 @@
}
}
- private synchronized long getOrdering()
- {
- // We generate the ordering for the message reference by taking the lowest
- // 48 bits of the current time and
- // concatenating with a 15 bit rotating counter to form a string of 63
- // bits which we then place
- // in the right most bits of a long, giving a positive signed 63 bit
- // integer.
+ // Inner classes -------------------------------------------------
- // Having a time element in the ordering means we don't have to maintain a
- // counter in the database
- // It also helps with failover since if two queues merge after failover
- // then, the ordering will mean
- // their orderings interleave nicely and they still get consumed in pretty
- // much time order
+
+ // We generate the ordering for the message reference by taking the lowest
+ // 48 bits of the current time and
+ // concatenating with a 15 bit rotating counter to form a string of 63
+ // bits which we then place
+ // in the right most bits of a long, giving a positive signed 63 bit
+ // integer.
- // We only have to guarantee ordering per session, so having slight
- // differences of time on different nodes is
- // not a problem
+ // Having a time element in the ordering means we don't have to maintain a
+ // counter in the database
+ // It also helps with failover since if two queues merge after failover
+ // then, the ordering will mean
+ // their orderings interleave nicely and they still get consumed in pretty
+ // much time order
- // The time element is good for about 8919 years - if you're still running
- // JBoss Messaging then, I suggest you need an
- // upgrade!
+ // We only have to guarantee ordering per session, so having slight
+ // differences of time on different nodes is
+ // not a problem
- long order = System.currentTimeMillis();
-
- order = order << 15;
-
- order = order | orderCount;
-
- if (orderCount == Short.MAX_VALUE)
- {
- orderCount = 0;
- }
- else
- {
- orderCount++;
- }
-
- return order;
- }
-
- // Inner classes -------------------------------------------------
-
+ // The time element is good for about 8919 years - if you're still running
+ // JBoss Messaging then, I suggest you need an
+ // upgrade!
+
+
+
private static class ChannelRefPair
{
private long channelID;
Added: branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/RotatingID.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/RotatingID.java (rev 0)
+++ branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/RotatingID.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.impl;
+
+/**
+ *
+ * A RotatingID
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class RotatingID
+{
+ private short count;
+
+ private long lastTime = System.currentTimeMillis();
+
+ public synchronized long getID()
+ {
+ long id = System.currentTimeMillis();
+
+ id = id << 15;
+
+ id = id | count;
+
+ if (count == Short.MAX_VALUE)
+ {
+ count = 0;
+
+ long now = System.currentTimeMillis();
+
+ //Safety - not likely to happen
+
+ while (now == lastTime)
+ {
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch (InterruptedException e)
+ {}
+
+ now = System.currentTimeMillis();
+ }
+ }
+ else
+ {
+ count++;
+ }
+
+ return id;
+ }
+}
\ No newline at end of file
Modified: branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java
===================================================================
--- branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/src/main/org/jboss/messaging/core/impl/tx/TransactionRepository.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -38,7 +38,7 @@
import org.jboss.messaging.core.contract.PersistenceManager;
import org.jboss.messaging.core.contract.PostOffice;
import org.jboss.messaging.core.contract.Queue;
-import org.jboss.messaging.core.impl.IDManager;
+import org.jboss.messaging.core.impl.RotatingID;
import org.jboss.messaging.core.impl.SimpleDelivery;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
@@ -70,22 +70,20 @@
protected MessageStore messageStore;
- private IDManager idManager;
-
private PostOffice postOffice;
+ private RotatingID txID = new RotatingID();
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public TransactionRepository(PersistenceManager persistenceManager, MessageStore store, IDManager idManager)
+ public TransactionRepository(PersistenceManager persistenceManager, MessageStore store)
{
this.persistenceManager = persistenceManager;
this.messageStore = store;
- this.idManager = idManager;
-
map = new ConcurrentHashMap();
}
@@ -251,7 +249,7 @@
{
throw new TransactionException("There is already an entry for xid " + xid);
}
- Transaction tx = new Transaction(idManager.getID(), xid, this);
+ Transaction tx = new Transaction(txID.getID(), xid, this);
if (trace) { log.trace("created transaction " + tx); }
@@ -262,7 +260,7 @@
public Transaction createTransaction() throws Exception
{
- Transaction tx = new Transaction(idManager.getID());
+ Transaction tx = new Transaction(txID.getID());
if (trace) { log.trace("created transaction " + tx); }
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/MessagingTestCase.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/MessagingTestCase.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/MessagingTestCase.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -21,11 +21,11 @@
*/
package org.jboss.test.messaging;
+import java.lang.ref.WeakReference;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
-import java.lang.ref.WeakReference;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -43,7 +43,6 @@
import javax.transaction.TransactionManager;
import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.message.MessageIdGeneratorFactory;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.util.ProxyAssertSupport;
@@ -101,8 +100,6 @@
// log the test start in the remote log, this will make hunting through logs so much easier
ServerManagement.log(ServerManagement.INFO, banner);
}
-
- MessageIdGeneratorFactory.instance.clear();
}
protected void tearDown() throws Exception
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/JDBCPersistenceManagerTest.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -1255,10 +1255,7 @@
Channel channel = new SimpleChannel(0, ms);
- IDManager idm = new IDManager("TRANSACTION_ID", 10, pm);
- idm.start();
-
- TransactionRepository txRep = new TransactionRepository(pm, ms, idm);
+ TransactionRepository txRep = new TransactionRepository(pm, ms);
txRep.start();
log.debug("transaction log started");
@@ -1366,10 +1363,7 @@
Channel channel = new SimpleChannel(0, ms);
- IDManager idm = new IDManager("TRANSACTION_ID", 10, pm);
- idm.start();
-
- TransactionRepository txRep = new TransactionRepository(pm, ms, idm);
+ TransactionRepository txRep = new TransactionRepository(pm, ms);
txRep.start();
Message[] messages = createMessages(10);
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/MessagingQueueTestBase.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/MessagingQueueTestBase.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/MessagingQueueTestBase.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -32,7 +32,6 @@
import org.jboss.messaging.core.contract.MessageStore;
import org.jboss.messaging.core.contract.PersistenceManager;
import org.jboss.messaging.core.contract.Receiver;
-import org.jboss.messaging.core.impl.IDManager;
import org.jboss.messaging.core.impl.JDBCPersistenceManager;
import org.jboss.messaging.core.impl.MessagingQueue;
import org.jboss.messaging.core.impl.message.SimpleMessageStore;
@@ -88,8 +87,6 @@
protected MessagingQueue queue;
- protected IDManager idm;
-
// Constructors --------------------------------------------------
public MessagingQueueTestBase(String name)
@@ -112,13 +109,10 @@
((JDBCPersistenceManager)pm).injectNodeID(1);
pm.start();
- idm = new IDManager("TRANSACTION_ID", 10, pm);
- idm.start();
-
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, idm);
+ tr = new TransactionRepository(pm, ms);
tr.start();
}
@@ -128,13 +122,11 @@
sc.stop();
pm.stop();
- idm.stop();
tr.stop();
ms.stop();
sc = null;
pm = null;
- idm = null;
ms = null;
tr = null;
super.tearDown();
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -128,8 +128,6 @@
protected IDManager channelIDManager;
- protected IDManager transactionIDManager;
-
protected PersistenceManager pm;
protected MessageStore ms;
@@ -247,13 +245,10 @@
((JDBCPersistenceManager)pm).injectNodeID(1);
pm.start();
- transactionIDManager = new IDManager("TRANSACTION_ID", 10, pm);
- transactionIDManager.start();
-
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, transactionIDManager);
+ tr = new TransactionRepository(pm, ms);
tr.start();
channelIDManager = new IDManager("CHANNEL_ID", 10, pm);
@@ -289,7 +284,6 @@
pm.stop();
tr.stop();
ms.stop();
- transactionIDManager.stop();
channelIDManager.stop();
super.tearDown();
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -71,8 +71,7 @@
protected PersistenceManager pm;
protected SimpleMessageStore ms;
protected TransactionRepository tr;
- protected IDManager idm;
-
+
// Constructors --------------------------------------------------
public PagingStateTestBase(String name)
@@ -97,13 +96,10 @@
((JDBCPersistenceManager)pm).injectNodeID(1);
pm.start();
- idm = new IDManager("TRANSACTION_ID", 10, pm);
- idm.start();
-
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, idm);
+ tr = new TransactionRepository(pm, ms);
tr.start();
ms.clear();
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -119,7 +119,7 @@
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, idm);
+ tr = new TransactionRepository(pm, ms);
tr.start();
@@ -211,7 +211,7 @@
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, idm);
+ tr = new TransactionRepository(pm, ms);
tr.start();
MessagingQueue queue2 = new MessagingQueue(1, "queue1", 1, ms, pm, false, -1, null, 100, 20, 10, false, 300000);
@@ -353,7 +353,7 @@
ms = new SimpleMessageStore();
ms.start();
- tr = new TransactionRepository(pm, ms, idm);
+ tr = new TransactionRepository(pm, ms);
tr.start();
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/ConnectionTest.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -36,8 +36,6 @@
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.state.ConnectionState;
-import org.jboss.jms.message.MessageIdGenerator;
-import org.jboss.jms.message.MessageIdGeneratorFactory;
import org.jboss.jms.tx.ResourceManager;
import org.jboss.jms.tx.ResourceManagerFactory;
import org.jboss.logging.Logger;
@@ -165,41 +163,6 @@
}
}
- public void testMessageIDGeneratorsForSameServer() throws Exception
- {
- Connection conn1 = cf.createConnection();
-
- ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)conn1).getDelegate();
-
- ConnectionState state1 = (ConnectionState)del1.getState();
-
- MessageIdGenerator gen1 = state1.getIdGenerator();
-
- Connection conn2 = cf.createConnection();
-
- ClientConnectionDelegate del2 = (ClientConnectionDelegate)((JBossConnection)conn2).getDelegate();
-
- ConnectionState state2 = (ConnectionState)del2.getState();
-
- MessageIdGenerator gen2 = state2.getIdGenerator();
-
- //Two connections for same server should share the same resource manager
-
- assertTrue(gen1 == gen2);
-
- assertTrue(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));
-
- conn1.close();
-
- //Check reference counting
- assertTrue(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));
-
- conn2.close();
-
- assertFalse(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));
- }
-
-
//
// Note: All tests related to closing a Connection should go to ConnectionClosedTest
//
Modified: branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java
===================================================================
--- branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java 2008-02-04 10:00:42 UTC (rev 3660)
+++ branches/Branch_Stable_temp/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java 2008-02-04 10:05:22 UTC (rev 3661)
@@ -119,113 +119,211 @@
protected void setUp() throws Exception
{
- super.setUp();
-
- log.info("node count is " + nodeCount);
+ super.setUp();
+
+ ic = new InitialContext[nodeCount];
- boolean changed = false;
+ queue = new Queue[nodeCount];
- if (ic != null && ic.length < nodeCount)
+ topic = new Topic[nodeCount];
+
+ for (int i = 0; i < nodeCount; i++)
{
- log.info("Node count has increased from " + ic.length + " to " + nodeCount);
- //Node count has increased
- InitialContext[] oldIc = ic;
- ic = new InitialContext[nodeCount];
- Queue[] oldQueue = queue;
- queue = new Queue[nodeCount];
- Topic[] oldTopic = topic;
- topic = new Topic[nodeCount];
- for (int i = 0; i < oldIc.length; i++)
- {
- ic[i] = oldIc[i];
- queue[i] = oldQueue[i];
- topic[i] = oldTopic[i];
- }
+ startDefaultServer(i, overrides, i == 0);
+
+ ic[i] = new InitialContext(ServerManagement.getJNDIEnvironment(i));
+
+ queue[i] = (Queue)ic[i].lookup("queue/testDistributedQueue");
+
+ topic[i] = (Topic)ic[i].lookup("topic/testDistributedTopic");
}
- else if (ic != null && ic.length > nodeCount)
+
+ cf = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ if (ResourceManagerFactory.instance.size() != 0)
{
- log.info("Node count has decreased from " + ic.length + " to " + nodeCount);
- //Node count has decreased
- InitialContext[] oldIc = ic;
- ic = new InitialContext[nodeCount];
- Queue[] oldQueue = queue;
- queue = new Queue[nodeCount];
- Topic[] oldTopic = topic;
- topic = new Topic[nodeCount];
- for (int i = 0; i < nodeCount; i++)
- {
- ic[i] = oldIc[i];
- queue[i] = oldQueue[i];
- topic[i] = oldTopic[i];
- }
-
- for (int i = nodeCount; i < oldIc.length; i++)
- {
- log.info("*** killing server");
- ServerManagement.kill(i);
- }
-
- changed = true;
+ ResourceManagerFactory.instance.dump();
+
+ fail("Connection(s) have been left open");
}
- if (overridesChanged(overrides, currentOverrides))
- {
- log.info("Overrides have changed so stopping and restarting all servers");
- currentOverrides = overrides;
-
- for (int i = 0; i < nodeCount; i++)
+ for (int i = 0; i < nodeCount; i++)
+ {
+ if (ServerManagement.isStarted(i))
{
- ServerManagement.stop(i);
+ checkEmpty(queue[i], i);
+
+ // Check no subscriptions left lying around
+
+ checkNoSubscriptions(topic[i], i);
}
-
- changed = true;
}
- for (int i = 0; i < nodeCount; i++)
- {
- if (!ServerManagement.isStarted(i))
- {
- log.info("Server " + i + " is not started - starting it");
-
- startDefaultServer(i, overrides, ic == null);
-
- if (ic == null)
- {
- ic = new InitialContext[nodeCount];
- queue = new Queue[nodeCount];
- topic = new Topic[nodeCount];
- }
-
- ic[i] = new InitialContext(ServerManagement.getJNDIEnvironment(i));
-
- queue[i] = (Queue)ic[i].lookup("queue/testDistributedQueue");
- topic[i] = (Topic)ic[i].lookup("topic/testDistributedTopic");
-
- changed = true;
-
- }
-
- checkEmpty(queue[i], i);
-
- // Check no subscriptions left lying around
-
- checkNoSubscriptions(topic[i], i);
-
- ServerManagement.getServer(i).resetAllSuckers();
+ for (int i = nodeCount -1 ; i >= 0; i--)
+ {
+ try
+ {
+ ic[i].close();
+ }
+ catch (Exception ignore)
+ {
+ }
+
+ try
+ {
+ ServerManagement.kill(i);
+ }
+ catch (Exception ignore)
+ {
+ }
}
- if (changed)
- {
- //Wait a little while before starting the test to ensure the new view propagates
- //otherwise the view change might hit after the test has started
- Thread.sleep(10000);
- }
+ ic = null;
- if (ic != null)
- {
- cf = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
- }
+ queue = null;
+
+ topic = null;
}
+
+// protected void setUp() throws Exception
+// {
+// super.setUp();
+//
+// log.info("node count is " + nodeCount);
+//
+// boolean changed = false;
+//
+// if (ic != null && ic.length < nodeCount)
+// {
+// log.info("Node count has increased from " + ic.length + " to " + nodeCount);
+// //Node count has increased
+// InitialContext[] oldIc = ic;
+// ic = new InitialContext[nodeCount];
+// Queue[] oldQueue = queue;
+// queue = new Queue[nodeCount];
+// Topic[] oldTopic = topic;
+// topic = new Topic[nodeCount];
+// for (int i = 0; i < oldIc.length; i++)
+// {
+// ic[i] = oldIc[i];
+// queue[i] = oldQueue[i];
+// topic[i] = oldTopic[i];
+// }
+// }
+// else if (ic != null && ic.length > nodeCount)
+// {
+// log.info("Node count has decreased from " + ic.length + " to " + nodeCount);
+// //Node count has decreased
+// InitialContext[] oldIc = ic;
+// ic = new InitialContext[nodeCount];
+// Queue[] oldQueue = queue;
+// queue = new Queue[nodeCount];
+// Topic[] oldTopic = topic;
+// topic = new Topic[nodeCount];
+// for (int i = 0; i < nodeCount; i++)
+// {
+// ic[i] = oldIc[i];
+// queue[i] = oldQueue[i];
+// topic[i] = oldTopic[i];
+// }
+//
+// for (int i = nodeCount; i < oldIc.length; i++)
+// {
+// log.info("*** killing server");
+// ServerManagement.kill(i);
+// }
+//
+// changed = true;
+// }
+//
+// if (overridesChanged(overrides, currentOverrides))
+// {
+// log.info("Overrides have changed so stopping and restarting all servers");
+// currentOverrides = overrides;
+//
+// for (int i = 0; i < nodeCount; i++)
+// {
+// ServerManagement.stop(i);
+// }
+//
+// changed = true;
+// }
+//
+// for (int i = 0; i < nodeCount; i++)
+// {
+// if (!ServerManagement.isStarted(i))
+// {
+// log.info("Server " + i + " is not started - starting it");
+//
+// startDefaultServer(i, overrides, ic == null);
+//
+// if (ic == null)
+// {
+// ic = new InitialContext[nodeCount];
+// queue = new Queue[nodeCount];
+// topic = new Topic[nodeCount];
+// }
+//
+// ic[i] = new InitialContext(ServerManagement.getJNDIEnvironment(i));
+//
+// queue[i] = (Queue)ic[i].lookup("queue/testDistributedQueue");
+// topic[i] = (Topic)ic[i].lookup("topic/testDistributedTopic");
+//
+// changed = true;
+//
+// }
+//
+// //checkEmpty(queue[i], i);
+//
+// // Check no subscriptions left lying around
+//
+// //checkNoSubscriptions(topic[i], i);
+//
+// ServerManagement.getServer(i).resetAllSuckers();
+// }
+//
+// if (changed)
+// {
+// //Wait a little while before starting the test to ensure the new view propagates
+// //otherwise the view change might hit after the test has started
+// Thread.sleep(10000);
+// }
+//
+// if (ic != null)
+// {
+// cf = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
+// }
+// }
+
+// protected void tearDown() throws Exception
+// {
+// super.tearDown();
+//
+// if (ResourceManagerFactory.instance.size() != 0)
+// {
+// ResourceManagerFactory.instance.dump();
+//
+// fail("Connection(s) have been left open");
+// }
+//
+// for (int i = 0; i < nodeCount; i++)
+// {
+// if (ServerManagement.isStarted(i))
+// {
+// checkEmpty(queue[i], i);
+//
+// // Check no subscriptions left lying around
+//
+// checkNoSubscriptions(topic[i], i);
+// }
+// }
+//
+// }
protected void startDefaultServer(int serverNumber, ServiceAttributeOverrides attributes, boolean cleanDatabase)
throws Exception
@@ -237,54 +335,44 @@
ServerManagement.deployTopic("testDistributedTopic", serverNumber);
}
- private boolean overridesChanged(ServiceAttributeOverrides sao1, ServiceAttributeOverrides sao2)
- {
- Map map1 = sao1 == null ? null : sao1.getMap();
-
- Map map2 = sao2 == null ? null : sao2.getMap();
-
- if (map1 == null && map2 == null)
- {
- return false;
- }
- if ((map1 == null && map2 != null) || (map2 == null && map1 != null))
- {
- return true;
- }
-
- if (map1.size() != map2.size())
- {
- return true;
- }
-
- Iterator iter = map1.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
- Object otherVal = map2.get(entry.getKey());
- if (otherVal == null)
- {
- return true;
- }
- if (!otherVal.equals(entry.getValue()))
- {
- return true;
- }
- }
- return false;
- }
+// private boolean overridesChanged(ServiceAttributeOverrides sao1, ServiceAttributeOverrides sao2)
+// {
+// Map map1 = sao1 == null ? null : sao1.getMap();
+//
+// Map map2 = sao2 == null ? null : sao2.getMap();
+//
+// if (map1 == null && map2 == null)
+// {
+// return false;
+// }
+// if ((map1 == null && map2 != null) || (map2 == null && map1 != null))
+// {
+// return true;
+// }
+//
+// if (map1.size() != map2.size())
+// {
+// return true;
+// }
+//
+// Iterator iter = map1.entrySet().iterator();
+// while (iter.hasNext())
+// {
+// Map.Entry entry = (Map.Entry)iter.next();
+// Object otherVal = map2.get(entry.getKey());
+// if (otherVal == null)
+// {
+// return true;
+// }
+// if (!otherVal.equals(entry.getValue()))
+// {
+// return true;
+// }
+// }
+// return false;
+// }
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- if (ResourceManagerFactory.instance.size() != 0)
- {
- ResourceManagerFactory.instance.dump();
-
- fail("Connection(s) have been left open");
- }
- }
+
protected String getLocatorURL(Connection conn)
{
More information about the jboss-cvs-commits
mailing list