[jboss-cvs] JBoss Messaging SVN: r1891 - in trunk: src/main/org/jboss/jms/client src/main/org/jboss/jms/client/container src/main/org/jboss/jms/client/delegate src/main/org/jboss/jms/client/remoting src/main/org/jboss/jms/client/state src/main/org/jboss/jms/server src/main/org/jboss/jms/server/destination src/main/org/jboss/jms/server/endpoint src/main/org/jboss/jms/server/remoting src/main/org/jboss/jms/tx src/main/org/jboss/jms/util src/main/org/jboss/messaging/core src/main/org/jboss/messaging/core/plugin/contract src/main/org/jboss/messaging/core/plugin/postoffice src/main/org/jboss/messaging/core/plugin/postoffice/cluster tests/src/org/jboss/test/messaging/core tests/src/org/jboss/test/messaging/core/local/base tests/src/org/jboss/test/messaging/core/paging tests/src/org/jboss/test/messaging/core/plugin/postoffice tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/jms/clustering
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 4 11:09:05 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-01-04 11:08:37 -0500 (Thu, 04 Jan 2007)
New Revision: 1891
Added:
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java
Modified:
trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
trunk/src/main/org/jboss/jms/client/state/ProducerState.java
trunk/src/main/org/jboss/jms/client/state/SessionState.java
trunk/src/main/org/jboss/jms/server/JMSCondition.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
trunk/src/main/org/jboss/jms/server/destination/QueueService.java
trunk/src/main/org/jboss/jms/server/endpoint/Ack.java
trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/DefaultAck.java
trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
trunk/src/main/org/jboss/jms/tx/ResourceManager.java
trunk/src/main/org/jboss/jms/util/ToString.java
trunk/src/main/org/jboss/messaging/core/Channel.java
trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java
trunk/src/main/org/jboss/messaging/core/Routable.java
trunk/src/main/org/jboss/messaging/core/plugin/contract/PostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBindings.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredBindings.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RemoteQueueStub.java
trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java
trunk/tests/src/org/jboss/test/messaging/core/local/base/PagingFilteredQueueTestBase.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/DefaultPostOfficeTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultMessagePullPolicyTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultRouterTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/RedistributionWithDefaultMessagePullPolicyTest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-708
http://jira.jboss.com/jira/browse/JBMESSAGING-709
http://jira.jboss.org/jira/browse/JBMESSAGING-713
http://jira.jboss.org/jira/browse/JBMESSAGING-715
Messages that came over a failed-over connection are preferentially routed
to their corresponding failover queues (and not the other local queues, as
it was the case so far)
Some tests still fail.
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -154,7 +154,7 @@
this.consumerID = state.getConsumerID();
- this.channelID = state.getChannelId();
+ this.channelID = state.getChannelID();
this.maxDeliveries = state.getMaxDeliveries();
Modified: trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -91,11 +91,15 @@
while (attemptCount < MAX_RECONNECT_HOP_COUNT)
{
+
+ int failedNodeIDToServer = -1;
+
if (delegate == null)
{
if (failedNodeID != null && failedNodeID.intValue() >= 0)
{
delegate = getFailoverDelegateForNode(failedNodeID);
+ failedNodeIDToServer = failedNodeID.intValue();
}
else
{
@@ -106,7 +110,8 @@
log.debug(this + " has chosen " + delegate + " as target, " +
(attemptCount == 0 ? "first connection attempt" : attemptCount + " connection attempts"));
- CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1); // TODO get rid of -1 from signature
+ CreateConnectionResult res = delegate.
+ createConnectionDelegate(username, password, failedNodeIDToServer);
ClientConnectionDelegate cd = (ClientConnectionDelegate)res.getDelegate();
if (cd != null)
Modified: trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -75,7 +75,7 @@
SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
int consumerID = consumerState.getConsumerID();
- long channelID = consumerState.getChannelId();
+ long channelID = consumerState.getChannelID();
int prefetchSize = consumerState.getBufferSize();
QueuedExecutor sessionExecutor = sessionState.getExecutor();
int maxDeliveries = consumerState.getMaxDeliveries();
Modified: trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -100,7 +100,7 @@
//transaction is committed, then this means the same message has been delivered twice
//which breaks the once and only once delivery guarantee
- if (rm.checkForAcksInSession(state.getSessionId()))
+ if (rm.checkForAcksInSession(state.getSessionID()))
{
throw new java.lang.IllegalStateException("Attempt to close an XASession when there are still uncommitted acknowledgements!");
}
@@ -122,7 +122,7 @@
if (remainingAutoAck != null)
{
- if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack it " + remainingAutoAck.getDeliveryId()); }
+ if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
ackDelivery(del, remainingAutoAck);
@@ -249,7 +249,7 @@
(ClientSessionDelegate)info.getConnectionConsumerSession();
int sessionId = connectionConsumerDelegate != null ?
- connectionConsumerDelegate.getID() : state.getSessionId();
+ connectionConsumerDelegate.getID() : state.getSessionID();
connState.getResourceManager().addAck(txID, sessionId, info);
}
@@ -527,9 +527,9 @@
MethodInvocation mi = (MethodInvocation)invocation;
Message m = (Message)mi.getArguments()[0];
- if (trace) { log.trace("sending message " + m + " transactionally, queueing on resource manager txID=" + txID + " sessionID= " + state.getSessionId()); }
+ if (trace) { log.trace("sending message " + m + " transactionally, queueing on resource manager txID=" + txID + " sessionID= " + state.getSessionID()); }
- connState.getResourceManager().addMessage(txID, state.getSessionId(), (JBossMessage)m);
+ connState.getResourceManager().addMessage(txID, state.getSessionID(), (JBossMessage)m);
// ... and we don't invoke any further interceptors in the stack
return null;
@@ -596,7 +596,7 @@
SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
- sessionToUse.cancelDelivery(new DefaultCancel(delivery.getDeliveryId(),
+ sessionToUse.cancelDelivery(new DefaultCancel(delivery.getDeliveryID(),
delivery.getMessageProxy().getDeliveryCount(), false, false));
}
Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -167,7 +167,7 @@
int maxDeliveries = consumerDelegate.getMaxDeliveries();
- long channelId = consumerDelegate.getChannelId();
+ long channelId = consumerDelegate.getChannelID();
ConsumerState consumerState =
new ConsumerState(sessionState, consumerDelegate, dest, selector, noLocal,
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -148,6 +148,7 @@
}
else
{
+ sb.append("SIDs={");
for(int i = 0; i < delegates.length; i++)
{
sb.append(delegates[i].getServerID());
@@ -156,7 +157,7 @@
sb.append(',');
}
}
- sb.append("]");
+ sb.append("}]");
}
return sb.toString();
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -97,6 +97,10 @@
newDelegate.setClientID(thisState.getClientID());
}
+ // synchronize (recursively) the client-side state
+
+ state.synchronizeWith(newDelegate.getState());
+
// synchronize the delegates
remotingConnection = newDelegate.getRemotingConnection();
@@ -105,10 +109,6 @@
// There is one RM per server, so we need to merge the rms if necessary
ResourceManagerFactory.instance.handleFailover(serverID, newDelegate.getServerID());
- // synchronize (recursively) the client-side state
-
- state.synchronizeWith(newDelegate.getState());
-
// start the new connection if necessary
if (thisState.isStarted())
{
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -42,35 +42,55 @@
*/
public class ClientConsumerDelegate extends DelegateSupport implements ConsumerDelegate
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final long serialVersionUID = -2578195153435251519L;
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private int bufferSize;
-
private int maxDeliveries;
+ private long channelID;
- private long channelId;
+ // Static ---------------------------------------------------------------------------------------
- // Static --------------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
- // Constructors --------------------------------------------------
-
- public ClientConsumerDelegate(int objectID, long channelId, int bufferSize, int maxDeliveries)
+ public ClientConsumerDelegate(int objectID, long channelID, int bufferSize, int maxDeliveries)
{
super(objectID);
this.bufferSize = bufferSize;
- this.channelId = channelId;
this.maxDeliveries = maxDeliveries;
+ this.channelID = channelID;
}
public ClientConsumerDelegate()
{
}
- // ConsumerDelegate implementation -------------------------------
+ // DelegateSupport overrides --------------------------------------------------------------------
+
+ public void synchronizeWith(DelegateSupport nd) throws Exception
+ {
+ super.synchronizeWith(nd);
+
+ ClientConsumerDelegate newDelegate = (ClientConsumerDelegate)nd;
+
+ // synchronize server endpoint state
+
+ // synchronize (recursively) the client-side state
+
+ state.synchronizeWith(newDelegate.getState());
+
+ // synchronize the delegates
+
+ bufferSize = newDelegate.getBufferSize();
+ maxDeliveries = newDelegate.getMaxDeliveries();
+ channelID = newDelegate.getChannelID();
+
+ }
+
+ // ConsumerDelegate implementation --------------------------------------------------------------
/**
* This invocation should either be handled by the client-side interceptor chain or by the
@@ -207,11 +227,11 @@
throw new IllegalStateException("This invocation should not be handled here!");
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public String toString()
{
- return "ConsumerDelegate[" + id + "](ChannelId=" + this.channelId+")" ;
+ return "ConsumerDelegate[" + id + ", ChID=" + channelID + "]";
}
public int getBufferSize()
@@ -224,26 +244,13 @@
return maxDeliveries;
}
- public long getChannelId()
+ public long getChannelID()
{
- return channelId;
+ return channelID;
}
- public void synchronizeWith(DelegateSupport newDelegate) throws Exception
- {
- super.synchronizeWith(newDelegate);
-
- this.bufferSize = ((ClientConsumerDelegate)newDelegate).getBufferSize();
-
- this.maxDeliveries = ((ClientConsumerDelegate)newDelegate).getMaxDeliveries();
-
- this.channelId = ((ClientConsumerDelegate)newDelegate).getChannelId();
- }
+ // Protected ------------------------------------------------------------------------------------
- // Protected -----------------------------------------------------
-
-
-
protected Client getClient()
{
// Use the Client in the Connection's state
@@ -252,9 +259,9 @@
}
- // Package Private -----------------------------------------------
+ // Package Private ------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner Classes -------------------------------------------------
+ // Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -41,23 +41,41 @@
*/
public class ClientProducerDelegate extends DelegateSupport implements ProducerDelegate
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final long serialVersionUID = -6976930316308905681L;
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public ClientProducerDelegate()
{
super(-1);
}
- // ProducerDelegate implementation -------------------------------
+ // DelegateSupport overrides --------------------------------------------------------------------
+ public void synchronizeWith(DelegateSupport nd) throws Exception
+ {
+ super.synchronizeWith(nd);
+
+ ClientProducerDelegate newDelegate = (ClientProducerDelegate)nd;
+
+ // synchronize server endpoint state
+
+ // synchronize (recursively) the client-side state
+
+ state.synchronizeWith(newDelegate.getState());
+
+ // synchronize the delegates
+
+ }
+
+ // ProducerDelegate implementation --------------------------------------------------------------
+
/**
* This invocation should either be handled by the client-side interceptor chain or by the
* server-side endpoint.
@@ -248,24 +266,24 @@
throw new IllegalStateException("This invocation should not be handled here!");
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public String toString()
{
return "ProducerDelegate[" + id + "]";
}
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
protected Client getClient()
{
throw new UnsupportedOperationException("Producers only exist on the client");
}
- // Package Private -----------------------------------------------
+ // Package Private ------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner Classes -------------------------------------------------
+ // Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -90,11 +90,11 @@
// synchronize server endpoint state
- // synchronize the delegates
+ // synchronize (recursively) the client-side state
- // synchronize (recursively) the client-side state
-
state.synchronizeWith(newDelegate.getState());
+
+ // synchronize the delegates
}
// SessionDelegate implementation ---------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -70,8 +70,9 @@
//FIXME temporary - until remoting provides true asynch invocations
static Executor exec = new QueuedExecutor();
- private static boolean checkExpiredOrReachedMaxdeliveries(MessageProxy proxy, SessionDelegate del,
- int maxDeliveries) throws JMSException
+ private static boolean checkExpiredOrReachedMaxdeliveries(MessageProxy proxy,
+ SessionDelegate del,
+ int maxDeliveries)
{
Message msg = proxy.getMessage();
@@ -249,7 +250,7 @@
/**
* Handles a message sent from the server
- * @param msgs The message
+ * @param msg The message
*/
public void handleMessage(MessageProxy msg)
{
@@ -536,20 +537,23 @@
messageAdded();
}
}
-
- public void copyState(MessageCallbackHandler newHandler)
+
+ /**
+ * Needed for failover
+ */
+ public void synchronizeWith(MessageCallbackHandler newHandler)
{
- // removed the synchronized block due to http://jira.jboss.org/jira/browse/JBMESSAGING-702
- //synchronized (mainLock)
- //{
- this.consumerID = newHandler.consumerID;
-
- this.consumerDelegate = newHandler.consumerDelegate;
-
- this.sessionDelegate = newHandler.sessionDelegate;
-
- this.buffer.clear();
- //}
+ consumerID = newHandler.consumerID;
+ consumerDelegate = newHandler.consumerDelegate;
+ sessionDelegate = newHandler.sessionDelegate;
+
+ // Clear the buffer. This way the non persistent messages that managed to arive are
+ // irremendiably lost, while the peristent ones are failed-over on the server and will be
+ // resent
+
+ // TODO If we don't zap this buffer, we may be able to salvage some non-persistent messages
+
+ buffer.clear();
}
public long getLastDeliveryId()
@@ -666,7 +670,7 @@
}
}
- private MessageProxy getMessage(long timeout) throws JMSException
+ private MessageProxy getMessage(long timeout)
{
if (timeout == -1)
{
Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -167,9 +167,6 @@
serverID = newState.serverID;
versionToUse = newState.versionToUse;
- // I removed this due to http://jira.jboss.com/jira/browse/JBMESSAGING-686
- //this.delegate = newState.delegate;
-
ConnectionDelegate newDelegate = (ConnectionDelegate)newState.getDelegate();
for(Iterator i = getChildren().iterator(); i.hasNext(); )
Modified: trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -26,7 +26,9 @@
import javax.jms.Destination;
import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.remoting.MessageCallbackHandler;
+import org.jboss.jms.client.remoting.CallbackManager;
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.server.Version;
@@ -35,40 +37,40 @@
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Clebert Suconic</a>
* @version <tt>$Revision$</tt>
*
* $Id$
*/
public class ConsumerState extends HierarchicalStateSupport
{
- private Destination destination;
+ // Constants ------------------------------------------------------------------------------------
- private String selector;
+ // Static ---------------------------------------------------------------------------------------
- String subscriptionName;
+ // Attributes -----------------------------------------------------------------------------------
+ private int consumerID;
+ private Destination destination;
+ private String selector;
+ private String subscriptionName;
private boolean noLocal;
-
- private int consumerID;
-
private boolean isConnectionConsumer;
-
private MessageCallbackHandler messageCallbackHandler;
+ private int bufferSize;
+ private int maxDeliveries;
- private int bufferSize;
-
+ // Needed for failover
+ private long channelID;
+
private SessionState parent;
-
private ConsumerDelegate delegate;
-
- private int maxDeliveries;
-
- //Needed for failover
- private long channelId;
-
+
+ // Constructors ---------------------------------------------------------------------------------
+
public ConsumerState(SessionState parent, ConsumerDelegate delegate, Destination dest,
String selector, boolean noLocal, String subscriptionName, int consumerID,
- boolean isCC, int bufferSize, int maxDeliveries, long channelId)
+ boolean isCC, int bufferSize, int maxDeliveries, long channelID)
{
super(parent, (DelegateSupport)delegate);
children = Collections.EMPTY_SET;
@@ -80,9 +82,11 @@
this.bufferSize = bufferSize;
this.subscriptionName=subscriptionName;
this.maxDeliveries = maxDeliveries;
- this.channelId = channelId;
+ this.channelID = channelID;
}
+ // HierarchicalState implementation -------------------------------------------------------------
+
public DelegateSupport getDelegate()
{
return (DelegateSupport)delegate;
@@ -93,7 +97,47 @@
this.delegate = (ConsumerDelegate)delegate;
}
+ public HierarchicalState getParent()
+ {
+ return parent;
+ }
+ public void setParent(HierarchicalState parent)
+ {
+ this.parent=(SessionState)parent;
+ }
+
+ public Version getVersionToUse()
+ {
+ return parent.getVersionToUse();
+ }
+
+ // HierarchicalStateSupport overrides -----------------------------------------------------------
+
+ public void synchronizeWith(HierarchicalState ns) throws Exception
+ {
+ ConsumerState newState = (ConsumerState)ns;
+
+ int oldConsumerID = consumerID;
+ consumerID = newState.consumerID;
+ channelID = newState.channelID;
+
+ CallbackManager oldCallbackManager = ((ClientConnectionDelegate)getParent().getParent().
+ getDelegate()).getRemotingConnection().getCallbackManager();
+ CallbackManager newCallbackManager = ((ClientConnectionDelegate)ns.getParent().getParent().
+ getDelegate()).getRemotingConnection().getCallbackManager();
+
+ // We need to synchronize the old message callback handler using the new one
+
+ MessageCallbackHandler handler = oldCallbackManager.unregisterHandler(oldConsumerID);
+ MessageCallbackHandler newHandler = newCallbackManager.unregisterHandler(consumerID);
+
+ handler.synchronizeWith(newHandler);
+ newCallbackManager.registerHandler(consumerID, handler);
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
public Destination getDestination()
{
return destination;
@@ -129,30 +173,11 @@
return messageCallbackHandler;
}
- public Version getVersionToUse()
- {
- return parent.getVersionToUse();
- }
-
- public void synchronizeWith(HierarchicalState newState) throws Exception {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
public int getBufferSize()
{
return bufferSize;
}
- public HierarchicalState getParent()
- {
- return parent;
- }
-
- public void setParent(HierarchicalState parent)
- {
- this.parent=(SessionState)parent;
- }
-
public String getSubscriptionName()
{
return subscriptionName;
@@ -167,22 +192,18 @@
{
return maxDeliveries;
}
-
- public long getChannelId()
+
+ public long getChannelID()
{
- return channelId;
+ return channelID;
}
-
- // When failing over a consumer, we keep the old consumer's state but there are certain fields
- // we need to update
- public void copyState(ConsumerState newState)
- {
- this.consumerID = newState.consumerID;
- // I removed this due to http://jira.jboss.com/jira/browse/JBMESSAGING-686
- //this.delegate = newState.delegate;
-
- this.channelId = newState.channelId;
- }
+ // Package protected ----------------------------------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/client/state/ProducerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ProducerState.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/state/ProducerState.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -35,28 +35,33 @@
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodoorv</a>
+ *
* @version <tt>$Revision$</tt>
*
* $Id$
*/
public class ProducerState extends HierarchicalStateSupport
{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
private Destination destination;
private boolean disableMessageID = false;
-
private boolean disableMessageTimestamp = false;
-
private int priority = 4;
-
private long timeToLive = 0;
-
private int deliveryMode = DeliveryMode.PERSISTENT;
private SessionState parent;
+ private ProducerDelegate delegate;
- private ProducerDelegate delegate;
-
+ // Constructors ---------------------------------------------------------------------------------
+
public ProducerState(SessionState parent, ProducerDelegate delegate, Destination dest)
{
super(parent, (DelegateSupport)delegate);
@@ -64,103 +69,111 @@
this.destination = dest;
}
- public void synchronizeWith(HierarchicalState newState) throws Exception {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Destination getDestination()
- {
- return destination;
- }
-
+ // HierarchicalState implementation -------------------------------------------------------------
+
public DelegateSupport getDelegate()
{
return (DelegateSupport)delegate;
}
-
+
public void setDelegate(DelegateSupport delegate)
{
this.delegate=(ProducerDelegate)delegate;
}
-
+
public void setParent(HierarchicalState parent)
{
this.parent = (SessionState)parent;
}
-
+
public HierarchicalState getParent()
{
return parent;
}
-
+
+ public Version getVersionToUse()
+ {
+ return parent.getVersionToUse();
+ }
+
+ // HierarchicalStateSupport overrides -----------------------------------------------------------
+
+ public void synchronizeWith(HierarchicalState newState) throws Exception
+ {
+ // nothing to do here, ProducerState is a modest state
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public Destination getDestination()
+ {
+ return destination;
+ }
+
public void setDestination(Destination dest)
{
this.destination = dest;
-
+
}
public boolean isDisableMessageID()
{
return disableMessageID;
}
-
+
public void setDisableMessageID(boolean disableMessageID)
{
this.disableMessageID = disableMessageID;
}
-
+
public boolean isDisableMessageTimestamp()
{
return disableMessageTimestamp;
}
-
+
public void setDisableMessageTimestamp(boolean disableMessageTimestamp)
{
this.disableMessageTimestamp = disableMessageTimestamp;
}
-
+
public int getPriority()
{
return priority;
}
-
+
public void setPriority(int priority)
{
this.priority = priority;
}
-
+
public long getTimeToLive()
{
return timeToLive;
}
-
+
public void setTimeToLive(long timeToLive)
{
this.timeToLive = timeToLive;
}
-
+
public int getDeliveryMode()
{
return deliveryMode;
}
-
+
public void setDeliveryMode(int deliveryMode)
{
this.deliveryMode = deliveryMode;
}
-
- public Version getVersionToUse()
- {
- return parent.getVersionToUse();
- }
-
- // When failing over a producer, we keep the old producer's state but there are certain fields
- // we need to update
- public void copyState(ProducerState newState)
- {
- //Actually only one field
- //this.delegate = newState.delegate;
- }
-
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+
}
Modified: trunk/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -31,12 +31,10 @@
import org.jboss.jms.client.delegate.ClientSessionDelegate;
import org.jboss.jms.client.delegate.DelegateSupport;
-import org.jboss.jms.client.delegate.ClientConnectionDelegate;
import org.jboss.jms.client.delegate.ClientConsumerDelegate;
import org.jboss.jms.client.delegate.ClientProducerDelegate;
import org.jboss.jms.client.delegate.ClientBrowserDelegate;
import org.jboss.jms.client.remoting.MessageCallbackHandler;
-import org.jboss.jms.client.remoting.CallbackManager;
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.server.Version;
import org.jboss.jms.server.endpoint.DeliveryInfo;
@@ -56,6 +54,7 @@
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
*
* $Id$
@@ -74,7 +73,7 @@
private ConnectionState parent;
private SessionDelegate delegate;
- private int sessionId;
+ private int sessionID;
private int acknowledgeMode;
private boolean transacted;
private boolean xa;
@@ -104,7 +103,7 @@
{
super(parent, (DelegateSupport)delegate);
- this.sessionId = delegate.getID();
+ this.sessionID = delegate.getID();
children = new HashSet();
this.acknowledgeMode = ackMode;
@@ -171,8 +170,8 @@
{
SessionState newState = (SessionState)ns;
- int oldSessionID = sessionId;
- sessionId = newState.sessionId;
+ int oldSessionID = sessionID;
+ sessionID = newState.sessionID;
ClientSessionDelegate newDelegate = (ClientSessionDelegate)newState.getDelegate();
@@ -180,14 +179,36 @@
{
HierarchicalState child = (HierarchicalState)i.next();
- if (child instanceof ProducerState)
+ if (child instanceof ConsumerState)
{
- handleFailoverOnProducer((ProducerState)child, newDelegate);
+ ConsumerState consState = (ConsumerState)child;
+ ClientConsumerDelegate consDelegate = (ClientConsumerDelegate)consState.getDelegate();
+
+ // create a new consumer over the new session for each consumer on the old session
+ ClientConsumerDelegate newConsDelegate = (ClientConsumerDelegate)newDelegate.
+ createConsumerDelegate((JBossDestination)consState.getDestination(),
+ consState.getSelector(),
+ consState.isNoLocal(),
+ consState.getSubscriptionName(),
+ consState.isConnectionConsumer(),
+ consState.getChannelID());
+ log.debug(this + " created new consumer " + newConsDelegate);
+
+ consDelegate.synchronizeWith(newConsDelegate);
+ log.debug(this + " synchronized failover consumer " + consDelegate);
}
- else if (child instanceof ConsumerState)
+ else if (child instanceof ProducerState)
{
- handleFailoverOnConsumer((ClientConnectionDelegate)getParent().getDelegate(),
- (ConsumerState)child, newDelegate);
+ ProducerState prodState = (ProducerState)child;
+ ClientProducerDelegate prodDelegate = (ClientProducerDelegate)prodState.getDelegate();
+
+ // create a new producer over the new session for each producer on the old session
+ ClientProducerDelegate newProdDelegate = (ClientProducerDelegate)newDelegate.
+ createProducerDelegate((JBossDestination)prodState.getDestination());
+ log.debug(this + " created new producer " + newProdDelegate);
+
+ prodDelegate.synchronizeWith(newProdDelegate);
+ log.debug(this + " synchronized failover producer " + prodDelegate);
}
else if (child instanceof BrowserState)
{
@@ -199,7 +220,7 @@
ResourceManager rm = connState.getResourceManager();
// We need to failover from one session ID to another in the resource manager
- rm.handleFailover(connState.getServerID(), oldSessionID, newState.sessionId);
+ rm.handleFailover(connState.getServerID(), oldSessionID, newState.sessionID);
List ackInfos = Collections.EMPTY_LIST;
@@ -254,7 +275,7 @@
// Transacted session - we need to get the acks from the resource manager. BTW we have
// kept the old resource manager
- ackInfos = rm.getDeliveriesForSession(getSessionId());
+ ackInfos = rm.getDeliveriesForSession(getSessionID());
}
if (!ackInfos.isEmpty())
@@ -275,12 +296,12 @@
recoveryInfos.add(recInfo);
}
- log.debug(this + " sending delivery recovery info: " + recoveryInfos);
+ log.debug(this + " sending delivery recovery " + recoveryInfos + " on failover");
nd.recoverDeliveries(recoveryInfos);
}
else
{
- log.debug(this + " no delivery recovery info to send");
+ log.debug(this + " no delivery recovery info to send on failover");
}
}
@@ -368,14 +389,14 @@
callbackHandlers.remove(new Integer(handler.getConsumerId()));
}
- public int getSessionId()
+ public int getSessionID()
{
- return sessionId;
+ return sessionID;
}
public String toString()
{
- return "SessionState[" + sessionId + "]";
+ return "SessionState[" + sessionID + "]";
}
// Package protected ----------------------------------------------------------------------------
@@ -385,96 +406,6 @@
// Private --------------------------------------------------------------------------------------
/**
- * TODO See http://jira.jboss.org/jira/browse/JBMESSAGING-708
- */
- private void handleFailoverOnConsumer(ClientConnectionDelegate failedConnectionDelegate,
- ConsumerState failedConsumerState,
- ClientSessionDelegate newSessionDelegate)
-
- throws Exception
- {
- log.debug(this + " failing over consumer " + failedConsumerState);
-
- CallbackManager oldCallbackManager =
- failedConnectionDelegate.getRemotingConnection().getCallbackManager();
-
- ClientConsumerDelegate failedConsumerDelegate =
- (ClientConsumerDelegate)failedConsumerState.getDelegate();
-
- log.debug(this + " creating alternate consumer");
-
- ClientConsumerDelegate newConsumerDelegate = (ClientConsumerDelegate)newSessionDelegate.
- createConsumerDelegate((JBossDestination)failedConsumerState.getDestination(),
- failedConsumerState.getSelector(),
- failedConsumerState.isNoLocal(),
- failedConsumerState.getSubscriptionName(),
- failedConsumerState.isConnectionConsumer(),
- failedConsumerState.getChannelId());
-
- log.debug(this + " alternate consumer created");
-
- // Copy the attributes from the new consumer to the old consumer
- failedConsumerDelegate.synchronizeWith(newConsumerDelegate);
-
- ConsumerState newState = (ConsumerState)newConsumerDelegate.getState();
-
- int oldConsumerID = failedConsumerState.getConsumerID();
-
- // Update attributes on the old state
- failedConsumerState.copyState(newState);
-
- // We need to re-use the existing message callback handler
-
- MessageCallbackHandler oldHandler =
- oldCallbackManager.unregisterHandler(oldConsumerID);
-
- ConnectionState newConnectionState = (ConnectionState)failedConnectionDelegate.getState();
-
- CallbackManager newCallbackManager =
- newConnectionState.getRemotingConnection().getCallbackManager();
-
- // Remove the new handler
- MessageCallbackHandler newHandler = newCallbackManager.
- unregisterHandler(newState.getConsumerID());
-
- log.debug("New handler is " + System.identityHashCode(newHandler));
-
- //But we need to update some fields from the new one
- oldHandler.copyState(newHandler);
-
- //Now we re-register the old handler with the new callback manager
-
- newCallbackManager.registerHandler(newState.getConsumerID(),
- oldHandler);
-
- // We don't need to add the handler to the session state since it is already there - we
- // are re-using the old handler
-
- log.debug(this + " failed over consumer");
- }
-
-
- /**
- * TODO see http://jira.jboss.org/jira/browse/JBMESSAGING-709
- */
- private void handleFailoverOnProducer(ProducerState failedProducerState,
- ClientSessionDelegate failedSessionDelegate)
- throws Exception
- {
- ClientProducerDelegate newProducerDelegate = (ClientProducerDelegate)failedSessionDelegate.
- createProducerDelegate((JBossDestination)failedProducerState.getDestination());
-
- ClientProducerDelegate failedProducerDelegate =
- (ClientProducerDelegate)failedProducerState.getDelegate();
-
- failedProducerDelegate.synchronizeWith(newProducerDelegate);
- failedProducerState.copyState((ProducerState)newProducerDelegate.getState());
-
- log.debug("handling fail over on producerDelegate " + failedProducerDelegate + " destination=" + failedProducerState.getDestination());
- }
-
-
- /**
* TODO see http://jira.jboss.org/jira/browse/JBMESSAGING-710
*/
private void handleFailoverOnBrowser(BrowserState failedBrowserState,
Modified: trunk/src/main/org/jboss/jms/server/JMSCondition.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/JMSCondition.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/JMSCondition.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -35,94 +35,107 @@
*/
public class JMSCondition implements Condition
{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final String QUEUE_PREFIX = "queue.";
+ private static final String TOPIC_PREFIX = "topic.";
+
+ // Static ---------------------------------------------------------------------------------------
+
+
+ // Attributes -----------------------------------------------------------------------------------
+
private boolean queue;
-
private String name;
-
- private static final String QUEUE_PREFIX = "queue.";
-
- private static final String TOPIC_PREFIX = "topic.";
-
- //Cache the hash code
+
+ // cache the hash code
private int hash = -1;
-
+
+ // Constructors ---------------------------------------------------------------------------------
+
public JMSCondition(boolean queue, String name)
{
this.queue = queue;
-
this.name = name;
}
-
+
public JMSCondition(String text)
{
if (text.startsWith(QUEUE_PREFIX))
{
queue = true;
-
name = text.substring(QUEUE_PREFIX.length());
}
else if (text.startsWith(TOPIC_PREFIX))
{
queue = false;
-
name = text.substring(TOPIC_PREFIX.length());
}
else
{
throw new IllegalArgumentException("Illegal text: " + text);
}
-
}
-
+
+ // Condition implementation ---------------------------------------------------------------------
+
+ public boolean matches(Condition routingCondition, MessageReference ref)
+ {
+ return equals(routingCondition);
+ }
+
+ public String toText()
+ {
+ return (queue ? QUEUE_PREFIX : TOPIC_PREFIX) + name;
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
public boolean isQueue()
{
return queue;
}
-
+
public String getName()
{
return name;
}
- public boolean matches(Condition routingCondition, MessageReference ref)
- {
- return equals(routingCondition);
- }
-
public boolean equals(Object other)
{
if (!(other instanceof JMSCondition))
{
return false;
}
-
+
JMSCondition jmsCond = (JMSCondition)other;
-
+
return ((jmsCond.queue == this.queue) && (jmsCond.name.equals(this.name)));
}
-
+
public int hashCode()
{
if (hash == -1)
- {
+ {
hash = 17;
-
hash = 37 * hash + (queue ? 0 : 1);
-
hash = 37 * hash + name.hashCode();
}
-
- return hash;
+
+ return hash;
}
- public String toText()
- {
- return (queue ? QUEUE_PREFIX : TOPIC_PREFIX) + name;
- }
-
public String toString()
{
return toText();
}
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -164,6 +164,11 @@
String defaultQueueJNDIContext,
String defaultTopicJNDIContext) throws Exception
{
+ if (serverPeerID < 0)
+ {
+ throw new IllegalArgumentException("ID cannot be negative");
+ }
+
this.serverPeerID = serverPeerID;
this.defaultQueueJNDIContext = defaultQueueJNDIContext;
this.defaultTopicJNDIContext = defaultTopicJNDIContext;
Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedQueue.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -30,6 +30,7 @@
import org.jboss.jms.server.JMSCondition;
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.plugin.postoffice.Binding;
+import org.jboss.logging.Logger;
/**
* A ManagedQueue
@@ -44,47 +45,72 @@
*/
public class ManagedQueue extends ManagedDestination
{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ManagedQueue.class);
+
+ // Static ---------------------------------------------------------------------------------------
+
+ private static boolean trace = log.isTraceEnabled();
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
public ManagedQueue()
- {
+ {
}
-
+
public ManagedQueue(String name, int fullSize, int pageSize, int downCacheSize)
{
super(name, fullSize, pageSize, downCacheSize);
}
+ // ManagedDestination overrides -----------------------------------------------------------------
+
+ public boolean isQueue()
+ {
+ return true;
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
public int getMessageCount() throws Exception
{
JMSCondition queueCond = new JMSCondition(true, name);
-
+
Binding binding = (Binding)postOffice.listBindingsForCondition(queueCond).iterator().next();
-
+
if (binding == null)
{
throw new IllegalStateException("Cannot find binding for queue:" + name);
}
-
+
Queue queue = binding.getQueue();
- return queue.messageCount();
+ int count = queue.getMessageCount();
+
+ if (trace) { log.trace(this + " returning MessageCount = " + count); }
+
+ return count;
}
-
+
public void removeAllMessages() throws Throwable
{
JMSCondition queueCond = new JMSCondition(true, name);
-
+
Binding binding = (Binding)postOffice.listBindingsForCondition(queueCond).iterator().next();
-
+
if (binding == null)
{
throw new IllegalStateException("Cannot find binding for queue:" + name);
}
-
+
Queue queue = binding.getQueue();
queue.removeAllReferences();
}
-
+
public List listMessages(String selector) throws Exception
{
if (selector != null)
@@ -95,19 +121,19 @@
selector = null;
}
}
-
+
JMSCondition queueCond = new JMSCondition(true, name);
-
+
Binding binding = (Binding)postOffice.listBindingsForCondition(queueCond).iterator().next();
-
+
if (binding == null)
{
throw new IllegalStateException("Cannot find binding for queue:" + name);
}
-
+
Queue queue = binding.getQueue();
- try
+ try
{
List msgs;
if (selector == null)
@@ -128,8 +154,17 @@
}
}
- public boolean isQueue()
+ public String toString()
{
- return true;
+ return "ManagedQueue[" + name + "]";
}
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/server/destination/QueueService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -59,7 +59,7 @@
{
if (!started)
{
- log.warn("Queue is stopped.");
+ log.warn("Queue is stopped");
return 0;
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/Ack.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/Ack.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/Ack.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -32,5 +32,5 @@
*/
public interface Ack
{
- long getDeliveryId();
+ long getDeliveryID();
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ConnectionFactoryEndpoint.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -36,7 +36,11 @@
* $Id$
*/
public interface ConnectionFactoryEndpoint
-{
+{
+ /**
+ * @param failedNodeID - zero or positive values mean the connection creation attempt is result
+ * of failover. Negative values are ignored (mean regular connection creation attempt).
+ */
CreateConnectionResult createConnectionDelegate(String username,
String password,
int failedNodeID)
Modified: trunk/src/main/org/jboss/jms/server/endpoint/DefaultAck.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/DefaultAck.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/DefaultAck.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -32,15 +32,42 @@
*/
public class DefaultAck implements Ack
{
- private long deliveryId;
-
+
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private long deliveryID;
+
+ // Constructors ---------------------------------------------------------------------------------
+
public DefaultAck(long deliveryId)
{
- this.deliveryId = deliveryId;
+ this.deliveryID = deliveryId;
}
-
- public long getDeliveryId()
+
+ // Ack implementation ---------------------------------------------------------------------------
+
+ public long getDeliveryID()
{
- return deliveryId;
+ return deliveryID;
}
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public String toString()
+ {
+ return "ACK[" + deliveryID + "]";
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -127,12 +127,12 @@
public String toString()
{
- return "Delivery[" + getDeliveryId() + ", " + msg + "]";
+ return "Delivery[" + getDeliveryID() + ", " + msg + "]";
}
// Ack Implementation -------------------------------------------
- public long getDeliveryId()
+ public long getDeliveryID()
{
return msg.getDeliveryId();
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -52,6 +52,7 @@
import org.jboss.jms.util.ToString;
import org.jboss.logging.Logger;
import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.Routable;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PostOffice;
import org.jboss.messaging.core.tx.Transaction;
@@ -70,70 +71,66 @@
*/
public class ServerConnectionEndpoint implements ConnectionEndpoint
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ServerConnectionEndpoint.class);
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- private boolean trace = log.isTraceEnabled();
-
+ private static boolean trace = log.isTraceEnabled();
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private int id;
+
private volatile boolean closed;
-
private volatile boolean started;
- private int id;
-
- private String remotingClientSessionId;
-
- private String jmsClientVMId;
-
private String clientID;
-
- // Map<sessionID - ServerSessionEndpoint>
- private Map sessions;
-
- private Set temporaryDestinations;
-
private String username;
-
private String password;
+ private String remotingClientSessionId;
+ private String jmsClientVMId;
+
// the server itself
private ServerPeer serverPeer;
-
// access to server's extensions
private PostOffice postOffice;
-
private SecurityManager sm;
-
private ConnectionManager cm;
-
private TransactionRepository tr;
-
private MessageStore ms;
-
private ServerInvokerCallbackHandler callbackHandler;
-
- private byte usingVersion;
-
+
+ // Map<sessionID - ServerSessionEndpoint>
+ private Map sessions;
+
+ // Set<?>
+ private Set temporaryDestinations;
+
private int prefetchSize;
-
private int defaultTempQueueFullSize;
-
private int defaultTempQueuePageSize;
-
private int defaultTempQueueDownCacheSize;
- // Constructors --------------------------------------------------
-
+ private byte usingVersion;
+
+ // a non-null value here means connection is a fail-over connection
+ private Integer failedNodeID;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ /**
+ * @param failedNodeID - zero or positive values mean connection creation attempt is result of
+ * failover. Negative values are ignored (mean regular connection creation attempt).
+ */
protected ServerConnectionEndpoint(ServerPeer serverPeer, String clientID,
String username, String password, int prefetchSize,
int defaultTempQueueFullSize,
int defaultTempQueuePageSize,
- int defaultTempQueueDownCacheSize) throws Exception
+ int defaultTempQueueDownCacheSize,
+ int failedNodeID) throws Exception
{
this.serverPeer = serverPeer;
@@ -158,9 +155,14 @@
this.username = username;
this.password = password;
+
+ if (failedNodeID > 0)
+ {
+ this.failedNodeID = new Integer(failedNodeID);
+ }
}
- // ConnectionDelegate implementation -----------------------------
+ // ConnectionDelegate implementation ------------------------------------------------------------
public SessionDelegate createSessionDelegate(boolean transacted,
int acknowledgmentMode,
@@ -169,7 +171,7 @@
{
try
{
- log.debug("creating session " + (transacted ? "transacted" :"non transacted")+ ", " + ToString.acknowledgmentMode(acknowledgmentMode) + ", " + (isXA ? "XA": "non XA"));
+ log.debug(this + " creating " + (transacted ? "transacted" : "non transacted") + " session, " + ToString.acknowledgmentMode(acknowledgmentMode) + ", " + (isXA ? "XA": "non XA"));
if (closed)
{
@@ -192,13 +194,14 @@
Integer iSessionID = new Integer(sessionID);
serverPeer.addSession(iSessionID, ep);
-
+
JMSDispatcher.instance.registerTarget(iSessionID, sessionAdvised);
+ log.debug("created and registered " + ep);
+
ClientSessionDelegate d = new ClientSessionDelegate(sessionID);
log.debug("created " + d);
- log.debug("created and registered " + ep);
return d;
}
@@ -354,7 +357,7 @@
if (request.getRequestType() == TransactionRequest.ONE_PHASE_COMMIT_REQUEST)
{
- if (trace) { log.trace("one phase commit request received"); }
+ if (trace) { log.trace(this + " received ONE_PHASE_COMMIT request"); }
Transaction tx = tr.createTransaction();
processTransaction(request.getState(), tx);
@@ -362,7 +365,7 @@
}
else if (request.getRequestType() == TransactionRequest.TWO_PHASE_PREPARE_REQUEST)
{
- if (trace) { log.trace("Two phase commit prepare request received"); }
+ if (trace) { log.trace(this + " received TWO_PHASE_COMMIT prepare request"); }
Transaction tx = tr.createTransaction(request.getXid());
processTransaction(request.getState(), tx);
@@ -370,7 +373,7 @@
}
else if (request.getRequestType() == TransactionRequest.TWO_PHASE_COMMIT_REQUEST)
{
- if (trace) { log.trace("Two phase commit commit request received"); }
+ if (trace) { log.trace(this + " received TWO_PHASE_COMMIT commit request"); }
Transaction tx = tr.getPreparedTx(request.getXid());
if (trace) { log.trace("Committing " + tx); }
@@ -378,13 +381,15 @@
}
else if (request.getRequestType() == TransactionRequest.TWO_PHASE_ROLLBACK_REQUEST)
{
- if (trace) { log.trace("Two phase commit rollback request received"); }
+ if (trace) { log.trace(this + " received TWO_PHASE_COMMIT rollback request"); }
- //For 2pc rollback - we just don't cancel any messages back to the channel
- //this is driven from the client side
+ // for 2pc rollback - we just don't cancel any messages back to the channel; this is
+ // driven from the client side.
- Transaction tx = tr.getPreparedTx(request.getXid());
- if (trace) { log.trace("Rolling back " + tx); }
+ Transaction tx = tr.getPreparedTx(request.getXid());
+
+ if (trace) { log.trace(this + " rolling back " + tx); }
+
tx.rollback();
}
@@ -420,7 +425,7 @@
throw new IllegalStateException("isClosed should never be handled on the server side");
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public String getUsername()
{
@@ -487,7 +492,7 @@
return "ConnectionEndpoint[" + id + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
byte getUsingVersion()
{
@@ -579,10 +584,19 @@
JBossDestination dest = (JBossDestination)msg.getJMSDestination();
// This allows the no-local consumers to filter out the messages that come from the same
- // connection
+ // connection.
+
// TODO Do we want to set this for ALL messages. Optimisation is possible here.
msg.setConnectionID(id);
-
+
+ // messages arriving over a failed-over connections will be give preferential treatment by
+ // routers, which will send them directly to their corresponding failover queues, not to
+ // the "local" queues, to reduce clutter and unnecessary "pull policy" revving.
+ if (failedNodeID != null)
+ {
+ msg.putHeader(Routable.FAILED_NODE_ID, failedNodeID);
+ }
+
// We must reference the message *before* we send it the destination to be handled. This is
// so we can guarantee that the message doesn't disappear from the store before the
// handling is complete. Each channel then takes copies of the reference if they decide to
@@ -617,9 +631,9 @@
if (trace) { log.trace("sent " + msg); }
}
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private void setStarted(boolean s) throws Throwable
{
@@ -637,39 +651,37 @@
private void processTransaction(ClientTransaction txState, Transaction tx) throws Throwable
{
- if (trace) { log.trace(tx + " :processing transaction"); }
+ if (trace) { log.trace(this + " processing transaction " + tx); }
synchronized (sessions)
{
for (Iterator i = txState.getSessionStates().iterator(); i.hasNext(); )
{
SessionTxState sessionState = (SessionTxState)i.next();
+
+ // send the messages
- List msgs = sessionState.getMsgs();
-
- for (Iterator i2 = msgs.iterator(); i2.hasNext(); )
+ for (Iterator j = sessionState.getMsgs().iterator(); j.hasNext(); )
{
- JBossMessage msg = (JBossMessage)i2.next();
-
- sendMessage(msg, tx);
+ sendMessage((JBossMessage)j.next(), tx);
}
+
+ // send the acks
- List acks = sessionState.getAcks();
+ // We need to lookup the session in a global map maintained on the server peer. We can't
+ // just assume it's one of the sessions in the connection. This is because in the case
+ // of a connection consumer, the message might be delivered through one connection and
+ // the transaction committed/rolledback through another. ConnectionConsumers suck.
- //We need to lookup the session in a global map maintained on the server peer.
- //We can't just assume it's one of the sessions in the connection.
- //This is because in the case of a connection consumer, the message might be delivered through one
- //connection and the transaction committed/rolledback through another.
- //ConnectionConsumers suck.
-
- ServerSessionEndpoint session = serverPeer.getSession(new Integer(sessionState.getSessionId()));
-
- session.acknowledgeTransactionally(acks, tx);
+ ServerSessionEndpoint session =
+ serverPeer.getSession(new Integer(sessionState.getSessionId()));
+
+ session.acknowledgeTransactionally(sessionState.getAcks(), tx);
}
}
- if (trace) { log.trace(tx + " :Processed transaction"); }
+ if (trace) { log.trace(this + " processed transaction " + tx); }
}
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -43,13 +43,13 @@
*/
public class ServerConnectionFactoryEndpoint implements ConnectionFactoryEndpoint
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ServerConnectionFactoryEndpoint.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private ServerPeer serverPeer;
@@ -68,7 +68,7 @@
protected int defaultTempQueueDownCacheSize;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
/**
* @param jndiBindings - names under which the corresponding JBossConnectionFactory is bound in
@@ -92,8 +92,12 @@
this.defaultTempQueueDownCacheSize = defaultTempQueueDownCacheSize;
}
- // ConnectionFactoryDelegate implementation ----------------------
-
+ // ConnectionFactoryDelegate implementation -----------------------------------------------------
+
+ /**
+ * @param failedNodeID - zero or positive values mean connection creation attempt is result of
+ * failover. Negative values are ignored (mean regular connection creation attempt).
+ */
public CreateConnectionResult createConnectionDelegate(String username,
String password,
int failedNodeID)
@@ -101,10 +105,12 @@
{
try
{
- if (failedNodeID == -1)
+ if (failedNodeID < 0)
{
// Just a standard createConnection
- return new CreateConnectionResult(createConnectionDelegateInternal(username, password));
+ ConnectionDelegate cd =
+ createConnectionDelegateInternal(username, password, failedNodeID);
+ return new CreateConnectionResult(cd);
}
else
{
@@ -116,15 +122,16 @@
if (failoverNodeID == -1 || failoverNodeID != serverPeer.getServerPeerID())
{
- //We are on the wrong node - or no failover has occurred
+ log.debug(this + " realized that we are on the wrong node or no failover has occured");
return new CreateConnectionResult(failoverNodeID);
}
else
{
- //We are on the right node, and failover has completed
- //we can now create a connection delegate
- return new CreateConnectionResult(createConnectionDelegateInternal(username,
- password));
+ log.debug(this + " received notification that server-side failover completed, " +
+ "creating connection delegate ...");
+ ConnectionDelegate cd =
+ createConnectionDelegateInternal(username, password, failedNodeID);
+ return new CreateConnectionResult(cd);
}
}
}
@@ -134,8 +141,14 @@
}
}
-
- private ConnectionDelegate createConnectionDelegateInternal(String username, String password)
+
+ /**
+ * @param failedNodeID - zero or positive values mean connection creation attempt is result of
+ * failover. Negative values are ignored (mean regular connection creation attempt).
+ */
+ private ConnectionDelegate createConnectionDelegateInternal(String username,
+ String password,
+ int failedNodeID)
throws Exception
{
log.debug("creating a new connection for user " + username);
@@ -160,7 +173,7 @@
ServerConnectionEndpoint endpoint =
new ServerConnectionEndpoint(serverPeer, clientID, username, password, prefetchSize,
defaultTempQueueFullSize, defaultTempQueuePageSize,
- defaultTempQueueDownCacheSize);
+ defaultTempQueueDownCacheSize, failedNodeID);
int connectionID = endpoint.getConnectionID();
@@ -185,7 +198,7 @@
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public int getID()
{
@@ -202,11 +215,11 @@
return "ConnectionFactoryEndpoint[" + id + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -170,8 +170,7 @@
// This is ok to have outside lock - is volatile
if (!clientAccepting)
{
- if (trace) { log.trace(this + " the client is not currently accepting messages"); }
-
+ if (trace) { log.trace(this + "'s client is NOT accepting messages!"); }
return null;
}
@@ -328,23 +327,22 @@
public void changeRate(float newRate) throws JMSException
{
- if (trace) { log.trace(this + " changeRate: " + newRate); }
+ if (trace) { log.trace(this + " changing rate to " + newRate); }
try
{
- //For now we just support a binary on/off
- //The client will send newRate = 0, to say it does not want any more messages when it's client side
- //buffer gets full
- //or it will send an arbitrary non zero number to say it does want more messages, when it's client side
- //buffer empties to half it's full size.
- //Note the client does not wait until the client side buffer is empty before sending a newRate(+ve)
- //message since this would add extra latency.
+ // For now we just support a binary on/off.
+ // The client will send newRate = 0, to say it does not want any more messages when its
+ // client side buffer gets full or it will send an arbitrary non zero number to say it
+ // does want more messages, when its client side buffer empties to half its full size.
+ // Note the client does not wait until the client side buffer is empty before sending a
+ // newRate(+ve) message since this would add extra latency.
- //In the future we can fine tune this by allowing the client to specify an actual rate in the newRate value
- //so this is basically a placeholder for the future so we don't have to change the wire format when
- //we support it
+ // In the future we can fine tune this by allowing the client to specify an actual rate in
+ // the newRate value so this is basically a placeholder for the future so we don't have to
+ // change the wire format when we support it.
- //No need to synchronize - clientAccepting is volatile
+ // No need to synchronize - clientAccepting is volatile
if (newRate == 0)
{
@@ -353,7 +351,6 @@
else
{
clientAccepting = true;
-
promptDelivery();
}
}
@@ -475,35 +472,35 @@
}
started = false;
-
- /*
- *
- Any message deliveries already transit to the consumer, will just
- be ignored by the MessageCallbackHandler since it will be closed
-
- To clarify, the close protocol (from connection) is as follows:
-
- 1) MessageCallbackHandler::close() - any messages in buffer are cancelled to the server session, and any
- subsequent receive messages will be ignored
-
- 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to deliver to the client callback handler
-
- 3) MessageCallbackHandler::cancelInflightMessages(long lastDeliveryId) - any deliveries after lastDeliveryId
- for the consumer will be considered in flight and cancelled.
-
- 4) ServerConsumerEndpoint:close() - endpoint is deregistered
-
- 5) Session.close() - acks or cancels any remaining deliveries in the SessionState as appropriate
-
- 6) ServerSessionEndpoint::close() - cancels any remaining deliveries and deregisters session
-
- 7) Client side session executor is shutdown
-
- 8) ServerConnectionEndpoint::close() - connection is deregistered.
-
- 9) Remoting connection listener is removed and remoting connection stopped.
-
- */
+
+ // Any message deliveries already transit to the consumer, will just be ignored by the
+ // MessageCallbackHandler since it will be closed.
+ //
+ // To clarify, the close protocol (from connection) is as follows:
+ //
+ // 1) MessageCallbackHandler::close() - any messages in buffer are cancelled to the server
+ // session, and any subsequent receive messages will be ignored.
+ //
+ // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to
+ // deliver to the client callback handler.
+ //
+ // 3) MessageCallbackHandler::cancelInflightMessages(long lastDeliveryId) - any deliveries
+ // after lastDeliveryId for the consumer will be considered in flight and cancelled.
+ //
+ // 4) ServerConsumerEndpoint:close() - endpoint is deregistered.
+ //
+ // 5) Session.close() - acks or cancels any remaining deliveries in the SessionState as
+ // appropriate.
+ //
+ // 6) ServerSessionEndpoint::close() - cancels any remaining deliveries and deregisters
+ // session.
+ //
+ // 7) Client side session executor is shutdown.
+ //
+ // 8) ServerConnectionEndpoint::close() - connection is deregistered.
+ //
+ // 9) Remoting connection listener is removed and remoting connection stopped.
+
}
}
@@ -513,7 +510,7 @@
private void promptDelivery()
{
- messageQueue.deliver(false);
+ messageQueue.deliver(Channel.ASYNCRHONOUS);
}
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -86,15 +86,17 @@
/**
* The server side representation of a JMS session.
*
- * A user must not invoke methods of a session concurrently on different threads, however
- * there are situations where multiple threads may access this object concurrently, for instance:
+ * A user must not invoke methods of a session concurrently on different threads, however there are
+ * situations where multiple threads may access this object concurrently, for instance:
+ * - A session can be closed when it's connection is closed by the user which might be called on a
+ * different thread.
+ * - A session can be closed when the server determines the connection is dead.
+ *
+ * If the session represents a connection consumer's session then the connection consumer will farm
+ * off messages to different sessions obtained from a pool, these may then cancel/ack etc on
+ * different threads, but the acks/cancels/etc will end up back here on the connection consumer
+ * session instance.
*
- * A session can be closed when it's connection is closed by the user which might be called on a different thread
- * A session can be closed when the server determines the connection is dead.
- * If the session represents a connection consumer's session then the connection consumer will farm off
- * messages to different sessions obtained from a pool, these may then cancel/ack etc on different threads, but
- * the acks/cancels/etc will end up back here on the connection consumer session instance.
- *
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
@@ -104,13 +106,13 @@
*/
public class ServerSessionEndpoint implements SessionEndpoint
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ServerSessionEndpoint.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
@@ -138,13 +140,13 @@
private Queue defaultDLQ;
private Queue defaultExpiryQueue;
- // Map < deliveryId, Delivery>
+ // Map <deliveryID, Delivery>
private Map deliveries;
private SynchronizedLong deliveryIdSequence;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
ServerSessionEndpoint(int sessionID, ServerConnectionEndpoint connectionEndpoint)
throws Exception
@@ -177,30 +179,29 @@
deliveryIdSequence = new SynchronizedLong(0);
}
- // SessionDelegate implementation --------------------------------
+ // SessionDelegate implementation ---------------------------------------------------------------
public ConsumerDelegate createConsumerDelegate(JBossDestination jmsDestination,
String selectorString,
boolean noLocal,
String subscriptionName,
boolean isCC,
- long failoverChannelId) throws JMSException
+ long failoverChannelID) throws JMSException
{
try
{
- if (failoverChannelId == -1)
+ if (failoverChannelID == -1)
{
- //Standard createConsumerDelegate
-
- return createConsumerDelegateInternal(jmsDestination, selectorString, noLocal, subscriptionName,
- isCC);
+ // Standard createConsumerDelegate
+ return createConsumerDelegateInternal(jmsDestination, selectorString,
+ noLocal, subscriptionName);
}
else
{
- //Failover of consumer
-
- return failoverConsumer(jmsDestination, selectorString, noLocal, subscriptionName,
- isCC, failoverChannelId);
+ // Failover of consumer
+ return createFailoverConsumerDelegateInternal(jmsDestination, selectorString,
+ noLocal, subscriptionName,
+ failoverChannelID);
}
}
catch (Throwable t)
@@ -355,7 +356,7 @@
public void acknowledgeDeliveries(List acks) throws JMSException
{
- if (trace) {log.trace(this + " acknowledgeDeliveries " + acks); }
+ if (trace) {log.trace(this + " acknowledges deliveries " + acks); }
try
{
@@ -393,7 +394,7 @@
public void cancelDeliveries(List cancels) throws JMSException
{
- if (trace) {log.trace(this + " cancelDeliveries " + cancels); }
+ if (trace) {log.trace(this + " cancels deliveries " + cancels); }
try
{
@@ -424,7 +425,8 @@
public void recoverDeliveries(List deliveryRecoveryInfos) throws JMSException
{
- if (trace) { log.trace(this + "recovering deliveries " + deliveryRecoveryInfos); }
+ if (trace) { log.trace(this + "recovers deliveries " + deliveryRecoveryInfos); }
+
try
{
if (postOffice.isLocal())
@@ -689,7 +691,7 @@
throw new IllegalStateException("isClosed should never be handled on the server side");
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public ServerConnectionEndpoint getConnectionEndpoint()
{
@@ -701,7 +703,7 @@
return "SessionEndpoint[" + id + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
void expireDelivery(Delivery del, Queue expiryQueue) throws Throwable
{
@@ -895,7 +897,7 @@
{
Ack ack = (Ack)iter.next();
- Long id = new Long(ack.getDeliveryId());
+ Long id = new Long(ack.getDeliveryID());
DeliveryRecord rec = (DeliveryRecord)deliveries.get(id);
@@ -932,9 +934,9 @@
}
}
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private Delivery cancelDeliveryInternal(Cancel cancel) throws Throwable
{
@@ -1034,39 +1036,41 @@
}
}
-
private void acknowledgeDeliveryInternal(Ack ack) throws Throwable
{
- if (trace) { log.trace(this + " acknowledging delivery " + ack.getDeliveryId()); }
+ if (trace) { log.trace(this + " acknowledging delivery " + ack); }
- DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(ack.getDeliveryId()));
+ DeliveryRecord rec = (DeliveryRecord)deliveries.remove(new Long(ack.getDeliveryID()));
if (rec == null)
{
- throw new IllegalStateException("Cannot find delivery to acknowledge: " + ack.getDeliveryId());
+ throw new IllegalStateException("Cannot find " + ack + " to acknowledge");
}
rec.del.acknowledge(null);
}
-
-
- private ConsumerDelegate failoverConsumer(JBossDestination jmsDestination,
- String selectorString,
- boolean noLocal, String subscriptionName,
- boolean connectionConsumer,
- long oldChannelID) throws Exception
+ private ConsumerDelegate createFailoverConsumerDelegateInternal(JBossDestination jmsDestination,
+ String selectorString,
+ boolean noLocal,
+ String subscriptionName,
+ long oldChannelID)
+ throws Exception
{
+ log.debug(this + " creating FAILOVER consumer for failed channel " +
+ oldChannelID + " for " + jmsDestination +
+ (selectorString == null ? "" : ", selector '" + selectorString + "'") +
+ (subscriptionName == null ? "" : ", subscription '" + subscriptionName + "'") +
+ (noLocal ? ", noLocal" : ""));
+
// fail over channel
if (postOffice.isLocal())
{
- throw new IllegalStateException("Cannot failover on a non clustered post office!");
+ throw new IllegalStateException("Cannot failover on a non-clustered post office!");
}
- log.debug(this + " failing over consumer");
-
- // this is a Clustered operation... so postOffice here must be Clustered
Binding binding = ((ClusteredPostOffice)postOffice).getBindingforChannelId(oldChannelID);
+
if (binding == null)
{
throw new IllegalStateException("Can't find failed over channel " + oldChannelID);
@@ -1074,33 +1078,41 @@
if (trace)
{
- long newChannelID =
- binding.getQueue() instanceof RemoteQueueStub ?
- ((RemoteQueueStub)binding.getQueue()).getChannelID() :
- ((PagingFilteredQueue)binding.getQueue()).getChannelID();
+ long newChannelID;
- log.trace(this + "failing over from channel " + oldChannelID + " to channel " + newChannelID);
+ if (binding.getQueue() instanceof RemoteQueueStub)
+ {
+ newChannelID = ((RemoteQueueStub)binding.getQueue()).getChannelID();
+ }
+ else
+ {
+ newChannelID = ((PagingFilteredQueue)binding.getQueue()).getChannelID();
+ }
+
+ log.trace(this + " failing over from channel " + oldChannelID + " to channel " + newChannelID);
}
int consumerID = connectionEndpoint.getServerPeer().getNextObjectID();
int prefetchSize = connectionEndpoint.getPrefetchSize();
- ManagedDestination dest =
- sp.getDestinationManager().getDestination(jmsDestination.getName(), jmsDestination.isQueue());
+ ManagedDestination dest = sp.getDestinationManager().
+ getDestination(jmsDestination.getName(), jmsDestination.isQueue());
if (dest == null)
{
- throw new IllegalStateException("Cannot find managed destination for dest: " + jmsDestination);
+ throw new IllegalStateException("Cannot find managed destination for " + jmsDestination);
}
- Queue dlqToUse = dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
+ Queue dlqToUse =
+ dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
- Queue expiryQueueToUse = dest.getExpiryQueue() == null ? defaultExpiryQueue : dest.getExpiryQueue();
+ Queue expiryQueueToUse =
+ dest.getExpiryQueue() == null ? defaultExpiryQueue : dest.getExpiryQueue();
ServerConsumerEndpoint ep =
- new ServerConsumerEndpoint(consumerID, binding.getQueue(),
- binding.getQueue().getName(), this, selectorString, noLocal,
- jmsDestination, dlqToUse, expiryQueueToUse);
+ new ServerConsumerEndpoint(consumerID, binding.getQueue(), binding.getQueue().getName(),
+ this, selectorString, noLocal, jmsDestination, dlqToUse,
+ expiryQueueToUse);
JMSDispatcher.instance.registerTarget(new Integer(consumerID), new ConsumerAdvised(ep));
@@ -1119,8 +1131,8 @@
private ConsumerDelegate createConsumerDelegateInternal(JBossDestination jmsDestination,
String selectorString,
boolean noLocal,
- String subscriptionName,
- boolean isCC) throws Throwable
+ String subscriptionName)
+ throws Throwable
{
if (closed)
{
@@ -1407,7 +1419,7 @@
}
}
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
/*
* Holds a record of a delivery - we need to store the consumer id as well
Modified: trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/server/remoting/JMSWireFormat.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -245,7 +245,7 @@
Ack ack = (Ack)mi.getArguments()[0];
- dos.writeLong(ack.getDeliveryId());
+ dos.writeLong(ack.getDeliveryID());
dos.flush();
@@ -266,7 +266,7 @@
while (iter.hasNext())
{
Ack ack = (Ack)iter.next();
- dos.writeLong(ack.getDeliveryId());
+ dos.writeLong(ack.getDeliveryID());
}
dos.flush();
Modified: trunk/src/main/org/jboss/jms/tx/ClientTransaction.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/tx/ClientTransaction.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -34,7 +34,6 @@
import org.jboss.jms.server.endpoint.Ack;
import org.jboss.jms.server.endpoint.DefaultAck;
import org.jboss.jms.server.endpoint.DeliveryInfo;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.message.MessageFactory;
/**
@@ -46,8 +45,6 @@
{
// Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(ClientTransaction.class);
-
public final static byte TX_OPEN = 0;
public final static byte TX_ENDED = 1;
@@ -152,37 +149,39 @@
}
/*
- * Substitute newSessionId for oldSessionId
+ * Substitute newSessionID for oldSessionID
*/
- public void handleFailover(int newServerId, int oldSessionId, int newSessionId)
+ public void handleFailover(int newServerID, int oldSessionID, int newSessionID)
{
if (!clientSide)
{
throw new IllegalStateException("Cannot call this method on the server side");
}
- //Note we have to do this in one go since there may be overlap between old and new session ids
- //and we don't want to overwrite keys in the map
+
+ // Note we have to do this in one go since there may be overlap between old and new session
+ // IDs and we don't want to overwrite keys in the map.
if (sessionStatesMap != null)
{
- Iterator iter = sessionStatesMap.values().iterator();
-
- while (iter.hasNext())
+ for(Iterator i = sessionStatesMap.values().iterator(); i.hasNext();)
{
- SessionTxState state = (SessionTxState)iter.next();
-
- state.handleFailover(newServerId, oldSessionId, newSessionId);
+ SessionTxState state = (SessionTxState)i.next();
+ state.handleFailover(newServerID, oldSessionID, newSessionID);
}
}
}
-
- public List getDeliveriesForSession(int sessionId)
+
+ /**
+ * May return an empty list, but never null.
+ */
+ public List getDeliveriesForSession(int sessionID)
{
if (!clientSide)
{
throw new IllegalStateException("Cannot call this method on the server side");
}
- SessionTxState state = getSessionTxState(sessionId);
+
+ SessionTxState state = getSessionTxState(sessionID);
if (state != null)
{
@@ -190,7 +189,7 @@
}
else
{
- return null;
+ return Collections.EMPTY_LIST;
}
}
@@ -323,9 +322,19 @@
public class SessionTxState
{
- SessionTxState(int sessionId)
+ private int sessionID;
+
+ // We record the server id when doing failover to avoid overwriting the sesion ID again
+ // if multiple connections fail on the same resource mamanger but fail onto old values of the
+ // session ID. This prevents the ID being failed over more than once for the same server.
+ private int serverID = -1;
+
+ private List msgs = new ArrayList();
+ private List acks = new ArrayList();
+
+ SessionTxState(int sessionID)
{
- this.sessionId = sessionId;
+ this.sessionID = sessionID;
}
void addMessage(JBossMessage msg)
@@ -350,28 +359,24 @@
public int getSessionId()
{
- return sessionId;
+ return sessionID;
}
- void handleFailover(int newServerId, int oldSessionId, int newSessionId)
+ void handleFailover(int newServerID, int oldSessionID, int newSessionID)
{
- if (this.sessionId == oldSessionId && this.serverId != newServerId)
+ if (sessionID == oldSessionID && serverID != newServerID)
{
- this.sessionId = newSessionId;
+ sessionID = newSessionID;
+ serverID = newServerID;
- this.serverId = newServerId;
-
- //Remove any non persistent acks
-
- Iterator iter = acks.iterator();
-
- while (iter.hasNext())
+ // Remove any non persistent acks
+ for(Iterator i = acks.iterator(); i.hasNext(); )
{
- DeliveryInfo info = (DeliveryInfo)iter.next();
+ DeliveryInfo di = (DeliveryInfo)i.next();
- if (!info.getMessageProxy().getMessage().isReliable())
+ if (!di.getMessageProxy().getMessage().isReliable())
{
- iter.remove();
+ i.remove();
}
}
}
@@ -383,16 +388,6 @@
msgs.clear();
}
- private int sessionId;
-
- //we record the server id when doing failover to avoid overwriting the sesion id again
- //if multiple connections fail on the same resource mamanger but fail onto old values of the session id
- //this prevents the id being failed over more than once for the same server
- private int serverId = -1;
-
- private List msgs = new ArrayList();
-
- private List acks = new ArrayList();
}
}
Modified: trunk/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/tx/ResourceManager.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -63,25 +63,25 @@
*/
public class ResourceManager
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
private ConcurrentHashMap transactions = new ConcurrentHashMap();
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ResourceManager.class);
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
ResourceManager()
{
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
/*
* Merge another resource manager into this one - used in failover
@@ -119,51 +119,42 @@
* @param xid - The id of the transaction to add the message to
* @param m The message
*/
- public void addMessage(Object xid, int sessionId, JBossMessage msg)
+ public void addMessage(Object xid, int sessionId, JBossMessage m)
{
if (trace) { log.trace("addding message for xid " + xid); }
ClientTransaction tx = getTxInternal(xid);
- tx.addMessage(sessionId, msg);
+ tx.addMessage(sessionId, m);
}
/*
- * Failover session from old session id -> new session id
+ * Failover session from old session ID -> new session ID
*/
- public void handleFailover(int newServerId, int oldSessionId, int newSessionId)
+ public void handleFailover(int newServerID, int oldSessionID, int newSessionID)
{
- Iterator iter = this.transactions.values().iterator();
-
- while (iter.hasNext())
+ for(Iterator i = this.transactions.values().iterator(); i.hasNext(); )
{
- ClientTransaction tx = (ClientTransaction)iter.next();
-
- tx.handleFailover(newServerId, oldSessionId, newSessionId);
+ ClientTransaction tx = (ClientTransaction)i.next();
+ tx.handleFailover(newServerID, oldSessionID, newSessionID);
}
}
/*
- * Get all the deliveries corresponding to the session id
+ * Get all the deliveries corresponding to the session ID
*/
- public List getDeliveriesForSession(int sessionId)
+ public List getDeliveriesForSession(int sessionID)
{
- Iterator iter = this.transactions.values().iterator();
-
List ackInfos = new ArrayList();
-
- while (iter.hasNext())
+
+ for(Iterator i = transactions.values().iterator(); i.hasNext(); )
{
- ClientTransaction tx = (ClientTransaction)iter.next();
+ ClientTransaction tx = (ClientTransaction)i.next();
+ List acks = tx.getDeliveriesForSession(sessionID);
- List acks = tx.getDeliveriesForSession(sessionId);
-
- if (acks != null)
- {
- ackInfos.addAll(acks);
- }
+ ackInfos.addAll(acks);
}
-
+
return ackInfos;
}
@@ -190,14 +181,14 @@
public void commitLocal(LocalTx xid, ConnectionDelegate connection) throws JMSException
{
- if (trace) { log.trace("commiting local xid " + xid); }
+ if (trace) { log.trace("committing " + xid); }
ClientTransaction tx = this.getTxInternal(xid);
- //Invalid xid
+ // Invalid xid
if (tx == null)
{
- throw new IllegalStateException("Cannot find transaction with xid:" + xid);
+ throw new IllegalStateException("Cannot find transaction " + xid);
}
TransactionRequest request =
@@ -207,18 +198,17 @@
{
connection.sendTransaction(request);
- //If we get this far we can remove the transaction
+ // If we get this far we can remove the transaction
this.removeTxInternal(xid);
}
catch (Throwable t)
{
- //If a problem occurs during commit processing the session should be rolled back
+ // If a problem occurs during commit processing the session should be rolled back
rollbackLocal(xid, connection);
JMSException e = new MessagingTransactionRolledBackException(t.getMessage());
e.initCause(t);
-
throw e;
}
}
@@ -264,17 +254,15 @@
{
Map.Entry entry = (Map.Entry)iter.next();
- Object xid = entry.getKey();
-
ClientTransaction tx = (ClientTransaction)entry.getValue();
if (tx.getState() == ClientTransaction.TX_PREPARED)
{
List dels = tx.getDeliveriesForSession(sessionId);
- if (dels != null && !dels.isEmpty())
+ if (!dels.isEmpty())
{
- //There are outstanding prepared acks in this session
+ // There are outstanding prepared acks in this session
return true;
}
@@ -283,9 +271,9 @@
return false;
}
- // Protected ------------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Package Private ------------------------------------------------
+ // Package Private ------------------------------------------------------------------------------
void commit(Xid xid, boolean onePhase, ConnectionDelegate connection) throws XAException
{
@@ -557,7 +545,7 @@
}
}
- // Private --------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private ClientTransaction getTxInternal(Object xid)
{
@@ -629,6 +617,6 @@
}
}
- // Inner Classes --------------------------------------------------
+ // Inner Classes --------------------------------------------------------------------------------
}
Modified: trunk/src/main/org/jboss/jms/util/ToString.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/ToString.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/jms/util/ToString.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -65,6 +65,10 @@
{
return "DUPS_OK_ACKNOWLEDGE";
}
+ if (ack == Session.SESSION_TRANSACTED)
+ {
+ return "SESSION_TRANSACTED";
+ }
return "UNKNOWN";
}
Modified: trunk/src/main/org/jboss/messaging/core/Channel.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/Channel.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/Channel.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -46,6 +46,8 @@
*/
public interface Channel extends DeliveryObserver, Distributor, Receiver
{
+ public final boolean SYNCHRONOUS = true;
+ public final boolean ASYNCRHONOUS = false;
/**
* @return the unique ID of the channel
@@ -89,8 +91,8 @@
List browse(Filter filter);
/**
- * Delivers as many references as possible to it's router until no more deliveries are returned
- *
+ * Delivers as many references as possible to its router until no more deliveries are returned.
+ * @param synchronous - one of Channel.SYNCHRONOUS, Channel.ASYNCRHONOUS.
*/
void deliver(boolean synchronous);
@@ -110,9 +112,9 @@
* Message amount.
* @return message amount.
*/
- int messageCount();
+ int getMessageCount();
- int deliveringCount();
+ int getDeliveringCount();
/**
* Remove all the references in the channel
Modified: trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -58,13 +58,13 @@
*/
public abstract class ChannelSupport implements Channel
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(ChannelSupport.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
@@ -97,7 +97,7 @@
//Suggest that we have a glag that disables this for production systems
protected SynchronizedInt deliveringCount;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
protected ChannelSupport(long channelID, MessageStore ms,
PersistenceManager pm,
@@ -135,7 +135,7 @@
deliveringCount = new SynchronizedInt(0);
}
- // Receiver implementation ---------------------------------------
+ // Receiver implementation ----------------------------------------------------------------------
public Delivery handle(DeliveryObserver sender, MessageReference ref, Transaction tx)
{
@@ -171,7 +171,7 @@
}
}
- // DeliveryObserver implementation --------------------------
+ // DeliveryObserver implementation --------------------------------------------------------------
public void acknowledge(Delivery d, Transaction tx) throws Throwable
{
@@ -187,7 +187,7 @@
this.executor.execute(new CancelRunnable(d));
}
- // Distributor implementation ------------------------------------
+ // Distributor implementation -------------------------------------------------------------------
public boolean add(Receiver r)
{
@@ -236,7 +236,7 @@
return router.numberOfReceivers();
}
- // Channel implementation ----------------------------------------
+ // Channel implementation -----------------------------------------------------------------------
public long getChannelID()
{
@@ -297,12 +297,12 @@
{
future = new Future();
}
- //TODO we should keep track of how many deliveries are currently in the queue
- //so we don't execute another delivery when one is in the queue, since
- //this is pointless
- this.executor.execute(new DeliveryRunnable(future));
+ //TODO we should keep track of how many deliveries are currently in the queue so we don't
+ // execute another delivery when one is in the queue, since this is pointless.
+ executor.execute(new DeliveryRunnable(future));
+
if (synchronous)
{
// Wait to complete
@@ -393,15 +393,15 @@
/**
* Returns the count of messages stored AND being delivered.
*/
- public int messageCount()
+ public int getMessageCount()
{
synchronized (refLock)
{
- return messageRefs.size() + deliveringCount();
+ return messageRefs.size() + getDeliveringCount();
}
}
- public int deliveringCount()
+ public int getDeliveringCount()
{
return deliveringCount.get();
}
@@ -474,7 +474,7 @@
return dels;
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
//Only used for testing
public int memoryRefCount()
@@ -492,9 +492,9 @@
return "ChannelSupport[" + channelID + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
/*
* This methods delivers as many messages as possible to the router until no
@@ -533,8 +533,7 @@
if (del == null)
{
// No receiver, broken receiver or full receiver so we stop delivering
- if (trace) { log.trace(this + ": no delivery returned for message" + ref + " so no receiver got the message. Delivery is now complete"); }
-
+ if (trace) { log.trace(this + " got no delivery for " + ref + " so no receiver got the message. Stopping delivery."); }
break;
}
else if (!del.isSelectorAccepted())
@@ -550,7 +549,7 @@
}
else
{
- if (trace) { log.trace(this + ": " + del + " returned for message:" + ref); }
+ if (trace) { log.trace(this + ": " + del + " returned for message " + ref); }
// Receiver accepted the reference
@@ -772,7 +771,7 @@
if (trace){ log.trace(this + " added " + ref + " non-transactionally in memory"); }
}
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private void removeReference(ListIterator iter) throws Exception
{
@@ -821,7 +820,7 @@
return ref;
}
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
private class InMemoryCallback implements TxCallback, Runnable
{
@@ -1062,11 +1061,11 @@
}
}
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
- // Inner classes -------------------------------------------------
+ // Inner classes --------------------------------------------------------------------------------
protected class DeliveryRunnable implements Runnable
{
@@ -1079,7 +1078,7 @@
public void run()
{
- try
+ try
{
if (router.numberOfReceivers() > 0)
{
Modified: trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -158,18 +158,15 @@
active = true;
}
- // Receiver implementation
- // -----------------------------------------------------------------
-
-
- // Channel implementation
- // ---------------------------------------------------------------
-
- public int messageCount()
+ // Receiver implementation ----------------------------------------------------------------------
+
+ // Channel implementation -----------------------------------------------------------------------
+
+ public int getMessageCount()
{
- int count = super.messageCount();
+ int count = super.getMessageCount();
- //Also need to add the paged refs
+ // Also need to add the paged refs
synchronized (refLock)
{
@@ -179,7 +176,7 @@
return count;
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
//Only used in testing
public int downCacheCount()
@@ -289,7 +286,7 @@
}
}
- // Protected -------------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
protected void loadPagedReferences(long number) throws Exception
{
@@ -538,7 +535,7 @@
if (trace) { log.trace(this + " cleared downcache"); }
}
- // Private ------------------------------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private MessageReference addFromRefInfo(ReferenceInfo info, Map refMap)
{
Modified: trunk/src/main/org/jboss/messaging/core/Routable.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/Routable.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/Routable.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -48,6 +48,8 @@
static final String REPLICATOR_ID = "REPLICATOR_ID";
static final String COLLECTOR_ID = "COLLECTOR_ID";
+ static final String FAILED_NODE_ID = "FAILED_NODE_ID";
+
long getMessageID();
/**
Modified: trunk/src/main/org/jboss/messaging/core/plugin/contract/PostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/contract/PostOffice.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/contract/PostOffice.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -74,13 +74,12 @@
/**
* Route a reference.
- * @param ref
- * @param condition The message will be routed to a queue if specified condition matches the condition
- * of the binding
- *
- * @param tx The transaction or null if not in the context of a transaction
- * @return true if ref was accepted by at least one queue
- * @throws Exception
+ *
+ * @param condition - the message will be routed to a queue if specified condition matches the
+ * condition of the binding.
+ * @param tx - the transaction or null if not in the context of a transaction.
+ *
+ * @return true if reference was accepted by at least one queue.
*/
boolean route(MessageReference ref, Condition condition, Transaction tx) throws Exception;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -100,16 +100,17 @@
{
if (toString == null)
{
- StringBuffer sb = new StringBuffer("Binding[");
+ StringBuffer sb = new StringBuffer("[");
sb.append(nodeID).append(',');
- sb.append(queue).append('(');
- sb.append(queue.getClass().getName()).append(')');
-
- if (condition != null)
- {
- sb.append(", condition: ").append(condition);
- }
+ sb.append(queue);
+// sb.append('(');
+// sb.append(queue.getClass().getName()).append(')');
+//
+// if (condition != null)
+// {
+// sb.append(", condition: ").append(condition);
+// }
sb.append("]");
toString = sb.toString();
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBindings.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBindings.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBindings.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -43,6 +43,7 @@
// Attributes ----------------------------------------------------
+ // List<Binding>
private List bindings;
private int durableCount;
@@ -100,7 +101,10 @@
public String toString()
{
- return "Bindings[" + Integer.toHexString(hashCode()) + ", count=" + bindings.size() + "]";
+ StringBuffer sb = new StringBuffer("LocalBindings[");
+ sb.append(bindings);
+ sb.append(']');
+ return sb.toString();
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -94,7 +94,7 @@
// Map <NodeID, Map<queueName, Binding>>
protected Map nameMaps;
- // Map <condition, List<Binding>>
+ // Map <Condition, Bindings>
protected Map conditionMap;
protected FilterFactory filterFactory;
@@ -283,7 +283,7 @@
/**
* Internal methods (e.g. failOver) will already hold a lock and will need to call
- * getBindingForQueueNames without a lock. (Also... I dind't move this method to the protected
+ * getBindingForQueueNames() without a lock. (Also... I dind't move this method to the protected
* section of the code as this is related to getBindingForQueueNames).
*/
protected Binding internalGetBindingForQueueName(String queueName)
@@ -491,11 +491,8 @@
while (rs.next())
{
int nodeId = rs.getInt(1);
-
String queueName = rs.getString(2);
-
String conditionText = rs.getString(3);
-
String selector = rs.getString(4);
if (rs.wasNull())
@@ -504,17 +501,18 @@
}
long channelId = rs.getLong(5);
-
boolean failed = rs.getString(6).equals("Y");
- log.info("PostOffice " + this.officeName + " nodeId=" + nodeId + " condition=" + conditionText + " queueName=" + queueName + " channelId=" + channelId + " selector=" + selector);
+ log.info("PostOffice " + this.officeName + " nodeId=" +
+ nodeId + " condition=" + conditionText + " queueName=" +
+ queueName + " channelId=" + channelId + " selector=" + selector);
Condition condition = conditionFactory.createCondition(conditionText);
- Binding binding = this.createBinding(nodeId, condition, queueName, channelId, selector, true, failed);
+ Binding binding =
+ createBinding(nodeId, condition, queueName, channelId, selector, true, failed);
binding.getQueue().deactivate();
-
addBinding(binding);
}
}
@@ -538,33 +536,33 @@
}
}
- protected Binding createBinding(int nodeId, Condition condition, String queueName, long channelId, String filterString, boolean durable, boolean failed) throws Exception
+ protected Binding createBinding(int nodeID, Condition condition, String queueName,
+ long channelId, String filterString, boolean durable,
+ boolean failed) throws Exception
{
-
Filter filter = filterFactory.createFilter(filterString);
-
- return createBinding(nodeId, condition, queueName, channelId, filter, durable, failed);
+ return createBinding(nodeID, condition, queueName, channelId, filter, durable, failed);
}
- protected Binding createBinding(int nodeId, Condition condition, String queueName, long channelId, Filter filter, boolean durable, boolean failed)
+ protected Binding createBinding(int nodeID, Condition condition, String queueName,
+ long channelID, Filter filter, boolean durable,
+ boolean failed)
{
Queue queue;
- if (nodeId == this.currentNodeId)
+
+ if (nodeID == currentNodeId)
{
QueuedExecutor executor = (QueuedExecutor)pool.get();
-
- queue = new PagingFilteredQueue(queueName, channelId, ms, pm, true,
- true, executor, filter);
+ queue =
+ new PagingFilteredQueue(queueName, channelID, ms, pm, true, true, executor, filter);
}
else
{
- throw new IllegalStateException("This is a non clustered post office - should not have bindings from different nodes!");
+ throw new IllegalStateException("This is a non clustered post office - should not " +
+ "have bindings from different nodes!");
}
- Binding binding = new DefaultBinding(nodeId, condition, queue, failed);
-
- return binding;
-
+ return new DefaultBinding(nodeID, condition, queue, failed);
}
protected void insertBinding(Binding binding) throws Exception
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredBindings.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredBindings.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredBindings.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -24,6 +24,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.Iterator;
import org.jboss.messaging.core.plugin.postoffice.Binding;
import org.jboss.messaging.core.plugin.postoffice.DefaultBindings;
@@ -48,7 +49,7 @@
// Attributes ----------------------------------------------------
- // Map <name, router>
+ // Map <name, ClusterRouter>
private Map nameMap;
private int thisNode;
private int localDurableCount;
@@ -119,7 +120,19 @@
public String toString()
{
- return "CusteredBindings[" + super.toString() + " count=" + nameMap.size() + "]";
+ StringBuffer sb = new StringBuffer();
+ sb.append(super.toString());
+ sb.append(":ClusteredBindings[");
+ for(Iterator i = nameMap.keySet().iterator(); i.hasNext();)
+ {
+ sb.append(i.next());
+ if (i.hasNext())
+ {
+ sb.append(',');
+ }
+ }
+ sb.append("]");
+ return sb.toString();
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -595,8 +595,8 @@
nodeId + ", queue " + queueName);
}
- binding =
- createBinding(nodeId, condition, queueName, channelID, filterString, durable, failed);
+ binding = createBinding(nodeId, condition, queueName, channelID,
+ filterString, durable, failed, null);
addBinding(binding);
}
@@ -700,7 +700,8 @@
}
}
- public void routeFromCluster(org.jboss.messaging.core.Message message, String routingKeyText,
+ public void routeFromCluster(org.jboss.messaging.core.Message message,
+ String routingKeyText,
Map queueNameNodeIdMap) throws Exception
{
if (trace) { log.trace(this + " routing from cluster " + message + ", routing key " + routingKeyText + ", map " + queueNameNodeIdMap); }
@@ -1158,7 +1159,7 @@
if (cb != null)
{
- if (trace) { log.trace(this + " found clustered bindings " + cb); }
+ if (trace) { log.trace(this + " found " + cb); }
if (tx == null && ref.isReliable())
{
@@ -1190,6 +1191,8 @@
{
ClusterRouter router = (ClusterRouter)i.next();
+ if (trace) { log.trace(this + " sending " + ref + " to " + router); }
+
Delivery del = router.handle(null, ref, tx);
if (del != null && del.isSelectorAccepted())
@@ -1646,22 +1649,42 @@
}
}
- protected Binding createBinding(int nodeId, Condition condition, String queueName, long channelId, Filter filter, boolean durable, boolean failed)
+ protected Binding createBinding(int nodeId, Condition condition, String queueName,
+ long channelId, String filterString, boolean durable,
+ boolean failed, Integer failedNodeID) throws Exception
{
+ Filter filter = filterFactory.createFilter(filterString);
+ return createBinding(nodeId, condition, queueName, channelId,
+ filter, durable, failed, failedNodeID);
+ }
+
+ protected Binding createBinding(int nodeID, Condition condition, String queueName,
+ long channelId, Filter filter, boolean durable,
+ boolean failed, Integer failedNodeID)
+ {
Queue queue;
- if (nodeId == this.currentNodeId)
+
+ if (nodeID == currentNodeId)
{
QueuedExecutor executor = (QueuedExecutor)pool.get();
- queue = new LocalClusteredQueue(this, nodeId, queueName, channelId, ms, pm, true,
- durable, executor, filter, tr);
+ if (failedNodeID == null)
+ {
+ queue = new LocalClusteredQueue(this, nodeID, queueName, channelId, ms, pm, true,
+ durable, executor, filter, tr);
+ }
+ else
+ {
+ queue = new FailedOverQueue(this, nodeID, queueName, channelId, ms, pm, true,
+ durable, executor, filter, tr, failedNodeID.intValue());
+ }
}
else
{
- queue = new RemoteQueueStub(nodeId, queueName, channelId, durable, pm, filter);
+ queue = new RemoteQueueStub(nodeID, queueName, channelId, durable, pm, filter);
}
- return new DefaultBinding(nodeId, condition, queue, failed);
+ return new DefaultBinding(nodeID, condition, queue, failed);
}
// Private -------------------------------------------------------
@@ -1670,8 +1693,10 @@
throws Exception
{
BindRequest request =
- new BindRequest(this.currentNodeId, queue.getName(), condition.toText(), queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
- binding.getQueue().getChannelID(), queue.isRecoverable(), binding.isFailed());
+ new BindRequest(this.currentNodeId, queue.getName(), condition.toText(),
+ queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
+ binding.getQueue().getChannelID(), queue.isRecoverable(),
+ binding.isFailed());
syncSendRequest(request);
}
@@ -1881,22 +1906,19 @@
if (trace) { log.trace(this + " received " + state.getBindings().size() + " bindings and map " + state.getReplicatedData()); }
nameMaps.clear();
-
conditionMap.clear();
List bindings = state.getBindings();
-
Iterator iter = bindings.iterator();
while (iter.hasNext())
{
BindingInfo info = (BindingInfo)iter.next();
-
Condition condition = conditionFactory.createCondition(info.getConditionText());
+ Binding binding =
+ createBinding(info.getNodeId(), condition, info.getQueueName(), info.getChannelId(),
+ info.getFilterString(), info.isDurable(), info.isFailed(), null);
- Binding binding = this.createBinding(info.getNodeId(), condition, info.getQueueName(), info.getChannelId(),
- info.getFilterString(), info.isDurable(),info.isFailed());
-
if (binding.getNodeID() == this.currentNodeId)
{
//We deactivate if this is one of our own bindings - it can only
@@ -2062,9 +2084,6 @@
* This method fails over all the queues from node <failedNodeId> onto this node. It is triggered
* when a JGroups view change occurs due to a member leaving and it's determined the member
* didn't leave cleanly.
- *
- * @param failedNodeID
- * @throws Exception
*/
private void performFailover(Integer failedNodeID) throws Exception
{
@@ -2143,8 +2162,7 @@
// Sanity check
if (queue.isLocal())
{
- throw new IllegalStateException("Queue " + binding.getQueue().getName() +
- " is local!");
+ throw new IllegalStateException("Queue " + queue.getName() + " is local!");
}
namesToRemove.add(entry);
@@ -2168,17 +2186,17 @@
log.debug(this + " deleted binding for " + queueName);
// Note we do not need to send an unbind request across the cluster - this is because
- // when the node crashes a view change will hit the other nodes and that will cause all
- // binding data for that node to be removed anyway.
+ // when the node crashes a view change will hit the other nodes and that will cause
+ // all binding data for that node to be removed anyway.
// If there is already a queue registered with the same name, then we set a flag
// "failed" on the binding and then the queue will go into a special list of failed
// bindings otherwise we treat at as a normal queue.
- // This is because we cannot deal with more than one queue with the same name. Any new
- // consumers will always only connect to queues in the main name map. This may mean that
- // queues in the failed map have messages stranded in them if consumers disconnect
- // (since no more can reconnect). However we message redistribution activated other
- // queues will be able to consume from them.
+ // This is because we cannot deal with more than one queue with the same name. Any
+ // new consumers will always only connect to queues in the main name map. This may
+ // mean that queues in the failed map have messages stranded in them if consumers
+ // disconnect (since no more can reconnect). However we message redistribution
+ // activated other queues will be able to consume from them.
//TODO allow message redistribution for queues in the failed list
@@ -2195,9 +2213,10 @@
}
// Create a new binding
- Binding newBinding = createBinding(currentNodeId, binding.getCondition(),
- stub.getName(), stub.getChannelID(),
- stub.getFilter(), stub.isRecoverable(), failed);
+ Binding newBinding =
+ createBinding(currentNodeId, binding.getCondition(), stub.getName(),
+ stub.getChannelID(), stub.getFilter(), stub.isRecoverable(),
+ failed, failedNodeID);
// Insert it into the database
insertBinding(newBinding);
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -30,6 +30,7 @@
import org.jboss.messaging.core.DeliveryObserver;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.Receiver;
+import org.jboss.messaging.core.Routable;
import org.jboss.messaging.core.tx.Transaction;
/**
@@ -41,6 +42,7 @@
* If there is no local queue, then it will round robin between the non local queues.
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @version <tt>$Revision: 1.1 $</tt>
*
* $Id$
@@ -48,26 +50,27 @@
*/
public class DefaultRouter implements ClusterRouter
{
- // Constants -----------------------------------------------------
+ // Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(DefaultRouter.class);
- // Static --------------------------------------------------------
+ // Static ---------------------------------------------------------------------------------------
- // Attributes ----------------------------------------------------
+ // Attributes -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
- // MUST be an arraylist for fast index access
+ // ArrayList<>; MUST be an arraylist for fast index access
private ArrayList nonLocalQueues;
+ // ArrayList<FailedOverQueue>; MUST be an arraylist for fast index access
private ArrayList failedOverQueues;
private ClusteredQueue localQueue;
private int target;
- // Constructors --------------------------------------------------
+ // Constructors ---------------------------------------------------------------------------------
public DefaultRouter()
{
@@ -75,43 +78,64 @@
failedOverQueues = new ArrayList();
}
- // Receiver implementation ---------------------------------------
+ // Receiver implementation ----------------------------------------------------------------------
- public Delivery handle(DeliveryObserver observer, MessageReference reference, Transaction tx)
+ public Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx)
{
- if (trace) { log.trace(this + " routing " + reference); }
+ if (trace) { log.trace(this + " routing " + ref); }
// Favour the local queue or the failedOver queue in round robin
if (!failedOverQueues.isEmpty())
{
- if (trace) { log.trace(this + " round robin on failedover queue, current target " + target);}
+ // If the message arrived over a failed-over connection, try to send the message to its
+ // corresponding "failed-over" queue.
- LocalClusteredQueue queueToUse = null;
+ Integer failedNodeID = (Integer)ref.getHeader(Routable.FAILED_NODE_ID);
- if (target == -1)
+ if (failedNodeID != null)
{
- queueToUse = (LocalClusteredQueue)this.localQueue;
+ Delivery del = null;
+
+ LocalClusteredQueue targetFailoverQueue = locateFailoverQueue(failedNodeID.intValue());
+
+ if (targetFailoverQueue != null)
+ {
+ del = targetFailoverQueue.handle(observer, ref, tx);
+ }
+
+ if (trace) { log.trace(this + " routed message to fail-over queue " + targetFailoverQueue + ", returned " + del) ;}
+
+ return del;
}
else
{
- queueToUse = (LocalClusteredQueue)failedOverQueues.get(target);
- }
+ LocalClusteredQueue queueToUse = null;
- incTargetFailedOver();
+ if (target == -1)
+ {
+ queueToUse = (LocalClusteredQueue)localQueue;
+ }
+ else
+ {
+ queueToUse = (LocalClusteredQueue)failedOverQueues.get(target);
+ }
- Delivery del = queueToUse.handle(observer, reference, tx);
+ incTargetFailedOver();
- if (trace) { log.trace(this + " routed to failed queue, using failedOver round robbing, returned " + del); }
+ Delivery del = queueToUse.handle(observer, ref, tx);
- return del;
+ if (trace) { log.trace(this + " routed message to failed queue, using failed-over round robbing, returned " + del); }
+
+ return del;
+ }
}
else if (localQueue != null)
{
// The only time the local queue won't accept is if the selector doesn't match, in which
// case it won't match at any other nodes too so no point in trying them
- Delivery del = localQueue.handle(observer, reference, tx);
+ Delivery del = localQueue.handle(observer, ref, tx);
if (trace) { log.trace(this + " routed to local queue, it returned " + del); }
@@ -125,7 +149,7 @@
{
ClusteredQueue queue = (ClusteredQueue)nonLocalQueues.get(target);
- Delivery del = queue.handle(observer, reference, tx);
+ Delivery del = queue.handle(observer, ref, tx);
if (trace) { log.trace(this + " routed to remote queue, it returned " + del); }
@@ -143,7 +167,7 @@
return null;
}
- // Distributor implementation ------------------------------------
+ // Distributor implementation -------------------------------------------------------------------
public boolean contains(Receiver queue)
{
@@ -207,7 +231,7 @@
}
- // ClusterRouter implementation ----------------------------------
+ // ClusterRouter implementation -----------------------------------------------------------------
public List getQueues()
{
@@ -260,7 +284,7 @@
return true;
}
- // Public --------------------------------------------------------
+ // Public ---------------------------------------------------------------------------------------
public int size()
{
@@ -272,11 +296,11 @@
return "Router[" + Integer.toHexString(hashCode()) + "]";
}
- // Package protected ---------------------------------------------
+ // Package protected ----------------------------------------------------------------------------
- // Protected -----------------------------------------------------
+ // Protected ------------------------------------------------------------------------------------
- // Private -------------------------------------------------------
+ // Private --------------------------------------------------------------------------------------
private void incTargetFailedOver()
{
@@ -299,8 +323,22 @@
}
}
- // Inner classes -------------------------------------------------
+ private FailedOverQueue locateFailoverQueue(int failedNodeID)
+ {
+ // TODO - this is a VERY slow sequential pass; I am sure we can come with a smarter way to
+ // locate the queue
+ for(int i = 0; i < failedOverQueues.size(); i++)
+ {
+ if (((FailedOverQueue)failedOverQueues.get(i)).getFailedNodeID() == failedNodeID)
+ {
+ return (FailedOverQueue)failedOverQueues.get(i);
+ }
+ }
+ return null;
+ }
+ // Inner classes --------------------------------------------------------------------------------
+
}
Added: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -0,0 +1,82 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.plugin.postoffice.cluster;
+
+import org.jboss.messaging.core.tx.TransactionRepository;
+import org.jboss.messaging.core.plugin.contract.PostOffice;
+import org.jboss.messaging.core.plugin.contract.MessageStore;
+import org.jboss.messaging.core.plugin.contract.PersistenceManager;
+import org.jboss.messaging.core.Filter;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+
+/**
+ *
+ * A LocalClusteredQueue
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class FailedOverQueue extends LocalClusteredQueue
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private int failedNodeID;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public FailedOverQueue(PostOffice office, int nodeID, String name, long id, MessageStore ms,
+ PersistenceManager pm, boolean acceptReliableMessages,
+ boolean recoverable, QueuedExecutor executor, Filter filter,
+ TransactionRepository tr, int fullSize, int pageSize, int downCacheSize,
+ int failedNodeID)
+ {
+ super(office, nodeID, name, id, ms, pm, acceptReliableMessages, recoverable,
+ executor, filter, tr, fullSize, pageSize, downCacheSize);
+
+ this.failedNodeID = failedNodeID;
+ }
+
+ public FailedOverQueue(PostOffice office, int nodeID, String name, long id, MessageStore ms,
+ PersistenceManager pm, boolean acceptReliableMessages,
+ boolean recoverable, QueuedExecutor executor, Filter filter,
+ TransactionRepository tr, int failedNodeID)
+ {
+ super(office, nodeID, name, id, ms, pm, acceptReliableMessages, recoverable,
+ executor, filter, tr);
+
+ this.failedNodeID = failedNodeID;
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public int getFailedNodeID()
+ {
+ return failedNodeID;
+ }
+
+ public String toString()
+ {
+ return "FailedOverQueue[" + getChannelID() + "/" + getName() +
+ "/failedNodeID=" + failedNodeID + "]";
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RemoteQueueStub.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RemoteQueueStub.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RemoteQueueStub.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -206,7 +206,7 @@
throw new UnsupportedOperationException();
}
- public int messageCount()
+ public int getMessageCount()
{
throw new UnsupportedOperationException();
}
@@ -288,7 +288,7 @@
return "RemoteQueueStub[" + channelID + "/" + name + " -> " + nodeID + "]";
}
- public int deliveringCount()
+ public int getDeliveringCount()
{
throw new UnsupportedOperationException();
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -181,7 +181,7 @@
throw new NotYetImplementedException();
}
- public int messageCount()
+ public int getMessageCount()
{
throw new NotYetImplementedException();
}
@@ -226,7 +226,7 @@
throw new UnsupportedOperationException();
}
- public int deliveringCount()
+ public int getDeliveringCount()
{
throw new UnsupportedOperationException();
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/local/base/PagingFilteredQueueTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/local/base/PagingFilteredQueueTestBase.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/local/base/PagingFilteredQueueTestBase.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -2307,7 +2307,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -2388,7 +2388,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -2401,14 +2401,14 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.commit();
assertTrue(queue.browse().isEmpty());
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(0, deliveringCount);
}
@@ -2437,7 +2437,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -2450,12 +2450,12 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.rollback();
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
// acknowledge non-transactionally
@@ -2687,7 +2687,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List received = r.getMessages();
@@ -2744,7 +2744,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List received = r.getMessages();
@@ -2757,7 +2757,7 @@
r.acknowledge(rm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.commit();
@@ -2962,7 +2962,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -3129,7 +3129,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List received = r.getMessages();
@@ -3307,7 +3307,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(NUMBER_OF_MESSAGES, deliveringCount);
assertEqualSets(refs, r.getMessages());
@@ -3358,7 +3358,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(NUMBER_OF_MESSAGES, deliveringCount);
assertEqualSets(refs, r.getMessages());
}
@@ -4855,7 +4855,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -4936,7 +4936,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -4949,7 +4949,7 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.commit();
@@ -4982,7 +4982,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -4995,12 +4995,12 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.rollback();
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
// acknowledge non-transactionally
@@ -5043,7 +5043,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -5086,7 +5086,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
Transaction tx = tr.createTransaction();
@@ -5098,7 +5098,7 @@
r.acknowledge(ackm, tx);
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
tx.commit();
@@ -5135,7 +5135,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
Transaction tx = tr.createTransaction();
@@ -5147,11 +5147,11 @@
r.acknowledge(ackm, tx);
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
tx.rollback();
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
// acknowledge non-transactionally
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -5197,7 +5197,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -5332,7 +5332,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -5345,7 +5345,7 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.commit();
@@ -5379,7 +5379,7 @@
assertTrue(delivery.isDone());
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -5392,12 +5392,12 @@
// transacted acknowledgment
r.acknowledge(ackm, tx);
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
tx.rollback();
- deliveringCount = queue.deliveringCount();
+ deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
// acknowledge non-transactionally
@@ -5441,7 +5441,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
@@ -5485,7 +5485,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
Transaction tx = tr.createTransaction();
@@ -5497,7 +5497,7 @@
r.acknowledge(ackm, tx);
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
tx.commit();
@@ -5534,7 +5534,7 @@
assertTrue(delivery.isDone());
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
Transaction tx = tr.createTransaction();
@@ -5546,11 +5546,11 @@
r.acknowledge(ackm, tx);
}
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
tx.rollback();
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
// acknowledge non-transactionally
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -5606,7 +5606,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -5659,7 +5659,7 @@
tx.commit();
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -5711,7 +5711,7 @@
tx.commit();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List acknowledging = r.getMessages();
@@ -5764,7 +5764,7 @@
tx.commit();
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -5817,7 +5817,7 @@
tx.commit();
- assertEquals(NUMBER_OF_MESSAGES, queue.deliveringCount());
+ assertEquals(NUMBER_OF_MESSAGES, queue.getDeliveringCount());
assertEqualSets(refs, r.getMessages());
for(Iterator i = r.getMessages().iterator(); i.hasNext();)
@@ -6193,7 +6193,7 @@
// receiver explicitely asks for message
receiver.requestMessages();
- int deliveringCount = queue.deliveringCount();
+ int deliveringCount = queue.getDeliveringCount();
assertEquals(1, deliveringCount);
List messages = receiver.getMessages();
@@ -6330,7 +6330,7 @@
// receiver explicitely asks for message
receiver.requestMessages();
- assertEquals(1, queue.deliveringCount());
+ assertEquals(1, queue.getDeliveringCount());
List messages = receiver.getMessages();
assertEquals(1, messages.size());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -105,7 +105,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -118,7 +118,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -160,7 +160,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -173,7 +173,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -214,7 +214,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -227,7 +227,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -268,7 +268,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -281,7 +281,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -312,7 +312,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -325,7 +325,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -336,9 +336,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -103,7 +103,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -116,7 +116,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -155,7 +155,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -168,7 +168,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -209,7 +209,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -222,7 +222,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -262,7 +262,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -275,7 +275,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -306,7 +306,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -319,7 +319,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -330,9 +330,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -107,7 +107,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -120,7 +120,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -161,7 +161,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -174,7 +174,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -216,7 +216,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -229,7 +229,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -270,7 +270,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -283,7 +283,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -314,7 +314,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -327,7 +327,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -338,9 +338,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -105,7 +105,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -121,7 +121,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -165,7 +165,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -181,7 +181,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -227,7 +227,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -243,7 +243,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -288,7 +288,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -304,7 +304,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -335,7 +335,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -348,7 +348,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -359,9 +359,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -107,7 +107,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -123,7 +123,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -165,7 +165,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -181,7 +181,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -225,7 +225,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -241,7 +241,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -284,7 +284,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -300,7 +300,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -331,7 +331,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -344,7 +344,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -355,9 +355,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -107,7 +107,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -123,7 +123,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -166,7 +166,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -182,7 +182,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -227,7 +227,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -243,7 +243,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -287,7 +287,7 @@
assertTrue(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -303,7 +303,7 @@
assertTrue(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -334,7 +334,7 @@
assertFalse(queue1.isPaging());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
//Queue2
@@ -347,7 +347,7 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Msgs
@@ -358,9 +358,9 @@
//Should be none left
- assertEquals(0, queue1.messageCount());
+ assertEquals(0, queue1.getMessageCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -111,7 +111,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -148,7 +148,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -186,7 +186,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -225,7 +225,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -263,7 +263,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -304,7 +304,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
// Send 100 more refs then roll back
tx = this.createXATx();
@@ -356,7 +356,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -398,7 +398,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -437,7 +437,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -471,7 +471,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -508,7 +508,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Consume one more
@@ -542,7 +542,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -576,7 +576,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -608,7 +608,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -640,7 +640,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -672,7 +672,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -710,7 +710,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -749,7 +749,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -789,7 +789,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -819,7 +819,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -854,7 +854,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
//Cancel 3 more
@@ -889,7 +889,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -926,7 +926,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
//Now there should be 120 message left to consume
@@ -955,7 +955,7 @@
assertFalse(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Consume the rest
@@ -980,7 +980,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -104,7 +104,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -136,7 +136,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -170,7 +170,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -206,7 +206,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -241,7 +241,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -279,7 +279,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -318,7 +318,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -357,7 +357,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -393,7 +393,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -427,7 +427,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -464,7 +464,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -501,7 +501,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -535,7 +535,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -567,7 +567,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -599,7 +599,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -631,7 +631,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -666,7 +666,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -702,7 +702,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -739,7 +739,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -771,7 +771,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -806,7 +806,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
@@ -843,7 +843,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -881,7 +881,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
assertEquals(0, queue.downCacheCount());
@@ -907,7 +907,7 @@
assertEquals(70, ms.size());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
assertEquals(0, queue.downCacheCount());
@@ -944,7 +944,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -109,7 +109,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -145,7 +145,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -182,7 +182,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -220,7 +220,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -257,7 +257,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -297,7 +297,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 100 more refs then roll back
tx = tr.createTransaction();
@@ -348,7 +348,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -389,7 +389,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -427,7 +427,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -461,7 +461,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -498,7 +498,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -534,7 +534,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -568,7 +568,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -600,7 +600,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -632,7 +632,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -664,7 +664,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -701,7 +701,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -739,7 +739,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -778,7 +778,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -809,7 +809,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -844,7 +844,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
@@ -881,7 +881,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -919,7 +919,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
//Now there should be 120 message left to consume
@@ -948,7 +948,7 @@
assertFalse(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Consume the rest
@@ -973,7 +973,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -114,7 +114,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -155,7 +155,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -199,7 +199,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -243,7 +243,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -285,7 +285,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -330,7 +330,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
// Send 100 more refs then roll back
tx = this.createXATx();
@@ -386,7 +386,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -432,7 +432,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -475,7 +475,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Consume 1
@@ -513,7 +513,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -555,7 +555,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -596,7 +596,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -635,7 +635,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -673,7 +673,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -711,7 +711,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -749,7 +749,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -791,7 +791,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -834,7 +834,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -879,7 +879,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -916,7 +916,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -957,7 +957,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
@@ -999,7 +999,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -1043,7 +1043,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -1080,7 +1080,7 @@
assertFalse(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -1110,7 +1110,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -110,7 +110,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -148,7 +148,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -189,7 +189,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref - should clear the down cache
@@ -227,7 +227,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -267,7 +267,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -310,7 +310,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -354,7 +354,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -398,7 +398,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -439,7 +439,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -478,7 +478,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -519,7 +519,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -560,7 +560,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -599,7 +599,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -637,7 +637,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -675,7 +675,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -712,7 +712,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -751,7 +751,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -791,7 +791,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -833,7 +833,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -870,7 +870,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -911,7 +911,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
@@ -952,7 +952,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -996,7 +996,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -1033,7 +1033,7 @@
assertFalse(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -1063,7 +1063,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -113,7 +113,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send one more ref
@@ -153,7 +153,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 9 more
@@ -196,7 +196,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -239,7 +239,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -280,7 +280,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -324,7 +324,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -369,7 +369,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Send 100 more refs then roll back
tx = tr.createTransaction();
@@ -423,7 +423,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -465,7 +465,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Consume 1
@@ -503,7 +503,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -545,7 +545,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -586,7 +586,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -625,7 +625,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -663,7 +663,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -701,7 +701,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -739,7 +739,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -780,7 +780,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -822,7 +822,7 @@
assertFalse(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -866,7 +866,7 @@
assertTrue(queue.isPaging());
//Verify no deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -903,7 +903,7 @@
assertTrue(queue.isPaging());
//Verify 20 deliveries
- assertEquals(20, queue.deliveringCount());;
+ assertEquals(20, queue.getDeliveringCount());;
@@ -944,7 +944,7 @@
assertTrue(queue.isPaging());
//Verify 13 deliveries
- assertEquals(13, queue.deliveringCount());;
+ assertEquals(13, queue.getDeliveringCount());;
@@ -986,7 +986,7 @@
assertTrue(queue.isPaging());
//Verify 10 deliveries
- assertEquals(10, queue.deliveringCount());;
+ assertEquals(10, queue.getDeliveringCount());;
@@ -1030,7 +1030,7 @@
assertTrue(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());;
+ assertEquals(0, queue.getDeliveringCount());;
@@ -1067,7 +1067,7 @@
assertFalse(queue.isPaging());
//Verify 0 deliveries
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
@@ -1097,7 +1097,7 @@
//Make sure there are no more refs in queue
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -107,7 +107,7 @@
assertTrue(queue.isPaging());
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Stop and restart the persistence manager
//All the paged refs will survive
@@ -140,7 +140,7 @@
assertEquals(0, queue2.downCacheCount());
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
this.consume(queue2, 100, refs, 100);
@@ -153,9 +153,9 @@
assertFalse(queue2.isPaging());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
}
@@ -203,7 +203,7 @@
assertTrue(queue.isPaging());
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
//Stop and restart the persistence manager
//Only the paged messages will survive
@@ -243,9 +243,9 @@
this.consume(queue2, 100, refs, 100);
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
- assertEquals(0, queue2.messageCount());
+ assertEquals(0, queue2.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
}
@@ -293,7 +293,7 @@
assertTrue(queue.isPaging());
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
queue.removeAllReferences();
@@ -309,9 +309,9 @@
assertFalse(queue.isPaging());
- assertEquals(0, queue.deliveringCount());
+ assertEquals(0, queue.getDeliveringCount());
- assertEquals(0, queue.messageCount());
+ assertEquals(0, queue.getMessageCount());
assertEquals(0, LockMap.instance.getSize());
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/DefaultPostOfficeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/DefaultPostOfficeTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/DefaultPostOfficeTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -984,10 +984,10 @@
receiver2.acknowledge(msgRec1, tx);
receiver2.acknowledge(msgRec2, tx);
- int deliveringCount = queue1.deliveringCount();
+ int deliveringCount = queue1.getDeliveringCount();
assertEquals(2, deliveringCount);
- deliveringCount = queue2.deliveringCount();
+ deliveringCount = queue2.getDeliveringCount();
assertEquals(2, deliveringCount);
tx.commit();
@@ -1041,21 +1041,21 @@
receiver2.acknowledge(msgRec1, tx);
receiver2.acknowledge(msgRec2, tx);
- deliveringCount = queue1.deliveringCount();
+ deliveringCount = queue1.getDeliveringCount();
assertEquals(2, deliveringCount);
- deliveringCount = queue2.deliveringCount();
+ deliveringCount = queue2.getDeliveringCount();
assertEquals(2, deliveringCount);
tx.rollback();
- deliveringCount = queue1.deliveringCount();
+ deliveringCount = queue1.getDeliveringCount();
assertEquals(2, deliveringCount);
receiver1.acknowledge(msgRec1, null);
receiver1.acknowledge(msgRec2, null);
- deliveringCount = queue2.deliveringCount();
+ deliveringCount = queue2.getDeliveringCount();
assertEquals(2, deliveringCount);
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOfficeTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -1875,7 +1875,7 @@
receivers[i].acknowledge(msgRec1, tx);
receivers[i].acknowledge(msgRec2, tx);
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
@@ -1935,7 +1935,7 @@
receivers[i].acknowledge(msgRec1, tx);
receivers[i].acknowledge(msgRec2, tx);
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
@@ -1963,7 +1963,7 @@
Message msgRec2 = (Message)msgs.get(1);
assertEquals(msg2.getMessageID(), msgRec2.getMessageID());
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
@@ -2120,7 +2120,7 @@
receivers[i].acknowledge(msgRec1, tx);
receivers[i].acknowledge(msgRec2, tx);
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
@@ -2184,7 +2184,7 @@
receivers[i].acknowledge(msgRec2, tx);
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
}
@@ -2213,7 +2213,7 @@
Message msgRec2 = (Message)msgs.get(1);
assertEquals(msg2.getMessageID(), msgRec2.getMessageID());
- int deliveringCount = queues[i].deliveringCount();
+ int deliveringCount = queues[i].getDeliveringCount();
assertEquals(2, deliveringCount);
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultMessagePullPolicyTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultMessagePullPolicyTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultMessagePullPolicyTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -310,7 +310,7 @@
}
- public int messageCount()
+ public int getMessageCount()
{
// TODO Auto-generated method stub
return 0;
@@ -382,7 +382,7 @@
}
- public int deliveringCount()
+ public int getDeliveringCount()
{
// TODO Auto-generated method stub
return 0;
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultRouterTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultRouterTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/DefaultRouterTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -516,7 +516,7 @@
}
- public int messageCount()
+ public int getMessageCount()
{
// TODO Auto-generated method stub
return 0;
@@ -619,7 +619,7 @@
}
- public int deliveringCount()
+ public int getDeliveringCount()
{
// TODO Auto-generated method stub
return 0;
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/RedistributionWithDefaultMessagePullPolicyTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/RedistributionWithDefaultMessagePullPolicyTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/RedistributionWithDefaultMessagePullPolicyTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -194,19 +194,19 @@
log.info("r2 " + receiver2.getMessages().size());
- log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
+ log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
assertEquals(0, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(0, queue2.memoryRefCount());
- assertEquals(1, queue2.deliveringCount());
+ assertEquals(1, queue2.getDeliveringCount());
this.acknowledgeAll(receiver2);
assertEquals(0, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertTrue(office1.getHoldingTransactions().isEmpty());
assertTrue(office2.getHoldingTransactions().isEmpty());
@@ -289,14 +289,14 @@
assertEquals(1, office1.getHoldingTransactions().size());
assertTrue(office2.getHoldingTransactions().isEmpty());
- log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
+ log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
assertEquals(0, queue1.memoryRefCount());
- assertEquals(1, queue1.deliveringCount());
+ assertEquals(1, queue1.getDeliveringCount());
assertEquals(0, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
//Now kill office 2 - this should cause office1 to remove the dead held transaction
@@ -308,7 +308,7 @@
//The delivery should be cancelled back to the queue too
assertEquals(1, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
}
@@ -389,11 +389,11 @@
assertEquals(1, office1.getHoldingTransactions().size());
assertTrue(office2.getHoldingTransactions().isEmpty());
- log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
+ log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
assertEquals(0, queue1.memoryRefCount());
- assertEquals(1, queue1.deliveringCount());
+ assertEquals(1, queue1.getDeliveringCount());
//Now kill office 2 - this should cause office1 to remove the dead held transaction
@@ -405,7 +405,7 @@
//The delivery should be committed
assertEquals(0, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
}
finally
@@ -486,14 +486,14 @@
assertTrue(office2.getHoldingTransactions().isEmpty());
assertTrue(office2.getHoldingTransactions().isEmpty());
- log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
+ log.info("queue1 refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2 refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
assertEquals(1, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(0, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
}
finally
{
@@ -561,26 +561,26 @@
//Check the sizes
log.info("Here are the sizes:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue5.memoryRefCount());
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
SimpleReceiver receiver = new SimpleReceiver("blah", SimpleReceiver.ACCEPTING);
@@ -591,26 +591,26 @@
Thread.sleep(7000);
log.info("Here are the sizes:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(0, queue1.memoryRefCount());
- assertEquals(NUM_MESSAGES * 5, queue1.deliveringCount());
+ assertEquals(NUM_MESSAGES * 5, queue1.getDeliveringCount());
assertEquals(0, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(0, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(0, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(0, queue5.memoryRefCount());
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
List messages = receiver.getMessages();
@@ -630,7 +630,7 @@
receiver.clear();
assertEquals(0, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertTrue(office1.getHoldingTransactions().isEmpty());
assertTrue(office2.getHoldingTransactions().isEmpty());
@@ -724,26 +724,26 @@
//Check the sizes
log.info("Here are the sizes 1:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(NUM_MESSAGES, queue5.memoryRefCount());
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
assertTrue(office1.getHoldingTransactions().isEmpty());
assertTrue(office2.getHoldingTransactions().isEmpty());
@@ -766,17 +766,17 @@
queue1.deliver(false);
Thread.sleep(1000);
assertEquals(NUM_MESSAGES - 5, queue1.memoryRefCount());
- assertEquals(5, queue1.deliveringCount());
+ assertEquals(5, queue1.getDeliveringCount());
acknowledgeAll(receiver1);
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
receiver1.setMaxRefs(0);
receiver2.setMaxRefs(10);
queue2.deliver(false);
Thread.sleep(1000);
assertEquals(NUM_MESSAGES - 10, queue2.memoryRefCount());
- assertEquals(10, queue2.deliveringCount());
+ assertEquals(10, queue2.getDeliveringCount());
acknowledgeAll(receiver2);
receiver2.setMaxRefs(0);
@@ -784,7 +784,7 @@
queue3.deliver(false);
Thread.sleep(1000);
assertEquals(NUM_MESSAGES - 15, queue3.memoryRefCount());
- assertEquals(15, queue3.deliveringCount());
+ assertEquals(15, queue3.getDeliveringCount());
acknowledgeAll(receiver3);
receiver3.setMaxRefs(0);
@@ -792,7 +792,7 @@
queue4.deliver(false);
Thread.sleep(1000);
assertEquals(NUM_MESSAGES - 20, queue4.memoryRefCount());
- assertEquals(20, queue4.deliveringCount());
+ assertEquals(20, queue4.getDeliveringCount());
acknowledgeAll(receiver4);
receiver4.setMaxRefs(0);
@@ -800,7 +800,7 @@
queue5.deliver(false);
Thread.sleep(1000);
assertEquals(NUM_MESSAGES - 25, queue5.memoryRefCount());
- assertEquals(25, queue5.deliveringCount());
+ assertEquals(25, queue5.getDeliveringCount());
acknowledgeAll(receiver5);
receiver5.setMaxRefs(0);
@@ -813,11 +813,11 @@
assertTrue(office5.getHoldingTransactions().isEmpty());
log.info("Here are the sizes 2:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
//Consume the rest from queue 5
receiver5.setMaxRefs(NUM_MESSAGES - 25);
@@ -827,34 +827,34 @@
log.info("receiver5 msgs:" + receiver5.getMessages().size());
log.info("Here are the sizes 3:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
//This will result in an extra one being pulled from queue1 - we cannot avoid this
//This is because the channel does not know that the receiver is full unless it tries
//with a ref so it needs to retrieve one
assertEquals(NUM_MESSAGES - 6, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(NUM_MESSAGES - 10, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(NUM_MESSAGES - 15, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(NUM_MESSAGES - 20, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(1, queue5.memoryRefCount());
- assertEquals(NUM_MESSAGES - 25, queue5.deliveringCount());
+ assertEquals(NUM_MESSAGES - 25, queue5.getDeliveringCount());
acknowledgeAll(receiver5);
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
receiver5.setMaxRefs(0);
@@ -873,31 +873,31 @@
Thread.sleep(5000);
log.info("Here are the sizes 4:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(NUM_MESSAGES - 11, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(NUM_MESSAGES - 10, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(NUM_MESSAGES - 15, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(NUM_MESSAGES - 20, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(1, queue5.memoryRefCount());
- assertEquals(5, queue5.deliveringCount());
+ assertEquals(5, queue5.getDeliveringCount());
acknowledgeAll(receiver5);
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
receiver1.setMaxRefs(0);
@@ -914,30 +914,30 @@
Thread.sleep(2000);
log.info("Here are the sizes 5:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(NUM_MESSAGES - 11, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(NUM_MESSAGES - 11, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(NUM_MESSAGES - 15, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(NUM_MESSAGES - 20, queue4.memoryRefCount());
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertEquals(1, queue5.memoryRefCount());
- assertEquals(1, queue5.deliveringCount());
+ assertEquals(1, queue5.getDeliveringCount());
acknowledgeAll(receiver5);
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
receiver5.setMaxRefs(0);
@@ -954,30 +954,30 @@
Thread.sleep(7000);
log.info("Here are the sizes 6:");
- log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.deliveringCount());
- log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.deliveringCount());
- log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.deliveringCount());
- log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.deliveringCount());
- log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.deliveringCount());
+ log.info("queue1, refs:" + queue1.memoryRefCount() + " dels:" + queue1.getDeliveringCount());
+ log.info("queue2, refs:" + queue2.memoryRefCount() + " dels:" + queue2.getDeliveringCount());
+ log.info("queue3, refs:" + queue3.memoryRefCount() + " dels:" + queue3.getDeliveringCount());
+ log.info("queue4, refs:" + queue4.memoryRefCount() + " dels:" + queue4.getDeliveringCount());
+ log.info("queue5, refs:" + queue5.memoryRefCount() + " dels:" + queue5.getDeliveringCount());
assertEquals(0, queue1.memoryRefCount());
- assertEquals(0, queue1.deliveringCount());
+ assertEquals(0, queue1.getDeliveringCount());
assertEquals(0, queue2.memoryRefCount());
- assertEquals(0, queue2.deliveringCount());
+ assertEquals(0, queue2.getDeliveringCount());
assertEquals(0, queue3.memoryRefCount());
- assertEquals(0, queue3.deliveringCount());
+ assertEquals(0, queue3.getDeliveringCount());
assertEquals(0, queue4.memoryRefCount());
- assertEquals(NUM_MESSAGES - 15 + NUM_MESSAGES - 20 + NUM_MESSAGES - 11 + NUM_MESSAGES - 11 + 1, queue4.deliveringCount());
+ assertEquals(NUM_MESSAGES - 15 + NUM_MESSAGES - 20 + NUM_MESSAGES - 11 + NUM_MESSAGES - 11 + 1, queue4.getDeliveringCount());
assertEquals(0, queue5.memoryRefCount());
- assertEquals(0, queue5.deliveringCount());
+ assertEquals(0, queue5.getDeliveringCount());
acknowledgeAll(receiver4);
- assertEquals(0, queue4.deliveringCount());
+ assertEquals(0, queue4.getDeliveringCount());
assertTrue(office1.getHoldingTransactions().isEmpty());
assertTrue(office2.getHoldingTransactions().isEmpty());
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -359,7 +359,7 @@
Ack l2 = (Ack)mi2.getArguments()[0];
- assertEquals(deliveryID, l2.getDeliveryId());
+ assertEquals(deliveryID, l2.getDeliveryID());
}
@@ -466,9 +466,9 @@
assertEquals(3, acks.size());
- assertEquals(ackA, ((DefaultAck)acks2.get(0)).getDeliveryId());
- assertEquals(ackB, ((DefaultAck)acks2.get(1)).getDeliveryId());
- assertEquals(ackC, ((DefaultAck)acks2.get(2)).getDeliveryId());
+ assertEquals(ackA, ((DefaultAck)acks2.get(0)).getDeliveryID());
+ assertEquals(ackB, ((DefaultAck)acks2.get(1)).getDeliveryID());
+ assertEquals(ackC, ((DefaultAck)acks2.get(2)).getDeliveryID());
}
@@ -1157,7 +1157,7 @@
Ack ack = (Ack)sess.getAcks().get(0);
- assertEquals(deliveryId, ack.getDeliveryId());
+ assertEquals(deliveryId, ack.getDeliveryID());
bis.reset();
@@ -1191,7 +1191,7 @@
Ack ack2 = (Ack)sess2.getAcks().get(0);
- assertEquals(deliveryId, ack2.getDeliveryId());
+ assertEquals(deliveryId, ack2.getDeliveryID());
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-03 20:26:56 UTC (rev 1890)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-04 16:08:37 UTC (rev 1891)
@@ -26,6 +26,7 @@
import javax.jms.QueueBrowser;
import javax.jms.TextMessage;
import javax.jms.DeliveryMode;
+import javax.jms.Message;
import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
@@ -52,58 +53,191 @@
// Public ---------------------------------------------------------------------------------------
- public void testSimpleFailover() throws Exception
+ public void testSimpleConnectionFailover() throws Exception
{
Connection conn = null;
try
{
+ // skip connection to node 0
conn = cf.createConnection();
conn.close();
+ // create a connection to node 1
conn = cf.createConnection();
conn.start();
- // create a producer/consumer on node 1
+ assertEquals(1, ((JBossConnection)conn).getServerID());
- // make sure we're connecting to node 1
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
- int nodeID = ((ConnectionState)((DelegateSupport)((JBossConnection)conn).
- getDelegate()).getState()).getServerID();
+ log.debug("killing node 1 ....");
- assertEquals(1, nodeID);
+ ServerManagement.kill(1);
- Session s1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer c1 = s1.createConsumer(queue[1]);
- MessageProducer p1 = s1.createProducer(queue[1]);
- p1.setDeliveryMode(DeliveryMode.PERSISTENT);
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
- // send a message
+ // wait for the client-side failover to complete
- p1.send(s1.createTextMessage("blip"));
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
- // kill node 1
+ // failover complete
+ log.info("failover completed");
+ assertEquals(0, ((JBossConnection)conn).getServerID());
- ServerManagement.killAndWait(1);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testSessionFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
log.info("########");
log.info("######## KILLED NODE 1");
log.info("########");
- try
+ // wait for the client-side failover to complete
+
+ while(true)
{
- ic[1].lookup("queue"); // looking up anything
- fail("The server still alive, kill didn't work yet");
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
}
- catch (Exception e)
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // use the old session to send/receive a message
+ session.createProducer(queue[0]).send(session.createTextMessage("blik"));
+
+ TextMessage m = (TextMessage)session.createConsumer(queue[0]).receive(2000);
+
+ assertEquals("blik", m.getText());
+ }
+ finally
+ {
+ if (conn != null)
{
+ conn.close();
}
+ }
+ }
- // we must receive the message
+ public void testProducerFailover() throws Exception
+ {
+ Connection conn = null;
- TextMessage tm = (TextMessage)c1.receive(1000);
- assertEquals("blip", tm.getText());
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+ // create a connection to node 1
+ conn = cf.createConnection();
+
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // send a message, send it with the failed over producer and make sure I can receive it
+ Message m = session.createTextMessage("clik");
+ prod.send(m);
+
+ MessageConsumer cons = session.createConsumer(queue[0]);
+ TextMessage tm = (TextMessage)cons.receive(2000);
+
+ assertNotNull(tm);
+ assertEquals("clik", tm.getText());
}
finally
{
@@ -114,7 +248,7 @@
}
}
- public void testSimpleConnectionFailover() throws Exception
+ public void testConsumerFailoverWithConnectionStopped() throws Exception
{
Connection conn = null;
@@ -126,10 +260,99 @@
// create a connection to node 1
conn = cf.createConnection();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session.createConsumer(queue[1]);
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ // send a message (connection is stopped, so it will stay on the server), and I expect
+ // to receive it with the failed-over consumer after crash
+
+ Message m = session.createTextMessage("plik");
+ prod.send(m);
+
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // activate the failed-over consumer
conn.start();
+ TextMessage rm = (TextMessage)cons.receive(2000);
+ assertNotNull(rm);
+ assertEquals("plik", rm.getText());
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ public void testConsumerFailoverWithConnectionStarted() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+
assertEquals(1, ((JBossConnection)conn).getServerID());
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session.createConsumer(queue[1]);
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ // start the connection, so the message makes it to the client-side MessageCallbackHandler
+ // buffer
+
+ conn.start();
+
+ Message m = session.createTextMessage("nik");
+ prod.send(m);
+
+ // wait a bit so the message makes it to the client
+ log.info("sleeping 2 secs ...");
+ Thread.sleep(2000);
+
// register a failover listener
SimpleFailoverListener failoverListener = new SimpleFailoverListener();
((JBossConnection)conn).registerFailoverListener(failoverListener);
@@ -162,6 +385,9 @@
assertEquals(0, ((JBossConnection)conn).getServerID());
+ TextMessage rm = (TextMessage)cons.receive(2000);
+ assertNotNull(rm);
+ assertEquals("nik", rm.getText());
}
finally
{
@@ -172,7 +398,10 @@
}
}
- public void testConnectionAndSessionFailover() throws Exception
+ /**
+ * Sending one persistent message.
+ */
+ public void testSessionWithOneTransactedPersistentMessageFailover() throws Exception
{
Connection conn = null;
@@ -184,12 +413,31 @@
// create a connection to node 1
conn = cf.createConnection();
+
conn.start();
assertEquals(1, ((JBossConnection)conn).getServerID());
- Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+ // send 2 transacted messages (one persistent and one non-persistent) but don't commit
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+ prod.send(session.createTextMessage("clik-persistent"));
+
+ // close the producer
+ prod.close();
+
+ log.debug("producer closed");
+
+ // create a consumer on the same local queue (creating a consumer AFTER failover will end
+ // up getting messages from a local queue, not a failed over queue; at least until
+ // redistribution is implemented.
+
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session2.createConsumer(queue[1]);
+
// register a failover listener
SimpleFailoverListener failoverListener = new SimpleFailoverListener();
((JBossConnection)conn).registerFailoverListener(failoverListener);
@@ -222,12 +470,15 @@
assertEquals(0, ((JBossConnection)conn).getServerID());
- // use the old session to send/receive a message
- session.createProducer(queue[0]).send(session.createTextMessage("blik"));
+ // commit the failed-over session
+ session.commit();
- TextMessage m = (TextMessage)session.createConsumer(queue[0]).receive(2000);
+ // make sure messages made it to the queue
- assertEquals("blik", m.getText());
+ TextMessage tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clik-persistent", tm.getText());
+
}
finally
{
@@ -238,7 +489,391 @@
}
}
+ /**
+ * Sending one non-persistent message.
+ */
+ public void testSessionWithOneTransactedNonPersistentMessageFailover() throws Exception
+ {
+ Connection conn = null;
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ // send 2 transacted messages (one persistent and one non-persistent) but don't commit
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ prod.send(session.createTextMessage("clik-non-persistent"));
+
+ // close the producer
+ prod.close();
+
+ log.debug("producer closed");
+
+ // create a consumer on the same local queue (creating a consumer AFTER failover will end
+ // up getting messages from a local queue, not a failed over queue; at least until
+ // redistribution is implemented.
+
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session2.createConsumer(queue[1]);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // commit the failed-over session
+ session.commit();
+
+ // make sure messages made it to the queue
+
+ TextMessage tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clik-non-persistent", tm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ /**
+ * Sending 2 non-persistent messages.
+ */
+ public void testSessionWithTwoTransactedNonPersistentMessagesFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ // send 2 transacted messages (one persistent and one non-persistent) but don't commit
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ prod.send(session.createTextMessage("clik-non-persistent"));
+ prod.send(session.createTextMessage("clak-non-persistent"));
+
+ // close the producer
+ prod.close();
+
+ log.debug("producer closed");
+
+ // create a consumer on the same local queue (creating a consumer AFTER failover will end
+ // up getting messages from a local queue, not a failed over queue; at least until
+ // redistribution is implemented.
+
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session2.createConsumer(queue[1]);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // commit the failed-over session
+ session.commit();
+
+ // make sure messages made it to the queue
+
+ TextMessage tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clik-non-persistent", tm.getText());
+
+ tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clak-non-persistent", tm.getText());
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ /**
+ * Sending 2 persistent messages.
+ */
+ public void testSessionWithTwoTransactedPersistentMessagesFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ // send 2 transacted messages (one persistent and one non-persistent) but don't commit
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+ prod.send(session.createTextMessage("clik-persistent"));
+ prod.send(session.createTextMessage("clak-persistent"));
+
+ // close the producer
+ prod.close();
+
+ log.debug("producer closed");
+
+ // create a consumer on the same local queue (creating a consumer AFTER failover will end
+ // up getting messages from a local queue, not a failed over queue; at least until
+ // redistribution is implemented.
+
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session2.createConsumer(queue[1]);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // commit the failed-over session
+ session.commit();
+
+ // make sure messages made it to the queue
+
+ TextMessage tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clik-persistent", tm.getText());
+
+ tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clak-persistent", tm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ /**
+ * Sending a mix of persistent and non-persistent messages.
+ */
+ public void testSessionWithTwoTransactedMixedMessagesFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ // skip connection to node 0
+ conn = cf.createConnection();
+ conn.close();
+
+ // create a connection to node 1
+ conn = cf.createConnection();
+
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ // send 2 transacted messages (one persistent and one non-persistent) but don't commit
+ MessageProducer prod = session.createProducer(queue[1]);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+ prod.send(session.createTextMessage("clik-non-persistent"));
+
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+ prod.send(session.createTextMessage("clak-persistent"));
+
+ // close the producer
+ prod.close();
+
+ log.debug("producer closed");
+
+ // create a consumer on the same local queue (creating a consumer AFTER failover will end
+ // up getting messages from a local queue, not a failed over queue; at least until
+ // redistribution is implemented.
+
+ Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer cons = session2.createConsumer(queue[1]);
+
+ // register a failover listener
+ SimpleFailoverListener failoverListener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(failoverListener);
+
+ log.debug("killing node 1 ....");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait for the client-side failover to complete
+
+ while(true)
+ {
+ FailoverEvent event = failoverListener.getEvent(120000);
+ if (event != null && FailoverEvent.FAILOVER_COMPLETED == event.getType())
+ {
+ break;
+ }
+ if (event == null)
+ {
+ fail("Did not get expected FAILOVER_COMPLETED event");
+ }
+ }
+
+ // failover complete
+ log.info("failover completed");
+
+ assertEquals(0, ((JBossConnection)conn).getServerID());
+
+ // commit the failed-over session
+ session.commit();
+
+ // make sure messages made it to the queue
+
+ TextMessage tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clik-non-persistent", tm.getText());
+
+ tm = (TextMessage)cons.receive(2000);
+ assertNotNull(tm);
+ assertEquals("clak-persistent", tm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ // TODO add a test whose session has NON-TRANSACTED, PERSISTENT and NON-PERSISTENT ACKS.
+
+ // TODO add a test whose session has TRANSACTED, PERSISTENT and NON-PERSISTENT ACKS.
+
+
public void testFailoverListener() throws Exception
{
Connection conn = null;
@@ -391,7 +1026,6 @@
prod.setDeliveryMode(DeliveryMode.PERSISTENT);
MessageConsumer cons = session.createConsumer(queue[0]);
-
// send a message
prod.send(session.createTextMessage("blip"));
@@ -436,65 +1070,129 @@
}
}
- // TODO http://jira.jboss.org/jira/browse/JBMESSAGING-712
-// public void testFailoverMessageOnServer2() throws Exception
-// {
-// Connection conn = null;
-//
-// try
-// {
-// conn = cf.createConnection();
-// conn.close();
-//
-// conn = cf.createConnection();
-// conn.start();
-//
-// assertEquals(1, ((JBossConnection)conn).getServerID());
-//
-// SimpleFailoverListener listener = new SimpleFailoverListener();
-// ((JBossConnection)conn).registerFailoverListener(listener);
-//
-// Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-// MessageProducer prod = session.createProducer(queue[1]);
-// prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-//
-// // send a message
-//
-// prod.send(session.createTextMessage("blip"));
-//
-// // kill node 1
-//
-// log.debug("killing node 1");
-//
-// ServerManagement.kill(1);
-//
-// log.info("########");
-// log.info("######## KILLED NODE 1");
-// log.info("########");
-//
-// // wait until the failure (not the completion of client-side failover) is detected
-//
-// assertEquals(FailoverEvent.FAILURE_DETECTED, listener.getEvent(60000).getType());
-//
-// // create a consumer the very next moment the failure is detected. This way, we also
-// // test the client-side failover valve
-//
-// MessageConsumer cons = session.createConsumer(queue[0]);
-//
-// // we must receive the message
-//
-// TextMessage tm = (TextMessage)cons.receive(60000);
-// assertEquals("blip", tm.getText());
-// }
-// finally
-// {
-// if (conn != null)
-// {
-// conn.close();
-// }
-// }
-// }
+ public void testFailoverMessageOnServer2() throws Exception
+ {
+ Connection conn = null;
+ try
+ {
+ conn = cf.createConnection();
+ conn.close();
+
+ conn = cf.createConnection();
+ conn.start();
+
+ assertEquals(1, ((JBossConnection)conn).getServerID());
+
+ SimpleFailoverListener listener = new SimpleFailoverListener();
+ ((JBossConnection)conn).registerFailoverListener(listener);
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prod = session.createProducer(queue[1]);
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+ // send a message
+
+ prod.send(session.createTextMessage("blip"));
+
+ // kill node 1
+
+ log.debug("killing node 1");
+
+ ServerManagement.kill(1);
+
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ // wait until the failure (not the completion of client-side failover) is detected
+
+ assertEquals(FailoverEvent.FAILURE_DETECTED, listener.getEvent(60000).getType());
+
+ // create a consumer the very next moment the failure is detected. This way, we also
+ // test the client-side failover valve
+
+ MessageConsumer cons = session.createConsumer(queue[0]);
+
+ // we must receive the message
+
+ TextMessage tm = (TextMessage)cons.receive(60000);
+ assertEquals("blip", tm.getText());
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+
+ public void testSimpleFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+ conn.close();
+
+ conn = cf.createConnection();
+ conn.start();
+
+ // create a producer/consumer on node 1
+
+ // make sure we're connecting to node 1
+
+ int nodeID = ((ConnectionState)((DelegateSupport)((JBossConnection)conn).
+ getDelegate()).getState()).getServerID();
+
+ assertEquals(1, nodeID);
+
+ Session s1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer c1 = s1.createConsumer(queue[1]);
+ MessageProducer p1 = s1.createProducer(queue[1]);
+ p1.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+ // send a message
+
+ p1.send(s1.createTextMessage("blip"));
+
+ // kill node 1
+
+
+ ServerManagement.killAndWait(1);
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ try
+ {
+ ic[1].lookup("queue"); // looking up anything
+ fail("The server still alive, kill didn't work yet");
+ }
+ catch (Exception e)
+ {
+ }
+
+ // we must receive the message
+
+ TextMessage tm = (TextMessage)c1.receive(1000);
+ assertEquals("blip", tm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+
+
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
More information about the jboss-cvs-commits
mailing list