[jboss-cvs] JBoss Messaging SVN: r3542 - 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 Jan 7 12:20:04 EST 2008
Author: timfox
Date: 2008-01-07 12:20:04 -0500 (Mon, 07 Jan 2008)
New Revision: 3542
Added:
trunk/tests/src/org/jboss/messaging/newcore/impl/test/unit/PriorityLinkedListTest.java
Removed:
trunk/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java
trunk/src/main/org/jboss/messaging/core/impl/clusterconnection/
trunk/src/main/org/jboss/messaging/util/prioritylinkedlist/
trunk/tests/src/org/jboss/test/messaging/util/prioritylinkedlist/
Modified:
trunk/src/main/org/jboss/jms/client/container/ClientConsumer.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
trunk/src/main/org/jboss/messaging/core/contract/Queue.java
trunk/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
trunk/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
trunk/tests/src/org/jboss/test/messaging/JBMServerTestCase.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java
trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
Removed failoverwaiter and clusterconnectionmanager and old priority queue
Modified: trunk/src/main/org/jboss/jms/client/container/ClientConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClientConsumer.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/jms/client/container/ClientConsumer.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -38,9 +38,9 @@
import org.jboss.jms.message.JBossMessage;
import org.jboss.logging.Logger;
import org.jboss.messaging.newcore.Message;
+import org.jboss.messaging.newcore.PriorityLinkedList;
+import org.jboss.messaging.newcore.impl.PriorityLinkedListImpl;
import org.jboss.messaging.util.Future;
-import org.jboss.messaging.util.prioritylinkedlist.BasicPriorityLinkedList;
-import org.jboss.messaging.util.prioritylinkedlist.PriorityLinkedList;
import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
@@ -191,7 +191,7 @@
* then if messages were sitting waiting to be consumed on the client side, then higher
* priority messages might be behind lower priority messages and thus get consumed out of order
*/
- private PriorityLinkedList buffer;
+ private PriorityLinkedList<JBossMessage> buffer;
private SessionDelegate sessionDelegate;
private ConsumerDelegate consumerDelegate;
private String consumerID;
@@ -228,7 +228,7 @@
throw new IllegalArgumentException(this + " bufferSize must be > 0");
}
- buffer = new BasicPriorityLinkedList(10);
+ buffer = new PriorityLinkedListImpl<JBossMessage>(10);
isConnectionConsumer = isCC;
this.ackMode = ackMode;
this.sessionDelegate = sess;
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -54,10 +54,8 @@
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.FailoverWaiter;
import org.jboss.messaging.core.impl.IDManager;
import org.jboss.messaging.core.impl.JDBCPersistenceManager;
-import org.jboss.messaging.core.impl.clusterconnection.ClusterConnectionManager;
import org.jboss.messaging.core.impl.memory.SimpleMemoryManager;
import org.jboss.messaging.core.impl.postoffice.MessagingPostOffice;
import org.jboss.messaging.core.impl.tx.TransactionRepository;
@@ -120,9 +118,7 @@
private IDManager transactionIDManager;
private MemoryManager memoryManager;
private MessageCounterManager messageCounterManager;
- private ClusterConnectionManager clusterConnectionManager;
private ClusterNotifier clusterNotifier;
- private FailoverWaiter failoverWaiter;
// plugins
@@ -215,20 +211,11 @@
clusterNotifier.registerListener(connectionManager);
clusterNotifier.registerListener(connFactoryJNDIMapper);
- failoverWaiter = new FailoverWaiter(configuration.getServerPeerID(), configuration.getFailoverStartTimeout(), configuration.getFailoverCompleteTimeout(), txRepository);
- clusterNotifier.registerListener(failoverWaiter);
if (configuration.getSuckerPassword() == null)
{
configuration.setSuckerPassword(SecurityMetadataStore.DEFAULT_SUCKER_USER_PASSWORD);
}
- if (configuration.getClusterPullConnectionFactoryName() != null)
- {
- clusterConnectionManager = new ClusterConnectionManager(configuration.isUseXAForMessagePull(), configuration.getServerPeerID(),
- configuration.getClusterPullConnectionFactoryName(), configuration.isDefaultPreserveOrdering(),
- SecurityMetadataStore.SUCKER_USER, configuration.getSuckerPassword());
- clusterNotifier.registerListener(clusterConnectionManager);
- }
// Start the wired components
@@ -242,7 +229,6 @@
securityStore.setSuckerPassword(configuration.getSuckerPassword());
securityStore.start();
txRepository.start();
- clusterConnectionManager.start();
// Note we do not start the message counter manager by default. This must be done
// explicitly by the user by calling enableMessageCounters(). This is because message
@@ -257,15 +243,7 @@
connFactoryJNDIMapper.injectReplicator(rep);
- // Also inject into the cluster connection manager
-
- this.clusterConnectionManager.injectPostOffice(postOffice);
-
- this.clusterConnectionManager.injectReplicator((Replicator) postOffice);
-
- this.connectionManager.injectReplicator((Replicator) postOffice);
-
-
+ connectionManager.injectReplicator((Replicator) postOffice);
}
//we inject the server peer because the post office needs it for clustering and the tx repository.
// This is crap and needs changing
@@ -325,8 +303,6 @@
txRepository = null;
messageCounterManager.stop();
messageCounterManager = null;
- clusterConnectionManager.stop();
- clusterConnectionManager = null;
//postOffice = null;
unloadServerAOPConfig();
@@ -518,11 +494,6 @@
// Public ---------------------------------------------------------------------------------------
- public void resetAllSuckers()
- {
- clusterConnectionManager.resetAllSuckers();
- }
-
public byte[] getClientAOPStack()
{
return clientAOPStack;
@@ -709,11 +680,6 @@
this.clusterNotifier = clusterNotifier;
}
- public FailoverWaiter getFailoverWaiter()
- {
- return failoverWaiter;
- }
-
public boolean isSupportsFailover()
{
return supportsFailover;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -156,39 +156,12 @@
{
try
{
- if (failedNodeID == -1)
- {
- // Just a standard createConnection
- ClientConnectionDelegate cd =
- createConnectionDelegateInternal(username, password, failedNodeID,
- remotingSessionID, clientVMID,
- versionToUse);
- return new CreateConnectionResult(cd);
- }
- else
- {
- log.trace(this + " received client-side failover request. Creating failover "+
- "connection to replace connection to failed node " + failedNodeID);
-
- // Wait for server side failover to complete
- int failoverNodeID = serverPeer.getFailoverWaiter().waitForFailover(failedNodeID);
-
- if (failoverNodeID == -1 || failoverNodeID != serverPeer.getConfiguration().getServerPeerID())
- {
- log.trace(this + " realized that we are on the wrong node or no failover has occured");
- return new CreateConnectionResult(failoverNodeID);
- }
- else
- {
- log.trace(this + " received notification that server-side failover completed, " +
- "creating connection delegate ...");
- ClientConnectionDelegate cd =
- createConnectionDelegateInternal(username, password, failedNodeID,
- remotingSessionID, clientVMID,
- versionToUse);
- return new CreateConnectionResult(cd);
- }
- }
+ // Just a standard createConnection
+ ClientConnectionDelegate cd =
+ createConnectionDelegateInternal(username, password, failedNodeID,
+ remotingSessionID, clientVMID,
+ versionToUse);
+ return new CreateConnectionResult(cd);
}
catch (Throwable t)
{
Modified: trunk/src/main/org/jboss/messaging/core/contract/Queue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/contract/Queue.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/messaging/core/contract/Queue.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -24,9 +24,7 @@
import java.util.List;
import java.util.Map;
-import org.jboss.messaging.core.impl.clusterconnection.MessageSucker;
-
/**
* A Queue
*
@@ -71,10 +69,6 @@
Distributor getRemoteDistributor();
- void registerSucker(MessageSucker sucker);
-
- boolean unregisterSucker(MessageSucker sucker);
-
void addToRecoveryArea(int nodeID, long messageID, String sessionID);
void removeFromRecoveryArea(int nodeID, long messageID);
Modified: trunk/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -40,8 +40,8 @@
import org.jboss.messaging.core.impl.tx.TxCallback;
import org.jboss.messaging.newcore.Filter;
import org.jboss.messaging.newcore.MessageReference;
-import org.jboss.messaging.util.prioritylinkedlist.BasicPriorityLinkedList;
-import org.jboss.messaging.util.prioritylinkedlist.PriorityLinkedList;
+import org.jboss.messaging.newcore.PriorityLinkedList;
+import org.jboss.messaging.newcore.impl.PriorityLinkedListImpl;
import org.jboss.util.timeout.Timeout;
import org.jboss.util.timeout.TimeoutTarget;
@@ -76,7 +76,7 @@
protected boolean receiversReady;
- protected PriorityLinkedList messageRefs;
+ protected PriorityLinkedList<MessageReference> messageRefs;
protected boolean recoverable;
@@ -114,7 +114,7 @@
this.recoverable = recoverable;
- messageRefs = new BasicPriorityLinkedList(10);
+ messageRefs = new PriorityLinkedListImpl<MessageReference>(10);
lock = new Object();
Deleted: trunk/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/messaging/core/impl/FailoverWaiter.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -1,192 +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.messaging.core.impl;
-
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.ClusterNotification;
-import org.jboss.messaging.core.contract.ClusterNotificationListener;
-import org.jboss.messaging.core.impl.tx.TransactionRepository;
-
-/**
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: $</tt>22 Jun 2007
- *
- * $Id: $
- *
- */
-public class FailoverWaiter implements ClusterNotificationListener
-{
- private static final Logger log = Logger.getLogger(FailoverWaiter.class);
-
- private int failingOverFor = -1;
-
- private int failedOverFor = -1;
-
- private Object failoverStatusLock;
-
- private long failoverStartTimeout;
-
- private long failoverCompleteTimeout;
-
- private int nodeID;
-
- private TransactionRepository txRepository;
-
- public FailoverWaiter(int nodeID, long failoverStartTimeout, long failoverCompleteTimeout,
- TransactionRepository txRepository)
- {
- failoverStatusLock = new Object();
-
- this.nodeID = nodeID;
-
- this.failoverStartTimeout = failoverStartTimeout;
-
- this.failoverCompleteTimeout = failoverCompleteTimeout;
-
- this.txRepository = txRepository;
- }
-
- /*
- * Wait for failover from the specified node to complete.
- */
- public int waitForFailover(int failedNodeID) throws Exception
- {
- log.trace("Waiting for failover for " + failedNodeID +
- " failingOverFor: " + failingOverFor + " failedOverFor: " + failedOverFor);
-
- // This node may be failing over for another node - in which case we must wait for that to be
- // complete.
-
- // TODO deal with multiple failover cascades
-
- //First wait for failover to start
- synchronized (failoverStatusLock)
- {
- long startToWait = failoverStartTimeout;
-
- while (startToWait > 0 && failingOverFor != failedNodeID && failedOverFor != failedNodeID)
- {
- long start = System.currentTimeMillis();
- try
- {
- log.debug(this + " blocking on the failover lock, waiting for failover to start");
- failoverStatusLock.wait(startToWait);
- log.debug(this + " releasing the failover lock, checking again whether failover started ...");
- }
- catch (InterruptedException ignore)
- {
- }
- startToWait -= System.currentTimeMillis() - start;
- }
-
- if (failingOverFor != failedNodeID && failedOverFor != failedNodeID)
- {
- //Timed out
- log.debug("Timed out waiting for failover to start");
-
- return -1;
- }
- }
-
- //Wait for failover to complete
- synchronized (failoverStatusLock)
- {
- long completeToWait = failoverCompleteTimeout;
-
- while (completeToWait > 0 && failedOverFor != failedNodeID)
- {
- long start = System.currentTimeMillis();
- try
- {
- log.debug(this + " blocking on the failover lock, waiting for failover to complete");
- failoverStatusLock.wait(completeToWait);
- log.debug(this + " releasing the failover lock, checking again whether failover completed ...");
- }
- catch (InterruptedException ignore)
- {
- }
- completeToWait -= System.currentTimeMillis() - start;
- }
-
- if (failedOverFor != failedNodeID)
- {
- //Timed out
- log.debug("Timed out waiting for failover to complete");
-
- return -1;
- }
- }
-
- return nodeID;
- }
-
- public void notify(ClusterNotification notification)
- {
- if (notification.type == ClusterNotification.TYPE_FAILOVER_START)
- {
- synchronized (failoverStatusLock)
- {
- failingOverFor = notification.nodeID;
-
- failoverStatusLock.notifyAll();
- }
- }
- else if (notification.type == ClusterNotification.TYPE_FAILOVER_END)
- {
- // We prompt txRepository to load any prepared txs - so we can take over
- // responsibility for in doubt transactions from other nodes
- try
- {
- txRepository.loadPreparedTransactions();
- }
- catch (Exception e)
- {
- log.error("Failed to load prepared transactions", e);
- }
-
- synchronized (failoverStatusLock)
- {
- failedOverFor = failingOverFor;
-
- failingOverFor = -1;
-
- failoverStatusLock.notifyAll();
- }
- }
- else if (notification.type == ClusterNotification.TYPE_NODE_JOIN)
- {
- synchronized (failoverStatusLock)
- {
- //A node that we previously failed over for has been restarted so we wipe the failover status
- //It is vital that we do this otherwise if the resurrected node subsequently fails again
- //when connections try to reconnect they will think that failover is already complete
- if (notification.nodeID == failedOverFor)
- {
- failedOverFor = -1;
-
- failoverStatusLock.notifyAll();
- }
- }
- }
- }
-}
Modified: trunk/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/MessagingQueue.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/src/main/org/jboss/messaging/core/impl/MessagingQueue.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -36,15 +36,14 @@
import org.jboss.messaging.core.contract.Delivery;
import org.jboss.messaging.core.contract.DeliveryObserver;
import org.jboss.messaging.core.contract.Distributor;
-import org.jboss.messaging.newcore.Filter;
-import org.jboss.messaging.newcore.Message;
-import org.jboss.messaging.newcore.MessageReference;
import org.jboss.messaging.core.contract.MessageStore;
import org.jboss.messaging.core.contract.PersistenceManager;
import org.jboss.messaging.core.contract.Queue;
import org.jboss.messaging.core.contract.Receiver;
-import org.jboss.messaging.core.impl.clusterconnection.MessageSucker;
import org.jboss.messaging.core.impl.tx.Transaction;
+import org.jboss.messaging.newcore.Filter;
+import org.jboss.messaging.newcore.Message;
+import org.jboss.messaging.newcore.MessageReference;
import org.jboss.util.timeout.Timeout;
import org.jboss.util.timeout.TimeoutTarget;
@@ -357,43 +356,43 @@
}
- public void registerSucker(MessageSucker sucker)
- {
- if (trace) { log.trace(this + " Registering sucker " + sucker); }
-
- synchronized (lock)
- {
- if (!suckers.contains(sucker))
- {
- suckers.add(sucker);
-
- handleFlowControlForConsumers = true;
-
- if (getReceiversReady() && localDistributor.getNumberOfReceivers() > 0)
- {
- if (trace) { log.trace(this + " receivers ready so setting consumer to true"); }
-
- sucker.setConsuming(true);
- }
- }
- }
- }
+// public void registerSucker(MessageSucker sucker)
+// {
+// if (trace) { log.trace(this + " Registering sucker " + sucker); }
+//
+// synchronized (lock)
+// {
+// if (!suckers.contains(sucker))
+// {
+// suckers.add(sucker);
+//
+// handleFlowControlForConsumers = true;
+//
+// if (getReceiversReady() && localDistributor.getNumberOfReceivers() > 0)
+// {
+// if (trace) { log.trace(this + " receivers ready so setting consumer to true"); }
+//
+// sucker.setConsuming(true);
+// }
+// }
+// }
+// }
+//
+// public boolean unregisterSucker(MessageSucker sucker)
+// {
+// synchronized (lock)
+// {
+// boolean removed = suckers.remove(sucker);
+//
+// if (removed && suckers.isEmpty())
+// {
+// handleFlowControlForConsumers = false;
+// }
+//
+// return removed;
+// }
+// }
- public boolean unregisterSucker(MessageSucker sucker)
- {
- synchronized (lock)
- {
- boolean removed = suckers.remove(sucker);
-
- if (removed && suckers.isEmpty())
- {
- handleFlowControlForConsumers = false;
- }
-
- return removed;
- }
- }
-
public int getFullSize()
{
return fullSize;
@@ -558,12 +557,12 @@
{
Iterator iter = suckers.iterator();
- while (iter.hasNext())
- {
- MessageSucker sucker = (MessageSucker)iter.next();
-
- sucker.setConsuming(consume);
- }
+// while (iter.hasNext())
+// {
+// MessageSucker sucker = (MessageSucker)iter.next();
+//
+// sucker.setConsuming(consume);
+// }
}
// Inner classes -------------------------------------------------
Copied: trunk/tests/src/org/jboss/messaging/newcore/impl/test/unit/PriorityLinkedListTest.java (from rev 3537, trunk/tests/src/org/jboss/test/messaging/util/prioritylinkedlist/PriorityLinkedListTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/newcore/impl/test/unit/PriorityLinkedListTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/newcore/impl/test/unit/PriorityLinkedListTest.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -0,0 +1,607 @@
+/*
+ * 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.newcore.impl.test.unit;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import org.jboss.messaging.newcore.PriorityLinkedList;
+import org.jboss.messaging.newcore.impl.PriorityLinkedListImpl;
+import org.jboss.messaging.test.unit.UnitTestCase;
+
+/**
+ * @author <a href="tim.fox at jboss.com>Tim Fox</a>
+ *
+ * $Id$
+ */
+public class PriorityLinkedListTest extends UnitTestCase
+{
+ protected PriorityLinkedList<Wibble> list;
+
+ protected Wibble a;
+ protected Wibble b;
+ protected Wibble c;
+ protected Wibble d;
+ protected Wibble e;
+ protected Wibble f;
+ protected Wibble g;
+ protected Wibble h;
+ protected Wibble i;
+ protected Wibble j;
+ protected Wibble k;
+ protected Wibble l;
+ protected Wibble m;
+ protected Wibble n;
+ protected Wibble o;
+ protected Wibble p;
+ protected Wibble q;
+ protected Wibble r;
+ protected Wibble s;
+ protected Wibble t;
+ protected Wibble u;
+ protected Wibble v;
+ protected Wibble w;
+ protected Wibble x;
+ protected Wibble y;
+ protected Wibble z;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ list = new PriorityLinkedListImpl<Wibble>(10);
+
+ a = new Wibble("a");
+ b = new Wibble("b");
+ c = new Wibble("c");
+ d = new Wibble("d");
+ e = new Wibble("e");
+ f = new Wibble("f");
+ g = new Wibble("g");
+ h = new Wibble("h");
+ i = new Wibble("i");
+ j = new Wibble("j");
+ k = new Wibble("k");
+ l = new Wibble("l");
+ m = new Wibble("m");
+ n = new Wibble("n");
+ o = new Wibble("o");
+ p = new Wibble("p");
+ q = new Wibble("q");
+ r = new Wibble("r");
+ s = new Wibble("s");
+ t = new Wibble("t");
+ u = new Wibble("u");
+ v = new Wibble("v");
+ w = new Wibble("w");
+ x = new Wibble("x");
+ y = new Wibble("y");
+ z = new Wibble("z");
+ }
+
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testAddFirst() throws Exception
+ {
+ list.addFirst(a, 0);
+ list.addFirst(b, 0);
+ list.addFirst(c, 0);
+ list.addFirst(d, 0);
+ list.addFirst(e, 0);
+
+
+ assertEquals(e, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(a, list.removeFirst());
+ assertNull(list.removeFirst());
+ }
+
+ public void testAddLast() throws Exception
+ {
+ list.addLast(a, 0);
+ list.addLast(b, 0);
+ list.addLast(c, 0);
+ list.addLast(d, 0);
+ list.addLast(e, 0);
+
+ assertEquals(a, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertNull(list.removeFirst());
+
+ }
+
+
+ public void testRemoveFirst() throws Exception
+ {
+ list.addLast(a, 0);
+ list.addLast(b, 1);
+ list.addLast(c, 2);
+ list.addLast(d, 3);
+ list.addLast(e, 4);
+ list.addLast(f, 5);
+ list.addLast(g, 6);
+ list.addLast(h, 7);
+ list.addLast(i, 8);
+ list.addLast(j, 9);
+
+ assertEquals(j, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(h, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(a, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ list.addLast(a, 9);
+ list.addLast(b, 8);
+ list.addLast(c, 7);
+ list.addLast(d, 6);
+ list.addLast(e, 5);
+ list.addLast(f, 4);
+ list.addLast(g, 3);
+ list.addLast(h, 2);
+ list.addLast(i, 1);
+ list.addLast(j, 0);
+
+ assertEquals(a, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(h, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(j, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ list.addLast(a, 9);
+ list.addLast(b, 0);
+ list.addLast(c, 8);
+ list.addLast(d, 1);
+ list.addLast(e, 7);
+ list.addLast(f, 2);
+ list.addLast(g, 6);
+ list.addLast(h, 3);
+ list.addLast(i, 5);
+ list.addLast(j, 4);
+
+ assertEquals(a, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(j, list.removeFirst());
+ assertEquals(h, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ list.addLast(a, 0);
+ list.addLast(b, 3);
+ list.addLast(c, 3);
+ list.addLast(d, 3);
+ list.addLast(e, 6);
+ list.addLast(f, 6);
+ list.addLast(g, 6);
+ list.addLast(h, 9);
+ list.addLast(i, 9);
+ list.addLast(j, 9);
+
+ assertEquals(h, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(j, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(a, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ list.addLast(a, 5);
+ list.addLast(b, 5);
+ list.addLast(c, 5);
+ list.addLast(d, 5);
+ list.addLast(e, 5);
+ list.addLast(f, 5);
+ list.addLast(g, 5);
+ list.addLast(h, 5);
+ list.addLast(i, 5);
+ list.addLast(j, 5);
+
+ assertEquals(a, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(h, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(j, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ list.addLast(j, 5);
+ list.addLast(i, 5);
+ list.addLast(h, 5);
+ list.addLast(g, 5);
+ list.addLast(f, 5);
+ list.addLast(e, 5);
+ list.addLast(d, 5);
+ list.addLast(c, 5);
+ list.addLast(b, 5);
+ list.addLast(a, 5);
+
+ assertEquals(j, list.removeFirst());
+ assertEquals(i, list.removeFirst());
+ assertEquals(h, list.removeFirst());
+ assertEquals(g, list.removeFirst());
+ assertEquals(f, list.removeFirst());
+ assertEquals(e, list.removeFirst());
+ assertEquals(d, list.removeFirst());
+ assertEquals(c, list.removeFirst());
+ assertEquals(b, list.removeFirst());
+ assertEquals(a, list.removeFirst());
+
+ assertNull(list.removeFirst());
+
+ }
+
+ public void testGetAll() throws Exception
+ {
+ list.addLast(a, 0);
+ list.addLast(b, 3);
+ list.addLast(c, 3);
+ list.addLast(d, 3);
+ list.addLast(e, 6);
+ list.addLast(f, 6);
+ list.addLast(g, 6);
+ list.addLast(h, 9);
+ list.addLast(i, 9);
+ list.addLast(j, 9);
+
+
+ Iterator iter = list.getAll().iterator();
+ int count = 0;
+ while (iter.hasNext())
+ {
+ Object o = iter.next();
+ if (count == 0)
+ {
+ assertEquals(h, o);
+ }
+ if (count == 1)
+ {
+ assertEquals(i, o);
+ }
+ if (count == 2)
+ {
+ assertEquals(j, o);
+ }
+ if (count == 3)
+ {
+ assertEquals(e, o);
+ }
+ if (count == 4)
+ {
+ assertEquals(f, o);
+ }
+ if (count == 5)
+ {
+ assertEquals(g, o);
+ }
+ if (count == 6)
+ {
+ assertEquals(b, o);
+ }
+ if (count == 7)
+ {
+ assertEquals(c, o);
+ }
+ if (count == 8)
+ {
+ assertEquals(d, o);
+ }
+ if (count == 9)
+ {
+ assertEquals(a, o);
+ }
+ count++;
+ }
+ assertEquals(10, count);
+ }
+
+ public void testIterator()
+ {
+ list.addLast(a, 9);
+ list.addLast(b, 9);
+ list.addLast(c, 8);
+ list.addLast(d, 8);
+ list.addLast(e, 7);
+ list.addLast(f, 7);
+ list.addLast(g, 7);
+ list.addLast(h, 6);
+ list.addLast(i, 6);
+ list.addLast(j, 6);
+ list.addLast(k, 5);
+ list.addLast(l, 5);
+ list.addLast(m, 4);
+ list.addLast(n, 4);
+ list.addLast(o, 4);
+ list.addLast(p, 3);
+ list.addLast(q, 3);
+ list.addLast(r, 3);
+ list.addLast(s, 2);
+ list.addLast(t, 2);
+ list.addLast(u, 2);
+ list.addLast(v, 1);
+ list.addLast(w, 1);
+ list.addLast(x, 1);
+ list.addLast(y, 0);
+ list.addLast(z, 0);
+
+ ListIterator iter = list.iterator();
+
+ int c = 0;
+ while (iter.hasNext())
+ {
+ iter.next();
+ c++;
+ }
+ assertEquals(c, 26);
+ assertEquals(26, list.size());
+
+ iter = list.iterator();
+ assertTrue(iter.hasNext());
+ Wibble w = (Wibble)iter.next();
+ assertEquals("a", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("d", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("j", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("z", w.s);
+ assertFalse(iter.hasNext());
+
+ iter = list.iterator();
+ assertTrue(iter.hasNext());
+ w = (Wibble)iter.next();
+ assertEquals("a", w.s);
+
+ iter.remove();
+
+ assertEquals(25, list.size());
+
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("d", w.s);
+
+ iter.remove();
+
+ assertEquals(24, list.size());
+
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("j", w.s);
+
+ iter.remove();
+
+ assertEquals(23, list.size());
+
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("z", w.s);
+ iter.remove();
+ assertFalse(iter.hasNext());
+
+ iter = list.iterator();
+ assertTrue(iter.hasNext());
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ assertFalse(iter.hasNext());
+
+ }
+
+
+ public void testClear()
+ {
+ list.addLast(a, 0);
+ list.addLast(b, 3);
+ list.addLast(c, 3);
+ list.addLast(d, 3);
+ list.addLast(e, 6);
+ list.addLast(f, 6);
+ list.addLast(g, 6);
+ list.addLast(h, 9);
+ list.addLast(i, 9);
+ list.addLast(j, 9);
+
+ list.clear();
+
+ assertNull(list.removeFirst());
+
+ assertTrue(list.getAll().isEmpty());
+ }
+
+ class Wibble
+ {
+ String s;
+ Wibble(String s)
+ {
+ this.s = s;
+ }
+ public String toString()
+ {
+ return s;
+ }
+ }
+
+}
+
Modified: trunk/tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -765,19 +765,6 @@
servers.get(server).undeployConnectionFactory(objectName);
}
- public void resetAllSuckers() throws Exception
- {
- for (int i = 0; i < getServerCount(); i++)
- {
- resetAllSuckers(i);
- }
- }
-
- public void resetAllSuckers(int server) throws Exception
- {
- servers.get(server).resetAllSuckers();
- }
-
private void clearDatabase() throws Exception
{
if (databaseClearer == null)
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteringTestBase.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -223,8 +223,6 @@
// Check no subscriptions left lying around
checkNoSubscriptions(topic[i], i);
-
- resetAllSuckers(i);
}
if (changed)
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -624,11 +624,6 @@
//sc.flushManagedConnectionPool();
}
- public void resetAllSuckers() throws Exception
- {
- getServerPeer().resetAllSuckers();
- }
-
// Public ---------------------------------------------------------------------------------------
// Package protected ----------------------------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -503,11 +503,6 @@
server.flushManagedConnectionPool();
}
- public void resetAllSuckers() throws Exception
- {
- server.resetAllSuckers();
- }
-
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-01-07 15:59:53 UTC (rev 3541)
+++ trunk/tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-01-07 17:20:04 UTC (rev 3542)
@@ -275,8 +275,6 @@
void flushManagedConnectionPool() throws Exception;
- void resetAllSuckers() throws Exception;
-
void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck) throws Exception;
JmsServer getJmsServer() throws Exception;
More information about the jboss-cvs-commits
mailing list