[Jboss-cvs] JBoss Messaging SVN: r1174 - in trunk: . docs/gettingstarted/en/modules lib perf/src/org/jboss/jms/perf/framework/remoting perf/src/org/jboss/jms/perf/framework/remoting/rmi src/etc src/etc/server/default/deploy src/etc/xmdesc 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/delegate src/main/org/jboss/jms/message src/main/org/jboss/jms/server src/main/org/jboss/jms/server/connectionfactory src/main/org/jboss/jms/server/destination src/main/org/jboss/jms/server/endpoint src/main/org/jboss/jms/server/plugin src/main/org/jboss/jms/server/plugin/contract src/main/org/jboss/jms/server/subscription src/main/org/jboss/jms/util src/main/org/jboss/messaging/core src/main/org/jboss/messaging/core/distributed/replicator src/main/org/jboss/messaging/core/local src/main/org/jboss/messaging/core/message src/main/org/jboss/! messaging/core/plugin src/main/org/jboss/messaging/core/plugin/contract src/main/org/jboss/messaging/core/refqueue src/main/org/jboss/messaging/util tests tests/src/org/jboss/test/messaging/core tests/src/org/jboss/test/messaging/core/distributed/queue tests/src/org/jboss/test/messaging/core/distributed/replicator tests/src/org/jboss/test/messaging/core/distributed/topic tests/src/org/jboss/test/messaging/core/message tests/src/org/jboss/test/messaging/core/paging tests/src/org/jboss/test/messaging/core/plugin tests/src/org/jboss/test/messaging/core/refqueue tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/jms/message tests/src/org/jboss/test/messaging/jms/message/foreign tests/src/org/jboss/test/messaging/jms/persistence tests/src/org/jboss/test/messaging/jms/selector tests/src/org/jboss/test/messaging/jms/server/destination tests/src/org/jboss/test/messaging/jms/stress tests/src/org/jboss/test/messaging/tools tests/src/org/jboss/test/messaging/too! ls/jboss tests/src/org/jboss/test/messaging/tools/jmx tests/src/org/jboss/test/messaging/tools/jmx/rmi tests/src/org/jboss/test/messaging/util
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 2 10:15:30 EDT 2006
Author: timfox
Date: 2006-08-02 10:14:32 -0400 (Wed, 02 Aug 2006)
New Revision: 1174
Added:
trunk/lib/jboss-serialization.jar
trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDequeIterator.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
Removed:
trunk/src/main/org/jboss/jms/server/plugin/DefaultThreadPool.java
trunk/src/main/org/jboss/jms/server/plugin/contract/ThreadPool.java
Modified:
trunk/.classpath
trunk/.project
trunk/build-messaging.xml
trunk/build-thirdparty.xml
trunk/docs/gettingstarted/en/modules/configuration.xml
trunk/perf/src/org/jboss/jms/perf/framework/remoting/ResultSupport.java
trunk/perf/src/org/jboss/jms/perf/framework/remoting/rmi/Server.java
trunk/src/etc/aop-messaging-client.xml
trunk/src/etc/server/default/deploy/mysql-persistence-service.xml
trunk/src/etc/server/default/deploy/oracle-persistence-service.xml
trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml
trunk/src/etc/server/default/deploy/sybase-persistence-service.xml
trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
trunk/src/main/org/jboss/jms/client/JBossMessageProducer.java
trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
trunk/src/main/org/jboss/jms/client/container/SessionAspect.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/delegate/SessionDelegate.java
trunk/src/main/org/jboss/jms/message/MessageProxy.java
trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
trunk/src/main/org/jboss/jms/server/QueuedExecutorPool.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
trunk/src/main/org/jboss/jms/server/destination/Queue.java
trunk/src/main/org/jboss/jms/server/destination/Topic.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/subscription/DurableSubscription.java
trunk/src/main/org/jboss/jms/util/ExceptionUtil.java
trunk/src/main/org/jboss/jms/util/MessagingTransactionRolledBackException.java
trunk/src/main/org/jboss/jms/util/SafeUTF.java
trunk/src/main/org/jboss/jms/util/XMLException.java
trunk/src/main/org/jboss/jms/util/XMLRuntimeException.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/SimpleDelivery.java
trunk/src/main/org/jboss/messaging/core/distributed/replicator/ReplicatorTopology.java
trunk/src/main/org/jboss/messaging/core/local/PointToPointRouter.java
trunk/src/main/org/jboss/messaging/core/message/MessageSupport.java
trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
trunk/src/main/org/jboss/messaging/core/plugin/MessageHolder.java
trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
trunk/src/main/org/jboss/messaging/core/refqueue/BasicPrioritizedDeque.java
trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDeque.java
trunk/src/main/org/jboss/messaging/util/RotatingPool.java
trunk/tests/build.bat
trunk/tests/build.properties
trunk/tests/build.xml
trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java
trunk/tests/src/org/jboss/test/messaging/core/distributed/queue/QueuePeerTest.java
trunk/tests/src/org/jboss/test/messaging/core/distributed/replicator/ReplicatorTest.java
trunk/tests/src/org/jboss/test/messaging/core/distributed/topic/TopicPeerTest.java
trunk/tests/src/org/jboss/test/messaging/core/message/CoreMessageTest.java
trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
trunk/tests/src/org/jboss/test/messaging/core/refqueue/PrioritizedReferenceQueueTest.java
trunk/tests/src/org/jboss/test/messaging/jms/BrowserTest.java
trunk/tests/src/org/jboss/test/messaging/jms/CreateClientOnServerCommand.java
trunk/tests/src/org/jboss/test/messaging/jms/CreateHangingConsumerCommand.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java
trunk/tests/src/org/jboss/test/messaging/jms/ReferenceableTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/JMSCorrelationIDHeaderTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignObjectMessageTest.java
trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignStreamMessageTest.java
trunk/tests/src/org/jboss/test/messaging/jms/persistence/MessagePersistenceManagerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
trunk/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java
trunk/tests/src/org/jboss/test/messaging/jms/stress/TransactionalReceiver.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/RemotingJMXWrapper.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
trunk/tests/src/org/jboss/test/messaging/util/RemotingTest.java
trunk/tests/src/org/jboss/test/messaging/util/ServiceDeploymentDescriptorTest.java
trunk/tests/src/org/jboss/test/messaging/util/XMLUtilTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-451
http://jira.jboss.com/jira/browse/JBMESSAGING-440
various other things
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/.classpath 2006-08-02 14:14:32 UTC (rev 1174)
@@ -1,35 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main"/>
- <classpathentry kind="src" path="perf/src"/>
- <classpathentry kind="src" path="output/parsers"/>
- <classpathentry kind="src" path="tests/src"/>
- <classpathentry kind="src" path="/j2ee"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common/lib/jboss-common.jar"/>
- <classpathentry kind="src" path="/system"/>
- <classpathentry kind="src" path="/aop"/>
- <classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
- <classpathentry kind="lib" path="/thirdparty/javassist/lib/javassist.jar"/>
- <classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
- <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
- <classpathentry kind="src" path="/j2se"/>
- <classpathentry kind="src" path="/aspects"/>
- <classpathentry combineaccessrules="false" kind="src" path="/server"/>
- <classpathentry combineaccessrules="false" kind="src" path="/connector"/>
- <classpathentry combineaccessrules="false" kind="src" path="/transaction"/>
- <classpathentry kind="lib" path="src/resources/hsqldb.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/thirdparty/apache-logging/lib/commons-logging.jar"/>
- <classpathentry kind="lib" path="/tools/lib/ant.jar"/>
- <classpathentry kind="lib" path="/tools/lib/ant-junit.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/jmx"/>
- <classpathentry combineaccessrules="false" kind="src" path="/mbeans"/>
- <classpathentry kind="lib" path="src/resources/jboss-remoting.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/security"/>
- <classpathentry kind="lib" path="src/resources/jboss-serialization.jar"/>
+ <classpathentry excluding="**/.svn/**/*" kind="src" path="perf/src"/>
+ <classpathentry kind="src" path="output/gen-parsers"/>
+ <classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
+ <classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src"/>
+ <classpathentry kind="lib" path="lib/jboss.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-j2ee.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-j2se.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-jmx.jar"/>
+ <classpathentry kind="lib" path="lib/jbosssx.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-system.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-transaction.jar"/>
+ <classpathentry kind="lib" path="lib/jnp-client.jar"/>
+ <classpathentry kind="lib" path="src/resources/clester.jar"/>
+ <classpathentry kind="lib" path="src/resources/jboss-aspect-library.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.4.2_09"/>
+ <classpathentry kind="lib" path="thirdparty/jboss/common/lib/jboss-common.jar"/>
+ <classpathentry kind="lib" path="thirdparty/oswego-concurrent/lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="tests/lib/jboss-common-jdbc-wrapper.jar"/>
+ <classpathentry kind="lib" path="tests/lib/jboss-jca.jar"/>
+ <classpathentry kind="lib" path="tests/lib/jboss-local-jdbc.jar"/>
+ <classpathentry kind="lib" path="tests/lib/jboss-mbeans.jar"/>
+ <classpathentry kind="lib" path="tests/lib/jms-ra.jar"/>
+ <classpathentry kind="lib" path="tests/lib/mysql-connector-java-3.1.13-bin.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jgroups/lib/jgroups.jar"/>
<classpathentry kind="lib" path="perf/resources/jcommon-1.0.0-rc1.jar"/>
<classpathentry kind="lib" path="perf/resources/jfreechart-1.0.0-rc1.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar"/>
- <classpathentry kind="output" path="output/eclipse-classes"/>
+ <classpathentry kind="lib" path="thirdparty/apache-log4j/lib/log4j.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-remoting.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jboss/aop/lib/jboss-aop.jar"/>
+ <classpathentry kind="lib" path="lib/jboss-serialization.jar"/>
+ <classpathentry kind="lib" path="thirdparty/junit/lib/junit.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar"/>
+ <classpathentry kind="lib" path="thirdparty/hsqldb/lib/hsqldb.jar"/>
+ <classpathentry kind="lib" path="C:/tools/apache-ant-1.6.5/lib/ant-junit.jar"/>
+ <classpathentry kind="lib" path="thirdparty/apache-logging/lib/commons-logging.jar"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/.project
===================================================================
--- trunk/.project 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/.project 2006-08-02 14:14:32 UTC (rev 1174)
@@ -1,14 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jms</name>
+ <name>jboss-messaging</name>
<comment></comment>
<projects>
- <project>aop</project>
- <project>common</project>
- <project>j2ee</project>
- <project>jmx</project>
- <project>remoting</project>
- <project>system</project>
</projects>
<buildSpec>
<buildCommand>
Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/build-messaging.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -48,7 +48,7 @@
<property name="messaging.version.major" value="1"/>
<property name="messaging.version.minor" value="0"/>
<property name="messaging.version.revision" value="1"/>
- <property name="messaging.version.incrementing" value="5"/>
+ <property name="messaging.version.incrementing" value="4"/>
<property name="messaging.version.tag" value="CR4"/>
<property name="messaging.version.name" value=""/>
<property name="messaging.version.cvstag" value="JBossMessaging_1_0_1_CR4"/>
Modified: trunk/build-thirdparty.xml
===================================================================
--- trunk/build-thirdparty.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/build-thirdparty.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -92,6 +92,9 @@
<componentref name="jboss/serialization" version="1.0.1.GA"/>
<componentref name="jboss/remoting" version="2.0.0.Beta2"/>
+ <!-- Need this otherwise project doesn't build in Eclipse -->
+ <componentref name="apache-logging" version="1.0.5.GA-jboss"/>
+
<!--
Dependencies required to test the project.
-->
Modified: trunk/docs/gettingstarted/en/modules/configuration.xml
===================================================================
--- trunk/docs/gettingstarted/en/modules/configuration.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/docs/gettingstarted/en/modules/configuration.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -468,6 +468,12 @@
or <literal>DownCacheSize</literal> are specified they will default to values
75000, 2000, 2000 respectively.
</para>
+
+ <para>
+ If you want to specify the paging parameters used for temporary queues then you need to specify them
+ on the appropriate connection factory.
+ See connection factory configuration for details.
+ </para>
</section>
</section>
@@ -559,6 +565,10 @@
</constructor>
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=socket</depends>
+ <attribute name="PrefetchSize">10</attribute>
+ <attribute name="DefaultTempQueueFullSize">1000</attribute>
+ <attribute name="DefaultTempQueuePageSize">50</attribute>
+ <attribute name="DefaultTempQueueDownCacheSize">50</attribute>
<attribute name="JNDIBindings">
<bindings>
<binding>/MyConnectionFactory1</binding>
@@ -578,6 +588,16 @@
remoting connector. To use a different remoting connector with the connection factory
change the <literal>Connector</literal> attribute to specify the service name of the connector you wish to use.
</para>
+ <para>prefetchSize is an optional attribute that determines how many messages client side message consumers will buffer locally. Pre-fetching messages prevents
+ the client having to go to the server each time a message is consumed to say it is ready to receive another message.
+ This greatly increases throughput. The default value for prefetchSize is 150. You may want to change this to a smaller value if you are dealing with
+ very large messages, so as not to use too much memory on the client.
+ </para>
+ <para>DefaultTempQueueFullSize, DefaultTempQueuePageSize, DefaultTempQueueDownCacheSize are optional attributes that determine the default paging parameters to be used for
+ any temporary destinations scoped to connections created using this connection factory. See the section on paging channels for more information
+ on what these values mean.
+ They will default to values of 75000, 2000 and 2000 respectively if ommitted.
+ </para>
</section>
<section id="conf.connector">
Added: trunk/lib/jboss-serialization.jar
===================================================================
(Binary files differ)
Property changes on: trunk/lib/jboss-serialization.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/perf/src/org/jboss/jms/perf/framework/remoting/ResultSupport.java
===================================================================
--- trunk/perf/src/org/jboss/jms/perf/framework/remoting/ResultSupport.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/perf/src/org/jboss/jms/perf/framework/remoting/ResultSupport.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -15,6 +15,7 @@
{
// Constants -----------------------------------------------------
+
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
Modified: trunk/perf/src/org/jboss/jms/perf/framework/remoting/rmi/Server.java
===================================================================
--- trunk/perf/src/org/jboss/jms/perf/framework/remoting/rmi/Server.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/perf/src/org/jboss/jms/perf/framework/remoting/rmi/Server.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -7,12 +7,11 @@
package org.jboss.jms.perf.framework.remoting.rmi;
-import org.jboss.jms.perf.framework.remoting.Result;
-import org.jboss.jms.perf.framework.remoting.Request;
-
import java.rmi.Remote;
-import java.io.Serializable;
+import org.jboss.jms.perf.framework.remoting.Request;
+import org.jboss.jms.perf.framework.remoting.Result;
+
/**
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/src/etc/aop-messaging-client.xml
===================================================================
--- trunk/src/etc/aop-messaging-client.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/aop-messaging-client.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -111,7 +111,7 @@
<bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->preDeliver(..))">
<advice name="handlePreDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
</bind>
- <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver(..))">
+ <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->postDeliver())">
<advice name="handlePostDeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
</bind>
<bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->acknowledgeAll(..))">
@@ -122,7 +122,10 @@
</bind>
<bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->redeliver(..))">
<advice name="handleRedeliver" aspect="org.jboss.jms.client.container.SessionAspect"/>
- </bind>
+ </bind>
+ <bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->close())">
+ <advice name="handleClose" aspect="org.jboss.jms.client.container.SessionAspect"/>
+ </bind>
<bind pointcut="execution(* org.jboss.jms.client.delegate.ClientSessionDelegate->commit())">
<advice name="handleCommit" aspect="org.jboss.jms.client.container.TransactionAspect"/>
</bind>
Modified: trunk/src/etc/server/default/deploy/mysql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/mysql-persistence-service.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/server/default/deploy/mysql-persistence-service.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -32,21 +32,20 @@
COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
-LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
-DELETE_CHANNEL_MESSAGE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=?
-REMOVE_ALL_NONRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE='N'
UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY TINYINT, COREHEADERS MEDIUMBLOB, PAYLOAD LONGBLOB, CHANNELCOUNT INTEGER, TYPE TINYINT, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES VARBINARY(254), DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES MEDIUMBLOB, PRIMARY KEY (MESSAGEID))
LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-UPDATE_MESSAGE_CHANNEL_COUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
-MESSAGE_ID_COLUMN=MESSAGEID
-REMOVE_ALL_NONRELIABLE_MSGS=DELETE FROM JMS_MESSAGE WHERE RELIABLE='N'
-DELETE_ALL_MESSAGES=DELETE FROM JMS_MESSAGE
+MESSAGEID_COLUMN=MESSAGEID
+UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID BIGINT, BRANCH_QUAL VARBINARY(254), FORMAT_ID INTEGER, GLOBAL_TXID VARBINARY(254), PRIMARY KEY (TRANSACTIONID))
INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
@@ -57,6 +56,7 @@
SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
]]></attribute>
<attribute name="MaxParams">500</attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/oracle-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/oracle-persistence-service.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/server/default/deploy/oracle-persistence-service.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -32,21 +32,20 @@
COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
-LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
-DELETE_CHANNEL_MESSAGE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=?
-REMOVE_ALL_NONRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE='N'
UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID INTEGER, RELIABLE CHAR(1), EXPIRATION INTEGER, TIMESTAMP INTEGER, PRIORITY INTEGER, COREHEADERS BLOB, PAYLOAD BLOB, CHANNELCOUNT INTEGER, TYPE INTEGER, JMSTYPE VARCHAR2(255), CORRELATIONID VARCHAR2(255), CORRELATIONID_BYTES RAW(254), DESTINATION_ID INTEGER, REPLYTO_ID INTEGER, JMSPROPERTIES BLOB, PRIMARY KEY (MESSAGEID))
LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-UPDATE_MESSAGE_CHANNEL_COUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
-MESSAGE_ID_COLUMN=MESSAGEID
-REMOVE_ALL_NONRELIABLE_MSGS=DELETE FROM JMS_MESSAGE WHERE RELIABLE='N'
-DELETE_ALL_MESSAGES=DELETE FROM JMS_MESSAGE
+MESSAGEID_COLUMN=MESSAGEID
+UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID INTEGER, BRANCH_QUAL RAW(254), FORMAT_ID INTEGER, GLOBAL_TXID RAW(254), PRIMARY KEY (TRANSACTIONID))
INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
@@ -57,6 +56,7 @@
SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
]]></attribute>
<attribute name="MaxParams">500</attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -32,21 +32,20 @@
COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
-LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
-DELETE_CHANNEL_MESSAGE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=?
-REMOVE_ALL_NONRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE='N'
UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY int2, COREHEADERS BYTEA, PAYLOAD BYTEA, CHANNELCOUNT INTEGER, TYPE int2, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES BYTEA, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES BYTEA, PRIMARY KEY (MESSAGEID))
LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-UPDATE_MESSAGE_CHANNEL_COUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
-MESSAGE_ID_COLUMN=MESSAGEID
-REMOVE_ALL_NONRELIABLE_MSGS=DELETE FROM JMS_MESSAGE WHERE RELIABLE='N'
-DELETE_ALL_MESSAGES=DELETE FROM JMS_MESSAGE
+MESSAGEID_COLUMN=MESSAGEID
+UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID BIGINT, BRANCH_QUAL BYTEA, FORMAT_ID INTEGER, GLOBAL_TXID BYTEA, PRIMARY KEY (TRANSACTIONID))
INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
@@ -57,6 +56,7 @@
SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
]]></attribute>
<attribute name="MaxParams">500</attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/sybase-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/sybase-persistence-service.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/server/default/deploy/sybase-persistence-service.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -41,20 +41,19 @@
COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
-LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
-DELETE_CHANNEL_MESSAGE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=?
-REMOVE_ALL_NONRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE='N'
UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID INTEGER, RELIABLE CHAR(1) NULL, EXPIRATION INTEGER NULL, TIMESTAMP NUMERIC(20,0) NULL, PRIORITY INTEGER NULL, COREHEADERS IMAGE NULL, PAYLOAD IMAGE NULL, CHANNELCOUNT INTEGER NULL, TYPE INTEGER NULL, JMSTYPE VARCHAR(255) NULL, CORRELATIONID VARCHAR(255) NULL, CORRELATIONID_BYTES VARBINARY(254) NULL, DESTINATION_ID INTEGER NULL, REPLYTO_ID INTEGER NULL, JMSPROPERTIES IMAGE NULL, PRIMARY KEY (MESSAGEID))
LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
-UPDATE_MESSAGE_CHANNEL_COUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
-DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=? MESSAGE_ID_COLUMN=MESSAGEID
-REMOVE_ALL_NONRELIABLE_MSGS=DELETE FROM JMS_MESSAGE WHERE RELIABLE='N'
-DELETE_ALL_MESSAGES=DELETE FROM JMS_MESSAGE
+UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=? MESSAGEID_COLUMN=MESSAGEID
+UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID INTEGER, BRANCH_QUAL VARBINARY(254) NULL, FORMAT_ID INTEGER NULL, GLOBAL_TXID VARBINARY(254) NULL, PRIMARY KEY (TRANSACTIONID))
INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
@@ -65,6 +64,7 @@
SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
]]>
</attribute>
</mbean>
Modified: trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml
===================================================================
--- trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/etc/xmdesc/ConnectionFactory-xmbean.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -46,6 +46,24 @@
<name>PrefetchSize</name>
<type>int</type>
</attribute>
+
+ <attribute access="read-write" getMethod="getDefaultTempQueueFullSize" setMethod="setDefaultTempQueueFullSize">
+ <description>The default value of paging full size for any temporary queues created for connections from this connection factory</description>
+ <name>DefaultTempQueueFullSize</name>
+ <type>int</type>
+ </attribute>
+
+ <attribute access="read-write" getMethod="getDefaultTempQueuePageSize" setMethod="setDefaultTempQueuePageSize">
+ <description>The default value of paging page size for any temporary queues created for connections from this connection factory</description>
+ <name>DefaultTempQueuePageSize</name>
+ <type>int</type>
+ </attribute>
+
+ <attribute access="read-write" getMethod="getDefaultTempQueueDownCacheSize" setMethod="setDefaultTempQueueDownCacheSize">
+ <description>The default value of paging down cache size for any temporary queues created for connections from this connection factory</description>
+ <name>DefaultTempQueueDownCacheSize</name>
+ <type>int</type>
+ </attribute>
<!-- ServerPeer ObjectName is configured as a dependency optional-attribute-name, this is the
only reason for this attribute to be writable. Any write attempt on this attribute after
Modified: trunk/src/main/org/jboss/jms/client/JBossMessageProducer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossMessageProducer.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/JBossMessageProducer.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -133,7 +133,7 @@
public void send(Message message) throws JMSException
{
// by default the message never expires
- send(message, -1, -1, 0);
+ send(message, -1, -1, Long.MIN_VALUE);
}
/**
@@ -147,7 +147,7 @@
public void send(Destination destination, Message message) throws JMSException
{
- send(destination, message, -1, -1, 0);
+ send(destination, message, -1, -1, Long.MIN_VALUE);
}
public void send(Destination destination,
Modified: trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -31,7 +31,6 @@
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.delegate.SessionDelegate;
-import org.jboss.jms.server.endpoint.ServerBrowserEndpoint;
import org.jboss.logging.Logger;
import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
Modified: trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/container/ProducerAspect.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -126,7 +126,7 @@
timeToLive = producerState.getTimeToLive();
if (trace) { log.trace("Using producer's default timeToLive: " + timeToLive); }
}
-
+
if (timeToLive == 0)
{
// Zero implies never expires
@@ -214,8 +214,8 @@
MessageProxy proxy = (MessageProxy)m;
messageToSend = proxy.getMessage();
- if (proxy.isSent())
- {
+ if (proxy.isSent() || proxy.isReceived())
+ {
doCopy = true;
}
Modified: trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -63,6 +63,19 @@
// Public --------------------------------------------------------
+ public Object handleClose(Invocation invocation) throws Throwable
+ {
+ Object res = invocation.invokeNext();
+
+ SessionState state = getState(invocation);
+
+ //We must explicitly shutdown the executor
+
+ state.getExecutor().shutdownNow();
+
+ return res;
+ }
+
public Object handlePreDeliver(Invocation invocation) throws Throwable
{
MethodInvocation mi = (MethodInvocation)invocation;
@@ -77,7 +90,7 @@
SessionDelegate del = (SessionDelegate)mi.getTargetObject();
//We store the ack in a list for later acknowledgement or recovery
-
+
Object[] args = mi.getArguments();
MessageProxy mp = (MessageProxy)args[0];
@@ -130,14 +143,18 @@
{
//We don't acknowledge the message if recover() was called
- Object[] args = mi.getArguments();
+ //Object[] args = mi.getArguments();
- MessageProxy proxy = (MessageProxy)args[0];
+ //MessageProxy proxy = (MessageProxy)args[0];
- int consumerID = ((Integer)args[1]).intValue();
+ //int consumerID = ((Integer)args[1]).intValue();
- AckInfo ack = new AckInfo(proxy, consumerID);
+ //AckInfo ack = new AckInfo(proxy, consumerID);
+ List acks = state.getToAck();
+
+ AckInfo ack = (AckInfo)acks.get(0);
+
del.acknowledge(ack);
state.getToAck().clear();
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -44,6 +44,7 @@
import org.jboss.jms.message.StreamMessageProxy;
import org.jboss.jms.message.TextMessageProxy;
import org.jboss.jms.tx.AckInfo;
+import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
/**
@@ -60,6 +61,9 @@
{
// Constants -----------------------------------------------------
+ private static final Logger log = Logger.getLogger(ClientSessionDelegate.class);
+
+
private static final long serialVersionUID = -8096852898620279131L;
// Attributes ----------------------------------------------------
@@ -76,7 +80,7 @@
public ClientSessionDelegate()
{
}
-
+
// SessionDelegate implementation --------------------------------
/**
@@ -293,7 +297,7 @@
* This invocation should either be handled by the client-side interceptor chain or by the
* server-side endpoint.
*/
- public void postDeliver(MessageProxy proxy, int consumerID) throws JMSException
+ public void postDeliver() throws JMSException
{
throw new IllegalStateException("This invocation should not be handled here!");
}
Modified: trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -157,7 +157,7 @@
// add anything to the tx for this session
if (!isConnectionConsumer)
{
- sess.postDeliver(m, consumerID);
+ sess.postDeliver();
}
}
@@ -280,13 +280,13 @@
}
this.listener = listener;
-
- if (!buffer.isEmpty())
+
+ if (listener != null && !buffer.isEmpty())
{
listenerRunning = true;
this.queueRunner(new ListenerRunner());
- }
- }
+ }
+ }
}
public void close() throws JMSException
@@ -306,56 +306,63 @@
{
//Wake up any receive() thread that might be waiting
mainLock.notify();
- }
+ }
- //Wait for any on message executions to complete
+ this.listener = null;
+ }
- Future result = new Future();
+ waitForOnMessageToComplete();
+
+ //Now we cancel anything left in the buffer
+ //The reason we do this now is that otherwise the deliveries wouldn't get cancelled
+ //until session close (since we don't cancel consumer's deliveries until then)
+ //which is too late - since we need to preserve the order of messages delivered in a session.
+
+ if (!buffer.isEmpty())
+ {
+ //Now we cancel any deliveries that might be waiting in our buffer
+ //This is because, otherwise the messages wouldn't get cancelled until
+ //the corresponding session died.
+ //So if another consumer in another session tried to consume from the channel
+ //before that session died it wouldn't receive those messages
+ Iterator iter = buffer.iterator();
- try
- {
- this.sessionExecutor.execute(new Closer(result));
+ List ackInfos = new ArrayList();
+ while (iter.hasNext())
+ {
+ MessageProxy mp = (MessageProxy)iter.next();
- result.getResult();
+ AckInfo ack = new AckInfo(mp, consumerID);
+
+ ackInfos.add(ack);
+
}
- catch (InterruptedException e)
- {
- log.warn("Thread interrupted", e);
- }
+
+ sessionDelegate.cancelDeliveries(ackInfos);
- //Now we cancel anything left in the buffer
- //The reason we do this now is that otherwise the deliveries wouldn't get cancelled
- //until session close (since we don't cancel consumer's deliveries until then)
- //which is too late - since we need to preserve the order of messages delivered in a session.
-
- if (!buffer.isEmpty())
- {
- //Now we cancel any deliveries that might be waiting in our buffer
- //This is because, otherwise the messages wouldn't get cancelled until
- //the corresponding session died.
- //So if another consumer in another session tried to consume from the channel
- //before that session died it wouldn't receive those messages
- Iterator iter = buffer.iterator();
-
- List ackInfos = new ArrayList();
- while (iter.hasNext())
- {
- MessageProxy mp = (MessageProxy)iter.next();
-
- AckInfo ack = new AckInfo(mp, consumerID);
-
- ackInfos.add(ack);
-
- }
-
- sessionDelegate.cancelDeliveries(ackInfos);
-
- buffer.clear();
- }
- }
+ buffer.clear();
+ }
if (trace) { log.trace(this + " closed"); }
}
+
+ private void waitForOnMessageToComplete()
+ {
+ //Wait for any on message executions to complete
+
+ Future result = new Future();
+
+ try
+ {
+ this.sessionExecutor.execute(new Closer(result));
+
+ result.getResult();
+ }
+ catch (InterruptedException e)
+ {
+ log.warn("Thread interrupted", e);
+ }
+ }
/**
* Method used by the client thread to get a Message, if available.
@@ -671,6 +678,13 @@
synchronized (mainLock)
{
+ if (listener == null)
+ {
+ listenerRunning = false;
+
+ return;
+ }
+
//remove a message from the buffer
if (buffer.isEmpty())
Modified: trunk/src/main/org/jboss/jms/client/state/ConnectionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/state/ConnectionState.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -30,8 +30,6 @@
import org.jboss.jms.tx.ResourceManager;
import org.jboss.logging.Logger;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
import EDU.oswego.cs.dl.util.concurrent.SyncSet;
import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
@@ -56,16 +54,6 @@
private String serverID;
- //Thread pool used for making asynch calls to server - e.g. activateConsumer
- private static PooledExecutor pooledExecutor;
-
- static
- {
- //TODO Make size configurable
- pooledExecutor = new PooledExecutor(new LinkedQueue(), 40);
- pooledExecutor.setMinimumPoolSize(40);
- }
-
private Version versionToUse;
public ConnectionState(String serverID, ConnectionDelegate delegate,
@@ -100,11 +88,6 @@
return idGenerator;
}
- public PooledExecutor getPooledExecutor()
- {
- return pooledExecutor;
- }
-
public JMSRemotingConnection getRemotingConnection()
{
return remotingConnection;
Modified: trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -28,6 +28,7 @@
import org.jboss.jms.client.remoting.MessageCallbackHandler;
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.server.Version;
+import org.jboss.logging.Logger;
/**
* State corresponding to a Consumer. This state is acessible inside aspects/interceptors.
@@ -39,6 +40,9 @@
*/
public class ConsumerState extends HierarchicalStateSupport
{
+ private static final Logger log = Logger.getLogger(ConsumerState.class);
+
+
private Destination destination;
private String selector;
@@ -111,7 +115,7 @@
{
return prefetchSize;
}
-
+
}
Modified: trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -67,7 +67,7 @@
void preDeliver(MessageProxy proxy, int consumerID) throws JMSException;
- void postDeliver(MessageProxy proxy, int consumerID) throws JMSException;
+ void postDeliver() throws JMSException;
MessageListener getMessageListener() throws JMSException;
Modified: trunk/src/main/org/jboss/jms/message/MessageProxy.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/MessageProxy.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/message/MessageProxy.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -458,7 +458,7 @@
return state == STATE_SENT;
}
- protected boolean isReceived()
+ public boolean isReceived()
{
return state == STATE_RECEIVED;
}
Modified: trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/ConnectionFactoryManager.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -39,7 +39,10 @@
*/
int registerConnectionFactory(String clientID, JNDIBindings jndiBindings,
String locatorURI, boolean clientPing,
- int prefetchSize) throws Exception;
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize) throws Exception;
void unregisterConnectionFactory(int connectionFactoryID) throws Exception;
Modified: trunk/src/main/org/jboss/jms/server/QueuedExecutorPool.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/QueuedExecutorPool.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/QueuedExecutorPool.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -45,4 +45,19 @@
{
return new QueuedExecutor();
}
+
+ public void shutdown()
+ {
+ for (int i = 0; i < entries.length; i++)
+ {
+ QueuedExecutor q = (QueuedExecutor)entries[i];
+
+ if (q != null)
+ {
+ q.shutdownAfterProcessingCurrentlyQueuedTasks();
+ }
+ }
+
+ entries = null;
+ }
}
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -260,6 +260,8 @@
unloadServerAOPConfig();
// TODO unloadClientAOPConfig();
+
+ queuedExecutorPool.shutdown();
log.info("JMS " + this + " stopped");
}
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -37,6 +37,10 @@
protected int connectionFactoryID;
protected JNDIBindings jndiBindings;
protected int prefetchSize = 150;
+
+ protected int defaultTempQueueFullSize = 75000;
+ protected int defaultTempQueuePageSize = 2000;
+ protected int defaultTempQueueDownCacheSize = 2000;
protected ObjectName serverPeerObjectName;
protected ConnectionFactoryManager connectionFactoryManager;
@@ -102,7 +106,8 @@
}
connectionFactoryID = connectionFactoryManager.
- registerConnectionFactory(clientID, jndiBindings, locatorURI, enablePing, prefetchSize);
+ registerConnectionFactory(clientID, jndiBindings, locatorURI, enablePing, prefetchSize,
+ defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
InvokerLocator locator = new InvokerLocator(locatorURI);
String info =
@@ -146,6 +151,36 @@
// JMX managed attributes ----------------------------------------
+ public int getDefaultTempQueueFullSize()
+ {
+ return defaultTempQueueFullSize;
+ }
+
+ public void setDefaultTempQueueFullSize(int size)
+ {
+ this.defaultTempQueueFullSize = size;
+ }
+
+ public int getDefaultTempQueuePageSize()
+ {
+ return defaultTempQueuePageSize;
+ }
+
+ public void setDefaultTempQueuePageSize(int size)
+ {
+ this.defaultTempQueuePageSize = size;
+ }
+
+ public int getDefaultTempQueueDownCacheSize()
+ {
+ return defaultTempQueueDownCacheSize;
+ }
+
+ public void setDefaultTempQueueDownCacheSize(int size)
+ {
+ this.defaultTempQueueDownCacheSize = size;
+ }
+
public int getPrefetchSize()
{
return prefetchSize;
Modified: trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -76,13 +76,17 @@
JNDIBindings jndiBindings,
String locatorURI,
boolean clientPing,
- int prefetchSize) throws Exception
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize) throws Exception
{
int id = serverPeer.getNextObjectID();
ServerConnectionFactoryEndpoint endpoint =
new ServerConnectionFactoryEndpoint(id, serverPeer, clientID, jndiBindings,
- prefetchSize);
+ prefetchSize, defaultTempQueueFullSize,
+ defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
ClientConnectionFactoryDelegate delegate = new ClientConnectionFactoryDelegate(id, locatorURI,
serverPeer.getVersion(),
Modified: trunk/src/main/org/jboss/jms/server/destination/Queue.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/Queue.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/destination/Queue.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -82,7 +82,7 @@
JBossQueue jbq = new JBossQueue(name);
org.jboss.messaging.core.local.Queue q = (org.jboss.messaging.core.local.Queue)cm.getCoreDestination(jbq);
- q.removeAllMessages();
+ q.removeAllReferences();
}
catch (Throwable t)
{
Modified: trunk/src/main/org/jboss/jms/server/destination/Topic.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/Topic.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/destination/Topic.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -74,7 +74,7 @@
while (iter.hasNext())
{
Object sub = iter.next();
- ((Subscription)sub).removeAllMessages();
+ ((Subscription)sub).removeAllReferences();
}
}
catch (Throwable t)
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -56,6 +56,7 @@
import org.jboss.messaging.core.Message;
import org.jboss.messaging.core.MessageReference;
import org.jboss.messaging.core.local.CoreDestination;
+import org.jboss.messaging.core.local.Queue;
import org.jboss.messaging.core.tx.Transaction;
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.messaging.core.util.ConcurrentReaderHashSet;
@@ -123,11 +124,20 @@
private byte usingVersion;
private int prefetchSize;
+
+ protected int defaultTempQueueFullSize;
+
+ protected int defaultTempQueuePageSize;
+
+ protected int defaultTempQueueDownCacheSize;
// Constructors --------------------------------------------------
protected ServerConnectionEndpoint(ServerPeer serverPeer, String clientID,
- String username, String password, int prefetchSize)
+ String username, String password, int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize)
{
this.serverPeer = serverPeer;
@@ -141,6 +151,10 @@
this.connectionID = serverPeer.getNextObjectID();
this.clientID = clientID;
this.prefetchSize = prefetchSize;
+
+ this.defaultTempQueueFullSize = defaultTempQueueFullSize;
+ this.defaultTempQueuePageSize = defaultTempQueuePageSize;
+ this.defaultTempQueueDownCacheSize = defaultTempQueueDownCacheSize;
sessions = new ConcurrentReaderHashMap();
temporaryDestinations = new ConcurrentReaderHashSet();
@@ -289,7 +303,14 @@
for(Iterator i = temporaryDestinations.iterator(); i.hasNext(); )
{
JBossDestination dest = (JBossDestination)i.next();
- channelMapper.undeployTemporaryCoreDestination(dest.isQueue(), dest.getName());
+ CoreDestination cd = channelMapper.undeployTemporaryCoreDestination(dest.isQueue(), dest.getName());
+ if (dest.isQueue())
+ {
+ //If it's a temp queue then remove it's data-
+ //If it's a topic then the data in the consumers will have been removed when they were closed
+ Queue queue = (Queue)cd;
+ queue.removeAllReferences();
+ }
}
temporaryDestinations.clear();
@@ -501,7 +522,22 @@
{
return prefetchSize;
}
-
+
+ public int getDefaultTempQueueFullSize()
+ {
+ return defaultTempQueueFullSize;
+ }
+
+ public int getDefaultTempQueuePageSize()
+ {
+ return defaultTempQueuePageSize;
+ }
+
+ public int getDefaultTempQueueDownCacheSize()
+ {
+ return defaultTempQueueDownCacheSize;
+ }
+
public String toString()
{
return "ConnectionEndpoint[" + connectionID + "]";
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -61,6 +61,13 @@
private JNDIBindings jndiBindings;
private int prefetchSize;
+
+ protected int defaultTempQueueFullSize;
+
+ protected int defaultTempQueuePageSize;
+
+ protected int defaultTempQueueDownCacheSize;
+
// Constructors --------------------------------------------------
@@ -71,13 +78,19 @@
public ServerConnectionFactoryEndpoint(int id, ServerPeer serverPeer,
String defaultClientID,
JNDIBindings jndiBindings,
- int preFetchSize)
+ int preFetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize)
{
this.serverPeer = serverPeer;
this.clientID = defaultClientID;
this.id = id;
this.jndiBindings = jndiBindings;
this.prefetchSize = preFetchSize;
+ this.defaultTempQueueFullSize = defaultTempQueueFullSize;
+ this.defaultTempQueuePageSize = defaultTempQueuePageSize;
+ this.defaultTempQueueDownCacheSize = defaultTempQueueDownCacheSize;
}
// ConnectionFactoryDelegate implementation ----------------------
@@ -107,7 +120,8 @@
// create the corresponding "server-side" connection endpoint and register it with the
// server peer's ClientManager
ServerConnectionEndpoint endpoint =
- new ServerConnectionEndpoint(serverPeer, clientID, username, password, prefetchSize);
+ new ServerConnectionEndpoint(serverPeer, clientID, username, password, prefetchSize,
+ defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
int connectionID = endpoint.getConnectionID();
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -133,7 +133,7 @@
throws InvalidSelectorException
{
if (trace) { log.trace("creating consumer endpoint " + id); }
-
+
this.id = id;
this.channel = channel;
this.sessionEndpoint = sessionEndpoint;
@@ -189,8 +189,7 @@
//and when we do clustering we will have to replicate it too!!
//Let's GET RID OF IT!!!!!!!!!!!
this.deliveries = new LinkedHashMap();
-
-
+
this.started = this.sessionEndpoint.getConnectionEndpoint().isStarted(); // adding the consumer to the channel
this.channel.add(this);
@@ -240,6 +239,11 @@
boolean selectorRejected = !this.accept(message);
SimpleDelivery delivery = new SimpleDelivery(observer, ref, false, !selectorRejected);
+
+ if (selectorRejected)
+ {
+ return delivery;
+ }
checkDeliveryCount(delivery);
@@ -249,26 +253,7 @@
}
deliveries.put(new Long(ref.getMessageID()), delivery);
- if (selectorRejected)
- {
- // we "arrest" the message so we can get the next one
- // TODO this DOES NOT scale. With a poor usage pattern, we may end with a lot of
- // arrested messages sitting here for nothing. Review this:
- // http://jira.jboss.org/jira/browse/JBMESSAGING-275
- if (trace) { log.trace(this + " DOES NOT accept the message because the selector rejected it"); }
-
- //FIXME - This hack also breaks delivery behaviour - if there are multiple competing consumers
- //on the same queue, each with a different selector, then if the message arrives at one receiver
- //(e.g. this one) and doesn't match the selector, then it is arrested, which means the
- //PointToPointRouter does not try the next receiver which does match.
- //See
- // ... however, keep asking for messages, the fact that this one wasn't accepted doesn't
- // mean that the next one it won't.
-
- return delivery;
- }
-
// We don't send the message as-is, instead we create a MessageProxy instance. This allows
// local fields such as deliveryCount to be handled by the proxy but global data to be
// fielded by the same underlying Message instance. This allows us to avoid expensive
@@ -373,10 +358,17 @@
if (!sub.isRecoverable())
{
//We don't disconnect durable subs
- sub.disconnect();
+ sub.disconnect();
}
}
+ //If it's non recoverable, i.e. it's a non durable sub or a temporary queue
+ //then remove all it's references
+ if (!channel.isRecoverable())
+ {
+ channel.removeAllReferences();
+ }
+
closed = true;
}
}
@@ -507,19 +499,10 @@
if (d != null)
{
-
- //TODO - Selector kludge - remove this
- if (d.isSelectorAccepted())
- {
- d.acknowledge(null);
- }
- else
- {
- d.cancel();
- }
+ d.acknowledge(null);
}
else
- {
+ {
throw new IllegalStateException("Cannot find delivery to acknowledge:" + messageID);
}
}
@@ -677,26 +660,10 @@
/**
* Disconnect this consumer from the Channel that feeds it. This method does not clear up
- * deliveries, except the "arrested" ones
+ * deliveries
*/
private void disconnect()
{
- // clean up "arrested" deliveries, no acknowledgment will ever come for them
- for(Iterator i = deliveries.values().iterator(); i.hasNext(); )
- {
- SingleReceiverDelivery d = (SingleReceiverDelivery)i.next();
- if (!d.isSelectorAccepted())
- {
- try
- {
- d.cancel();
- }
- catch(Throwable t)
- {
- log.error("Failed to cancel delivery " + d, t);
- }
- }
- }
boolean removed = channel.remove(this);
@@ -725,7 +692,6 @@
log.error("Failed to acknowledge delivery", t);
}
}
-
}
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -413,8 +413,7 @@
public void send(JBossMessage message) throws JMSException
{
try
- {
- log.info("Received message:" + message);
+ {
connectionEndpoint.sendMessage(message, null);
}
catch (Throwable t)
@@ -511,9 +510,12 @@
connectionEndpoint.addTemporaryDestination(dest);
//FIXME - Params should not be hardcoded
- long id = this.getConnectionEndpoint().getServerPeer().getNextObjectID();
+ long id = connectionEndpoint.getServerPeer().getNextObjectID();
- cm.deployTemporaryCoreDestination(dest.isQueue(), dest.getName(), id, ms, pm, mm, 50000, 1000, 1000);
+ cm.deployTemporaryCoreDestination(dest.isQueue(), dest.getName(), id, ms, pm, mm,
+ connectionEndpoint.getDefaultTempQueueFullSize(),
+ connectionEndpoint.getDefaultTempQueuePageSize(),
+ connectionEndpoint.getDefaultTempQueueDownCacheSize());
}
catch (Throwable t)
{
Deleted: trunk/src/main/org/jboss/jms/server/plugin/DefaultThreadPool.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/plugin/DefaultThreadPool.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/plugin/DefaultThreadPool.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -1,100 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.jms.server.plugin;
-
-import org.jboss.jms.server.plugin.contract.ThreadPool;
-import org.jboss.logging.Logger;
-import org.jboss.system.ServiceMBeanSupport;
-import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-
-/**
- * A thread pool implementation based on Doug Lea's PooledExecutor.
- *
- * The buffer(queue) of the pool must be unbounded to avoid potential distributed deadlock. Since
- * the buffer is unbounded, the minimum pool size has to be the same as the maximum. Otherwise, we
- * will never have more than getMinimumPoolSize threads running.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class DefaultThreadPool extends ServiceMBeanSupport implements ThreadPool
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(DefaultThreadPool.class);
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- protected PooledExecutor executor;
-
- // Constructors --------------------------------------------------
-
- public DefaultThreadPool(int size)
- {
- executor = new PooledExecutor(new LinkedQueue(), size);
- executor.setMinimumPoolSize(size);
- log.debug("default thread pool size " + size);
- }
-
- // ServiceMBeanSupport overrides ---------------------------------
-
- protected void startService() throws Exception
- {
- log.debug(this + " started");
- }
-
- protected void stopService() throws Exception
- {
- log.debug(this + " stopped");
- }
-
- // ThreadPool implementation -----------------------------
-
- public Object getInstance()
- {
- return this;
- }
-
- public void execute(Runnable runnable) throws InterruptedException
- {
- executor.execute(runnable);
- }
-
- // Public --------------------------------------------------------
-
- /**
- * Managed attribute.
- */
- public void setSize(int i)
- {
- executor.setMinimumPoolSize(i);
- executor.setMaximumPoolSize(i);
-
- log.debug("setting pool size to " + i);
- }
-
- /**
- * Managed attribute.
- */
- public int getSize()
- {
- return executor.getMaximumPoolSize();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/jboss/jms/server/plugin/contract/ThreadPool.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/plugin/contract/ThreadPool.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/plugin/contract/ThreadPool.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -1,23 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.jms.server.plugin.contract;
-
-import org.jboss.messaging.core.plugin.contract.ServerPlugin;
-
-/**
- * A thread pool contract. The pool implementation controls how threads are allocated to deliver
- * messages to consumers.
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public interface ThreadPool extends ServerPlugin
-{
- void execute(Runnable runnable) throws InterruptedException;
-}
Modified: trunk/src/main/org/jboss/jms/server/subscription/DurableSubscription.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/subscription/DurableSubscription.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/server/subscription/DurableSubscription.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -65,12 +65,10 @@
return clientID;
}
- public void unsubscribe() throws Exception
+ public void unsubscribe() throws Throwable
{
disconnect();
- if (pm != null)
- {
- pm.removeAllChannelData(this.channelID);
- }
+
+ this.removeAllReferences();
}
}
Modified: trunk/src/main/org/jboss/jms/util/ExceptionUtil.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/ExceptionUtil.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/util/ExceptionUtil.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -24,6 +24,7 @@
import javax.jms.JMSException;
import org.jboss.logging.Logger;
+import org.jboss.util.id.GUID;
/**
* A ExceptionUtil
@@ -54,8 +55,13 @@
*/
public static JMSException handleJMSInvocation(Throwable t, String msg)
{
+ //We create a GUID and log it and send it in the client exception.
+ //This allows what is received at the client to be correlated if necessary
+ //to what is logged in the server logs
+ String id = new GUID().toString();
+
//First we log the Throwable
- log.error(msg, t);
+ log.error(msg + " [" + id + "]", t);
if (t instanceof JMSException)
{
@@ -64,7 +70,7 @@
else
{
JMSException e = new MessagingJMSException("A failure has occurred during processing of the request. " +
- "Please consult the server logs for more details. " + msg);
+ "Please consult the server logs for more details. " + msg + " [" + id + "]");
return e;
}
}
Modified: trunk/src/main/org/jboss/jms/util/MessagingTransactionRolledBackException.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/MessagingTransactionRolledBackException.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/util/MessagingTransactionRolledBackException.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -23,8 +23,6 @@
import javax.jms.TransactionRolledBackException;
-import org.jboss.logging.Logger;
-
/**
*
* A JBossTransactionRolledBackException.
@@ -40,9 +38,6 @@
private static final long serialVersionUID = -1395246656299977995L;
- private static final Logger log = Logger.getLogger(MessagingTransactionRolledBackException.class);
-
-
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/util/SafeUTF.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/SafeUTF.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/util/SafeUTF.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -25,8 +25,6 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.jboss.logging.Logger;
-
/**
*
* A SafeUTF
@@ -52,9 +50,6 @@
*/
public class SafeUTF
{
- private static final Logger log = Logger.getLogger(SafeUTF.class);
-
-
//Default is 16K chunks
private static final int CHUNK_SIZE = 16 * 1024;
Modified: trunk/src/main/org/jboss/jms/util/XMLException.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/XMLException.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/util/XMLException.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -30,6 +30,8 @@
public class XMLException extends Exception
{
// Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -1766745141220167507L;
// Static --------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/util/XMLRuntimeException.java
===================================================================
--- trunk/src/main/org/jboss/jms/util/XMLRuntimeException.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/jms/util/XMLRuntimeException.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -14,13 +14,15 @@
public class XMLRuntimeException extends RuntimeException
{
// Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = -8900987884583231425L;
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
// Constructors --------------------------------------------------
-
+
public XMLRuntimeException(String msg)
{
super(msg);
Modified: trunk/src/main/org/jboss/messaging/core/Channel.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/Channel.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/Channel.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -135,6 +135,12 @@
* @throws Exception
*/
void load() throws Exception;
+
+ /**
+ * Remove all the references in the channel
+ * @throws Throwable
+ */
+ void removeAllReferences() throws Throwable;
}
Modified: trunk/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/ChannelSupport.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -23,9 +23,11 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
@@ -44,9 +46,9 @@
import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
/**
- * A basic channel implementation. It supports atomicity, isolation and, if a
- * non-null PersistenceManager is available, it supports recoverability of
- * reliable messages. The channel implementation here uses a "SEDA-type"
+ * Channel implementation. It supports atomicity, isolation and recoverability of
+ * reliable messages.
+ * The channel implementation here uses a "SEDA-type"
* approach, where requests to handle messages, deliver to receivers or
* acknowledge messages are not executed concurrently but placed on an event
* queue and executed serially by a single thread. This prevents lock contention
@@ -382,6 +384,8 @@
//FIXME - This is currently broken since it doesn't take into account
// refs paged into persistent storage
// Also is very inefficient since it makes a copy
+
+ //TODO use the ref queue iterator
List references = delivering(filter);
List undel = undelivered(filter);
@@ -435,35 +439,53 @@
router.clear();
router = null;
}
- }
-
- public void removeAllMessages()
- {
+
+ }
+
+ /*
+ * This method clears the channel.
+ * Basically it acknowledges any outstanding deliveries and consumes the rest of the messages in the channel.
+ * We can't just delete the corresponding references directly from the database since
+ * a) We might be paging
+ * b) The message might remain in the message store causing a leak
+ *
+ */
+ public void removeAllReferences() throws Throwable
+ {
synchronized (refLock)
{
synchronized (deliveryLock)
{
- // Remove all deliveries
+ //Ack the deliveries
+
+ //Clone to avoid ConcurrentModificationException
+ Set dels = new HashSet(deliveries);
- Iterator iter = deliveries.iterator();
+ Iterator iter = dels.iterator();
while (iter.hasNext())
{
- Delivery d = (Delivery) iter.next();
- MessageReference r = d.getReference();
- removeCompletely(r);
+ SimpleDelivery d = (SimpleDelivery) iter.next();
+
+ d.acknowledge(null);
}
- deliveries.clear();
-
- // Remove all holding messages
-
- iter = messageRefs.getAll().iterator();
- while (iter.hasNext())
+
+ //Now we consume the rest of the messages
+ //This may take a while if we have a lot of messages including perhaps millions
+ //paged in the database - but there's no obvious other way to do it.
+ //We cannot just delete them directly from the database - because we may end up with messages leaking
+ //in the message store,
+ //also we might get race conditions when other channels are updating the same message in the db
+
+ //Note - we don't do this in a tx - because the tx could be too big if we have millions of refs
+ //paged in storage
+
+ MessageReference ref;
+ while ((ref = removeFirstInMemory()) != null)
{
- MessageReference r = (MessageReference) iter.next();
- removeCompletely(r);
+ SimpleDelivery del = new SimpleDelivery(this, ref, false);
+
+ del.acknowledge(null);
}
- messageRefs.clear();
-
}
}
}
@@ -623,13 +645,31 @@
{
try
{
+ //The iterator is used to iterate through the refs in the channel in the case
+ //That they don't match the selectors of any receivers
+ ListIterator iter = null;
+
+ MessageReference ref = null;
+
while (true)
- {
- MessageReference ref;
-
+ {
synchronized (refLock)
- {
- ref = (MessageReference) messageRefs.peekFirst();
+ {
+ if (iter == null)
+ {
+ ref = (MessageReference) messageRefs.peekFirst();
+ }
+ else
+ {
+ if (iter.hasNext())
+ {
+ ref = (MessageReference)iter.next();
+ }
+ else
+ {
+ ref = null;
+ }
+ }
}
if (ref != null)
@@ -639,61 +679,66 @@
// If so ack it from the channel
if (ref.isExpired())
{
- if (trace)
+ if (trace) { log.trace("Message reference: " + ref + " has expired"); }
+
+ // remove and acknowledge it
+ if (iter == null)
{
- log.trace("Message reference: " + ref + " has expired");
+ removeFirstInMemory();
}
+ else
+ {
+ iter.remove();
+ }
- // remove and acknowledge it
-
- removeFirstInMemory();
-
Delivery delivery = new SimpleDelivery(this, ref, true);
- // TODO - is this stage really necessary?
- synchronized (deliveryLock)
- {
- deliveries.add(delivery);
- }
-
acknowledgeInternal(delivery);
}
else
{
// Reference is not expired
- // Push the ref to a receiver
+ // Attempt to push the ref to a receiver
Delivery del = push(ref);
if (del == null)
{
- // no receiver, receiver that doesn't accept the message or
- // broken receiver
+ // 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");
+ log.trace("Delivery is now complete"); }
- if (trace)
- {
- log.trace(this + ": no delivery returned for message"
- + ref + " so no receiver got the message");
- }
-
- // Now we stop delivering
-
- if (trace)
- {
- log.trace("Delivery is now complete");
- }
-
receiversReady = false;
return;
}
+ else if (!del.isSelectorAccepted())
+ {
+ // No receiver accepted the message because no selectors matched
+ // So we create an iterator (if we haven't already created it) to
+ // iterate through the refs in the channel
+ // TODO Note that this is only a partial solution since if there are messages paged to storage
+ // it won't try those - i.e. it will only iterate through those refs in memory.
+ // Dealing with refs in storage is somewhat tricky since we can't just load them and iterate
+ // through them since we might run out of memory
+ // So we will need to load individual refs from storage given the selector expressions
+ // Secondly we should also introduce some in memory indexes here to prevent having to
+ // iterate through all the refs every time
+ // Having said all that, having consumers on a queue that don't match many messages
+ // is an antipattern and should be avoided by the user
+ if (iter == null)
+ {
+ iter = messageRefs.iterator();
+ }
+ }
else
{
- if (trace)
- {
- log.trace(this + ": delivery returned for message:"
- + ref);
- }
+ if (trace) { log.trace(this + ": delivery returned for message:" + ref); }
+
+ //Receiver accepted the reference
// We must synchronize here to cope with another race
// condition where message is
@@ -704,11 +749,7 @@
// delivery being added (observed).
synchronized (del)
{
- if (trace)
- {
- log.trace(this + " incrementing delivery count for "
- + del);
- }
+ if (trace) { log.trace(this + " incrementing delivery count for " + del); }
// FIXME - It's actually possible the delivery could be
// cancelled before it reaches
@@ -721,26 +762,18 @@
// http://jira.jboss.com/jira/browse/JBMESSAGING-355
// This will make life a lot easier
- // Note we don't increment the delivery count if the
- // message didn't match the selector
- // FIXME - this is a temporary hack that will disappear
- // once
- // http://jira.jboss.org/jira/browse/JBMESSAGING-275
- // is solved
- boolean incrementCount = true;
- if (del instanceof SimpleDelivery)
- {
- SimpleDelivery sd = (SimpleDelivery) del;
- incrementCount = sd.isSelectorAccepted();
- }
- if (incrementCount)
- {
- del.getReference().incrementDeliveryCount();
- }
+ del.getReference().incrementDeliveryCount();
if (!del.isCancelled())
{
- removeFirstInMemory();
+ if (iter == null)
+ {
+ removeFirstInMemory();
+ }
+ else
+ {
+ iter.remove();
+ }
// delivered
if (!del.isDone())
@@ -759,10 +792,7 @@
else
{
// No more refs in channel
- if (trace)
- {
- log.trace(this + " no more refs to deliver ");
- }
+ if (trace) { log.trace(this + " no more refs to deliver "); }
break;
}
}
@@ -794,7 +824,17 @@
try
{
-
+ if (ref.isReliable() && !recoverable)
+ {
+ //Reliable reference in a non recoverable channel-
+ //We handle it as a non reliable reference
+ //It's important that we set it to non reliable otherwise if the channel
+ //pages and is non recoverable a reliable ref will be paged in the database as reliable
+ //which makes them hard to remove on server restart.
+ //If we always page them as unreliable then it is easy to remove them.
+ ref.setReliable(false);
+ }
+
if (tx == null)
{
// Don't even attempt synchronous delivery for a reliable message
@@ -812,33 +852,20 @@
return null;
}
- checkMemory();
+ checkMemory();
ref.setOrdering(messageOrdering.increment());
-
- if (ref.isReliable())
+
+ if (ref.isReliable() && recoverable)
{
- if (recoverable)
+ // Reliable message in a recoverable state - also add to db
+ if (trace)
{
- // Reliable message in a recoverable state - also add to db
- if (trace)
- {
- log.trace("adding " + ref
- + " to database non-transactionally");
- }
-
- pm.addReference(channelID, ref, null);
+ log.trace("adding " + ref
+ + " to database non-transactionally");
}
- else
- {
- //Reliable reference in a non recoverable channel-
- //We handle it as a non reliable reference
- //It's important that we set it to non reliable otherwise if the channel
- //pages and is non recoverable a reliable ref will be paged in the database as reliable
- //which makes them hard to remove on server restart.
- //If we always page them as unreliable then it is easy to remove them.
- ref.setReliable(false);
- }
+
+ pm.addReference(channelID, ref, null);
}
addReferenceInMemory(ref);
@@ -852,7 +879,7 @@
deliverInternal();
}
}
- else
+ else
{
if (trace)
{
@@ -873,9 +900,7 @@
// transaction
if (trace)
{
- log
- .trace(this
- + " cannot handle reliable messages, dooming the transaction");
+ log.trace(this + " cannot handle reliable messages, dooming the transaction");
}
tx.setRollbackOnly();
}
@@ -1281,8 +1306,7 @@
// Must flush the down cache first
flushDownCache();
- List refInfos = pm.getReferenceInfos(channelID, loadFromOrderingValue,
- number);
+ List refInfos = pm.getReferenceInfos(channelID, loadFromOrderingValue,number);
// We may load less than desired due to "holes" - this is ok
int numberLoaded = refInfos.size();
@@ -1302,8 +1326,7 @@
// Put the refs that we already have messages for in a map
while (iter.hasNext())
{
- PersistenceManager.ReferenceInfo info = (PersistenceManager.ReferenceInfo) iter
- .next();
+ PersistenceManager.ReferenceInfo info = (PersistenceManager.ReferenceInfo) iter.next();
long msgId = info.getMessageId();
@@ -1350,7 +1373,7 @@
// return a reference
// to the pre-existing message
MessageReference ref = ms.reference(m);
-
+
refMap.put(new Long(m.getMessageID()), ref);
}
}
@@ -1385,7 +1408,15 @@
ref.setDeliveryCount(info.getDeliveryCount());
ref.setOrdering(info.getOrdering());
-
+
+ //We ignore the reliable field from the message - this is because reliable might be true on the message
+ //but this is a non recoverable state
+
+ //FIXME - Really the message shouldn't have a reliable field at all,
+ //Reliability is an attribute of the message reference, not the message
+
+ ref.setReliable(info.isReliable());
+
messageRefs.addLast(ref, ref.getPriority());
if (recoverable && ref.isReliable())
@@ -1447,25 +1478,8 @@
return callback;
}
+
- protected void removeCompletely(MessageReference r)
- {
- if (recoverable && r.isReliable())
- {
- try
- {
- pm.removeReference(channelID, r, null);
- }
- catch (Exception e)
- {
- if (trace)
- {
- log.trace("removeAll() failed on removing " + r, e);
- }
- }
- }
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/SimpleDelivery.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/SimpleDelivery.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/SimpleDelivery.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -83,6 +83,7 @@
this.done = done;
this.reference = reference;
this.observer = observer;
+ this.selectorAccepted = true;
}
public SimpleDelivery(DeliveryObserver observer, MessageReference reference, boolean done,
Modified: trunk/src/main/org/jboss/messaging/core/distributed/replicator/ReplicatorTopology.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/distributed/replicator/ReplicatorTopology.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/distributed/replicator/ReplicatorTopology.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,29 +21,22 @@
*/
package org.jboss.messaging.core.distributed.replicator;
-import org.jboss.logging.Logger;
-import org.jboss.messaging.core.distributed.util.RpcServerCall;
-import org.jboss.messaging.util.NotYetImplementedException;
-import org.jboss.messaging.core.distributed.util.ServerResponse;
-import org.jboss.messaging.core.distributed.util.RpcServerCall;
-import org.jboss.messaging.core.distributed.util.ServerResponse;
-import org.jboss.messaging.core.distributed.replicator.Replicator;
-import org.jboss.messaging.core.distributed.DistributedException;
-import org.jboss.messaging.core.distributed.PeerIdentity;
-import org.jgroups.blocks.RpcDispatcher;
-import org.jgroups.Address;
-
import java.io.Serializable;
-import java.util.Observable;
-import java.util.Observer;
-import java.util.Set;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Collections;
-import java.util.Collection;
import java.util.Map;
-import java.util.HashMap;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.Set;
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.distributed.DistributedException;
+import org.jboss.messaging.util.NotYetImplementedException;
+import org.jgroups.Address;
+import org.jgroups.blocks.RpcDispatcher;
+
/**
* The Observers interested in topology changes should register here.
*
Modified: trunk/src/main/org/jboss/messaging/core/local/PointToPointRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/local/PointToPointRouter.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/local/PointToPointRouter.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,22 +21,24 @@
*/
package org.jboss.messaging.core.local;
-import org.jboss.messaging.core.Router;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Delivery;
import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Receiver;
import org.jboss.messaging.core.Routable;
-import org.jboss.messaging.core.Receiver;
-import org.jboss.messaging.core.Delivery;
+import org.jboss.messaging.core.Router;
+import org.jboss.messaging.core.SimpleDelivery;
import org.jboss.messaging.core.tx.Transaction;
-import org.jboss.logging.Logger;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Iterator;
-
/**
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
* $Id$
*/
@@ -67,6 +69,8 @@
{
Set deliveries = new HashSet();
+ boolean selectorRejected = false;
+
synchronized(receivers)
{
for(Iterator i = receivers.iterator(); i.hasNext(); )
@@ -81,9 +85,16 @@
if (d != null && !d.isCancelled())
{
- // deliver to the first receiver that acknowledges
- deliveries.add(d);
- break;
+ if (d.isSelectorAccepted())
+ {
+ // deliver to the first receiver that accepts
+ deliveries.add(d);
+ break;
+ }
+ else
+ {
+ selectorRejected = true;
+ }
}
}
catch(Throwable t)
@@ -93,6 +104,12 @@
}
}
}
+
+ if (deliveries.isEmpty() && selectorRejected)
+ {
+ deliveries.add(new SimpleDelivery(null, null, true, false));
+ }
+
return deliveries;
}
Modified: trunk/src/main/org/jboss/messaging/core/message/MessageSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/MessageSupport.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/message/MessageSupport.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -29,7 +29,6 @@
import java.io.Serializable;
import java.util.Map;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.Message;
import org.jboss.serial.io.JBossObjectInputStream;
import org.jboss.serial.io.JBossObjectOutputStream;
@@ -50,9 +49,6 @@
private static final long serialVersionUID = -4474943687659785336L;
- private static final Logger log = Logger.getLogger(MessageSupport.class);
-
-
// Attributes ----------------------------------------------------
// Must be hidden from subclasses
Modified: trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -90,9 +90,8 @@
{
// Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(JDBCPersistenceManager.class);
+ private static final Logger log = Logger.getLogger(JDBCPersistenceManager.class);
-
/* The default DML and DDL works with HSQLDB */
//JMS_MESSAGE_REFERENCE
@@ -130,7 +129,7 @@
protected String rollbackMessageRef2 = "UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'";
protected String loadReferenceInfo =
- "SELECT MESSAGEID, ORD, DELIVERYCOUNT FROM JMS_MESSAGE_REFERENCE "
+ "SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE "
+ "WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND "
+ "ORD BETWEEN ? AND ? ORDER BY ORD";
@@ -142,12 +141,11 @@
protected String updateReliableRefs =
"UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'";
+
+ protected String updateReliableRefsNotLoaded = "UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?";
- protected String deleteChannelMessageRefs = "DELETE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=?";
-
- protected String removeAllNonReliableRefs = "DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE='N'";
-
- protected String updateReliableRefsNotLoaded = "UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?";
+ protected String deleteUnreliableRefs =
+ "DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'";
//JMS_MESSAGE
@@ -175,7 +173,12 @@
protected String messageIdColumn = "MESSAGEID";
- protected String removeAllNonReliableMessages = "DELETE FROM JMS_MESSAGE WHERE RELIABLE='N'";
+ protected String updateUnreliableChannelCount =
+ "UPDATE JMS_MESSAGE M SET M.CHANNELCOUNT = M.CHANNELCOUNT - 1 WHERE " +
+ "M.MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)";
+
+ protected String deleteUnreffedMessages =
+ "DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0";
//JMS_TRANSACTION
@@ -200,6 +203,11 @@
protected String selectCounter = "SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?";
protected String insertCounter = "INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)";
+
+ //Other
+
+ protected String selectAllChannels = "SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE";
+
// Static --------------------------------------------------------
@@ -316,7 +324,7 @@
createSchema();
}
- resetMessageData();
+ removeUnreliableMessageData();
log.debug(this + " started");
}
@@ -1402,6 +1410,8 @@
do
{
+
+
ps = conn.prepareStatement(loadReferenceInfo);
ps.setLong(1, channelID);
@@ -1418,8 +1428,9 @@
long msgId = rs.getLong(1);
long ordering = rs.getLong(2);
int deliveryCount = rs.getInt(3);
+ boolean reliable = rs.getString(4).equals("Y");
- ReferenceInfo ri = new ReferenceInfo(msgId, ordering, deliveryCount);
+ ReferenceInfo ri = new ReferenceInfo(msgId, ordering, deliveryCount, reliable);
refs.add(ri);
@@ -1912,71 +1923,68 @@
wrap.end();
}
}
+
+// public void removeAllChannelData(long channelID) throws Exception
+// {
+// if (trace)
+// {
+// log.trace("removing all references for channel " + channelID);
+// }
+//
+// Connection conn = null;
+// PreparedStatement ps = null;
+// TransactionWrapper wrap = new TransactionWrapper();
+// boolean success = false;
+//
+// try
+// {
+// conn = ds.getConnection();
+//
+// ps = conn.prepareStatement(deleteChannelMessageRefs);
+//
+// ps.setLong(1, channelID);
+//
+// ps.executeUpdate();
+// success = true;
+// }
+// catch (Exception e)
+// {
+// wrap.exceptionOccurred();
+// throw e;
+// }
+// finally
+// {
+// if (trace)
+// {
+// String s = JDBCUtil.statementToString(deleteChannelMessageRefs, new Long(channelID));
+// log.trace(s + (success ? " successful" : "failed"));
+// }
+// if (ps != null)
+// {
+// try
+// {
+// ps.close();
+// }
+// catch (Throwable e)
+// {
+// }
+// }
+// if (conn != null)
+// {
+// try
+// {
+// conn.close();
+// }
+// catch (Throwable e)
+// {
+// }
+// }
+// wrap.end();
+// }
+// }
-
- public void removeAllChannelData(long channelID) throws Exception
- {
- if (trace)
- {
- log.trace("removing all references for channel " + channelID);
- }
-
- Connection conn = null;
- PreparedStatement ps = null;
- TransactionWrapper wrap = new TransactionWrapper();
- boolean success = false;
-
- try
- {
- conn = ds.getConnection();
-
- ps = conn.prepareStatement(deleteChannelMessageRefs);
-
- ps.setLong(1, channelID);
-
- ps.executeUpdate();
- success = true;
- }
- catch (Exception e)
- {
- wrap.exceptionOccurred();
- throw e;
- }
- finally
- {
- if (trace)
- {
- String s = JDBCUtil.statementToString(deleteChannelMessageRefs, new Long(channelID));
- log.trace(s + (success ? " successful" : "failed"));
- }
- if (ps != null)
- {
- try
- {
- ps.close();
- }
- catch (Throwable e)
- {
- }
- }
- if (conn != null)
- {
- try
- {
- conn.close();
- }
- catch (Throwable e)
- {
- }
- }
- wrap.end();
- }
- }
-
-
-
public List retrievePreparedTransactions() throws Exception
{
Connection conn = null;
@@ -2394,7 +2402,7 @@
}
protected void initSqlProperties()
- {
+ {
//Message Reference
createMessageReference = sqlProperties.getProperty("CREATE_MESSAGE_REF", createMessageReference);
createIdxMessageRefTx = sqlProperties.getProperty("CREATE_IDX_MESSAGE_REF_TX", createIdxMessageRefTx);
@@ -2413,20 +2421,20 @@
loadReferenceInfo = sqlProperties.getProperty("LOAD_REF_INFO", loadReferenceInfo);
selectCountReferences = sqlProperties.getProperty("SELECT_COUNT_REFS", selectCountReferences);
updateReliableRefs = sqlProperties.getProperty("UPDATE_RELIABLE_REFS", updateReliableRefs);
- deleteChannelMessageRefs = sqlProperties.getProperty("DELETE_CHANNEL_MESSAGE_REFS", deleteChannelMessageRefs);
- removeAllNonReliableRefs = sqlProperties.getProperty("REMOVE_ALL_NONRELIABLE_REFS", removeAllNonReliableRefs);
updateReliableRefsNotLoaded = sqlProperties.getProperty("UPDATE_RELIABLE_REFS_NOT_LOADED", updateReliableRefsNotLoaded);
selectMinOrdering = sqlProperties.getProperty("SELECT_MIN_ORDERING", selectMinOrdering);
-
+ deleteUnreliableRefs = sqlProperties.getProperty("DELETE_UNRELIABLE_REFS", deleteUnreliableRefs);
+
//Message
createMessage = sqlProperties.getProperty("CREATE_MESSAGE", createMessage);
loadMessages = sqlProperties.getProperty("LOAD_MESSAGES", loadMessages);
insertMessage = sqlProperties.getProperty("INSERT_MESSAGE", insertMessage);
- updateMessageChannelCount = sqlProperties.getProperty("UPDATE_MESSAGE_CHANNEL_COUNT", updateMessageChannelCount);
+ updateMessageChannelCount = sqlProperties.getProperty("UPDATE_MESSAGE_CHANNELCOUNT", updateMessageChannelCount);
deleteMessage = sqlProperties.getProperty("DELETE_MESSAGE", deleteMessage);
- messageIdColumn = sqlProperties.getProperty("MESSAGE_ID_COLUMN", messageIdColumn);
- removeAllNonReliableMessages = sqlProperties.getProperty("REMOVE_ALL_NONRELIABLE_MSGS", removeAllNonReliableMessages);
-
+ messageIdColumn = sqlProperties.getProperty("MESSAGEID_COLUMN", messageIdColumn);
+ updateUnreliableChannelCount = sqlProperties.getProperty("UPDATE_UNRELIABLE_CHANNELCOUNT", updateUnreliableChannelCount);
+ deleteUnreffedMessages = sqlProperties.getProperty("DELETE_UNREFFED_MESSAGES", deleteUnreffedMessages);
+
//Transaction
createTransaction = sqlProperties.getProperty("CREATE_TRANSACTION", createTransaction);
insertTransaction = sqlProperties.getProperty("INSERT_TRANSACTION", insertTransaction);
@@ -2437,9 +2445,10 @@
createCounter = sqlProperties.getProperty("CREATE_COUNTER", createCounter);
updateCounter = sqlProperties.getProperty("UPDATE_COUNTER", updateCounter);
selectCounter = sqlProperties.getProperty("SELECT_COUNTER", selectCounter);
- insertCounter = sqlProperties.getProperty("INSERT_COUNTER", insertCounter);
- //selectReferenceCount = sqlProperties.getProperty("SELECT_REF_COUNT", selectReferenceCount);
- //updateReferenceCount = sqlProperties.getProperty("UPDATE_REF_COUNT", updateReferenceCount);
+ insertCounter = sqlProperties.getProperty("INSERT_COUNTER", insertCounter);
+
+ //Other
+ selectAllChannels = sqlProperties.getProperty("SELECT_ALL_CHANNELS", selectAllChannels);
}
protected TransactionCallback getCallback(Transaction tx)
@@ -2466,52 +2475,73 @@
}
/*
- * Remove any non-persistent message data
- * Update any persistent refs to LOADED='N'
+ *
+ * We want to remove any non reliable refs from the database and any corresponding messages if their channel count
+ * has gone to zero
+ *
+ * TODO
+ * Really - this method only needs to be executed on start up if the server has crashed
+ * We should save a flag in the db at server shutdown and check for this at startup to see if there
+ * was a clean shutdown
+ *
*/
- protected void resetMessageData() throws Exception
+ protected void removeUnreliableMessageData() throws Exception
{
- if (trace) { log.trace("Removing all non-persistent data"); }
+ log.trace("Removing all non-persistent data");
Connection conn = null;
- PreparedStatement ps = null;
+ PreparedStatement psRes = null;
+ PreparedStatement psUpdate = null;
+ PreparedStatement psDeleteMsgs = null;
+ PreparedStatement psDeleteRefs = null;
TransactionWrapper wrap = new TransactionWrapper();
+
+ ResultSet rs = null;
- log.trace("Resetting message data. This may take several minutes for large queues/subscriptions...");
-
try
{
conn = ds.getConnection();
- log.debug("Removing all non-reliable message references");
+ psRes = conn.prepareStatement(selectAllChannels);
- ps = conn.prepareStatement(removeAllNonReliableRefs);
+ psUpdate = conn.prepareStatement(updateUnreliableChannelCount);
+
+ rs = psRes.executeQuery();
- int rows = ps.executeUpdate();
-
- if (trace)
+ while (rs.next())
{
- log.trace(JDBCUtil.statementToString(removeAllNonReliableRefs)
- + " removed " + rows + " rows");
+ long channelID = rs.getLong(1);
+
+ psUpdate.setLong(1, channelID);
+
+ int rows = psUpdate.executeUpdate();
+
+ if (trace)
+ {
+ log.trace(JDBCUtil.statementToString(updateUnreliableChannelCount)
+ + " updated " + rows + " rows");
+ }
}
- ps.close();
+ psDeleteRefs = conn.prepareStatement(deleteUnreliableRefs);
- ps = null;
-
- ps = conn.prepareStatement(removeAllNonReliableMessages);
+ int rows = psDeleteRefs.executeUpdate();
- rows = ps.executeUpdate();
-
if (trace)
{
- log.trace(JDBCUtil.statementToString(removeAllNonReliableMessages)
- + " removed " + rows + " rows");
+ log.trace(JDBCUtil.statementToString(deleteUnreliableRefs)
+ + " deleted " + rows + " rows");
}
+
+ psDeleteMsgs = conn.prepareStatement(deleteUnreffedMessages);
- ps.close();
+ rows = psDeleteMsgs.executeUpdate();
- ps = null;
+ if (trace)
+ {
+ log.trace(JDBCUtil.statementToString(deleteUnreffedMessages)
+ + " deleted " + rows + " rows");
+ }
}
catch (Exception e)
@@ -2521,16 +2551,56 @@
}
finally
{
- if (ps != null)
+ if (rs != null)
{
try
{
- ps.close();
+ rs.close();
}
catch (Throwable e)
{
}
}
+ if (psRes != null)
+ {
+ try
+ {
+ psRes.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ if (psUpdate != null)
+ {
+ try
+ {
+ psUpdate.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ if (psDeleteMsgs != null)
+ {
+ try
+ {
+ psDeleteMsgs.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ if (psDeleteRefs != null)
+ {
+ try
+ {
+ psDeleteRefs.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
if (conn != null)
{
try
Modified: trunk/src/main/org/jboss/messaging/core/plugin/MessageHolder.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/MessageHolder.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/plugin/MessageHolder.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -22,7 +22,6 @@
package org.jboss.messaging.core.plugin;
-import org.jboss.logging.Logger;
import org.jboss.messaging.core.Message;
/**
@@ -36,8 +35,6 @@
*/
class MessageHolder
{
- private static final Logger log = Logger.getLogger(MessageHolder.class);
-
/*
* The number of channels *currently in memory* that hold a reference to the message
* We need this so we know when to evict the message from the store (when it reaches zero)
Modified: trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -41,12 +41,7 @@
* Currently unused but will be used for XA recovery
*/
List retrievePreparedTransactions() throws Exception;
-
- /**
- * TODO Do we really need this method?
- */
- void removeAllChannelData(long channelID) throws Exception;
-
+
void resetLoadedStatus(long channelID) throws Exception;
void addReference(long channelID, MessageReference ref, Transaction tx) throws Exception;
@@ -86,13 +81,17 @@
private int deliveryCount;
- public ReferenceInfo(long msgId, long ordering, int deliveryCount)
+ private boolean reliable;
+
+ public ReferenceInfo(long msgId, long ordering, int deliveryCount, boolean reliable)
{
this.messageId = msgId;
this.ordering = ordering;
this.deliveryCount = deliveryCount;
+
+ this.reliable = reliable;
}
public long getMessageId()
@@ -109,6 +108,11 @@
{
return deliveryCount;
}
+
+ public boolean isReliable()
+ {
+ return reliable;
+ }
}
}
Modified: trunk/src/main/org/jboss/messaging/core/refqueue/BasicPrioritizedDeque.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/refqueue/BasicPrioritizedDeque.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/refqueue/BasicPrioritizedDeque.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -24,9 +24,8 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.ListIterator;
-import org.jboss.logging.Logger;
-
/**
* A basic non synchronized PrioritizedDeque implementation.
*
@@ -39,9 +38,7 @@
* $Id$
*/
public class BasicPrioritizedDeque implements PrioritizedDeque
-{
- private static final Logger log = Logger.getLogger(BasicPrioritizedDeque.class);
-
+{
protected LinkedList[] linkedLists;
protected int priorities;
@@ -177,6 +174,11 @@
return size;
}
+ public ListIterator iterator()
+ {
+ return new PrioritizedDequeIterator(linkedLists);
+ }
+
protected void initDeques()
{
linkedLists = new LinkedList[priorities];
Modified: trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDeque.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDeque.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDeque.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.refqueue;
import java.util.List;
+import java.util.ListIterator;
/**
* A deque that returns objects according to a priority.<br>
@@ -49,4 +50,6 @@
void clear();
int size();
+
+ ListIterator iterator();
}
Added: trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDequeIterator.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDequeIterator.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/core/refqueue/PrioritizedDequeIterator.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.refqueue;
+
+import java.util.LinkedList;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ * A PrioritizedDequeIterator
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+class PrioritizedDequeIterator implements ListIterator
+{
+ private LinkedList[] lists;
+
+ private int index;
+
+ private ListIterator currentIter;
+
+ PrioritizedDequeIterator(LinkedList[] lists)
+ {
+ this.lists = lists;
+
+ index = lists.length - 1;
+
+ currentIter = lists[index].listIterator();
+ }
+
+ public void add(Object arg0)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasNext()
+ {
+ if (currentIter.hasNext())
+ {
+ // log.info("has next");
+ return true;
+ }
+ while (index >= 0)
+ {
+ //log.info("doesn't has next, index is:" + index);
+ if (index == 0 || currentIter.hasNext())
+ {
+ // log.info("breaking, current has next:" + currentIter.hasNext());
+ break;
+ }
+ index--;
+ currentIter = lists[index].listIterator();
+ }
+ return currentIter.hasNext();
+ }
+
+ public boolean hasPrevious()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object next()
+ {
+ if (!hasNext())
+ {
+ throw new NoSuchElementException();
+ }
+ return currentIter.next();
+ }
+
+ public int nextIndex()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object previous()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int previousIndex()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove()
+ {
+ currentIter.remove();
+ }
+
+ public void set(Object obj)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
Modified: trunk/src/main/org/jboss/messaging/util/RotatingPool.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/RotatingPool.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/src/main/org/jboss/messaging/util/RotatingPool.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -43,13 +43,13 @@
{
private static final Logger log = Logger.getLogger(RotatingPool.class);
- private int maxSize;
+ protected int maxSize;
- private int pos;
+ protected int pos;
- private Object[] entries;
+ protected Object[] entries;
- private Map keyMappings;
+ protected Map keyMappings;
public RotatingPool(int maxSize)
{
@@ -72,7 +72,9 @@
if (entry == null)
{
- entry = entries[pos] = createEntry();
+ entry = createEntry();
+
+ entries[pos] = entry;
}
keyMappings.put(key, entry);
Modified: trunk/tests/build.bat
===================================================================
--- trunk/tests/build.bat 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/build.bat 2006-08-02 14:14:32 UTC (rev 1174)
@@ -3,6 +3,5 @@
REM $Id: build.bat 71 2004-10-04 20:13:23Z andd $
REM
+ant -lib ../thirdparty/junit/lib/junit.jar %1
-%ANT_HOME%\bin\ant -lib ../thirdparty/junit/lib/junit.jar %1
-
Modified: trunk/tests/build.properties
===================================================================
--- trunk/tests/build.properties 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/build.properties 2006-08-02 14:14:32 UTC (rev 1174)
@@ -12,5 +12,6 @@
junit.test.haltonfailure=false
junit.fork=true
+junit.batchtest.fork=true
junit.timeout=1200000
Modified: trunk/tests/build.xml
===================================================================
--- trunk/tests/build.xml 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/build.xml 2006-08-02 14:14:32 UTC (rev 1174)
@@ -176,6 +176,10 @@
<!-- This is the complete execution classpath of the CVS latest snapshot -->
+ <!--
+
+ This doesn't seem to be used, also is referencing files on Ovidiu's machine
+
<path id="test.execution.classpath2">
<pathelement location="C:/work/src/cvs/jboss-head/thirdparty/apache-log4j/lib/log4j.jar"/>
<pathelement location="C:/work/src/cvs/jboss-head/thirdparty/jboss/profiler/jvmti/lib/jboss-profiler-jvmti.jar"/>
@@ -245,7 +249,9 @@
<pathelement location="C:/work/jboss-messaging/tests/output/classes"/>
</path>
+ -->
+
<path id="stress.test.execution.classpath">
<pathelement path="${tests.root}/etc/stress"/>
<path refid="test.execution.classpath"/>
@@ -383,7 +389,7 @@
<sysproperty key="test.database" value="${functional.tests.database}"/>
<sysproperty key="test.serialization" value="${functional.tests.serialization}"/>
<sysproperty key="build.lib" value="${build.lib}"/>
- <jvmarg value="-Xmx1024M"/>
+ <jvmarg value="-Xmx512M"/>
<!--
<jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=antjunit"/>
-->
Modified: trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/SimpleChannel.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -102,6 +102,10 @@
{
throw new NotYetImplementedException();
}
+
+ public void removeAllReferences()
+ {
+ }
// DeliveryObserver implementation -------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/core/distributed/queue/QueuePeerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/distributed/queue/QueuePeerTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/distributed/queue/QueuePeerTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,11 +21,10 @@
*/
package org.jboss.test.messaging.core.distributed.queue;
-import org.jboss.messaging.core.distributed.queue.DistributedQueue;
import org.jboss.messaging.core.distributed.Distributed;
+import org.jboss.messaging.core.distributed.queue.DistributedQueue;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.test.messaging.core.distributed.base.PeerTestBase;
-import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jgroups.blocks.RpcDispatcher;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/core/distributed/replicator/ReplicatorTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/distributed/replicator/ReplicatorTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/distributed/replicator/ReplicatorTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -25,7 +25,6 @@
import org.jboss.messaging.core.distributed.replicator.Replicator;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.test.messaging.core.distributed.replicator.base.ReplicatorTestBase;
-import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jgroups.blocks.RpcDispatcher;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/core/distributed/topic/TopicPeerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/distributed/topic/TopicPeerTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/distributed/topic/TopicPeerTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -25,7 +25,6 @@
import org.jboss.messaging.core.distributed.topic.DistributedTopic;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.test.messaging.core.distributed.base.PeerTestBase;
-import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jgroups.blocks.RpcDispatcher;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/core/message/CoreMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/message/CoreMessageTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/message/CoreMessageTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,10 +21,8 @@
*/
package org.jboss.test.messaging.core.message;
-import org.jboss.test.messaging.core.message.base.MessageSupportTestBase;
-import org.jboss.jms.message.JBossMessage;
-import org.jboss.messaging.core.message.CoreMessage;
import org.jboss.messaging.core.message.MessageFactory;
+import org.jboss.test.messaging.core.message.base.MessageSupportTestBase;
/**
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 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -64,7 +64,7 @@
super.tearDown();
}
- public void testReload() throws Throwable
+ public void testRecoverableQueueCrash() throws Throwable
{
ChannelSupport queue = new Queue(1, ms, pm, null, true, 100, 20, 10, new QueuedExecutor());
@@ -109,6 +109,7 @@
//Stop and restart the persistence manager
//Only the persistent messages should survive
+ //This is what would happen if the server crashed
tr.stop();
ms.stop();
@@ -149,4 +150,158 @@
assertEquals(0, LockMap.instance.getSize());
}
+
+ public void testNonRecoverableQueueCrash() throws Throwable
+ {
+ //Non recoverable queue - eg temporary queue
+
+ ChannelSupport queue = new Queue(1, ms, pm, null, false, 100, 20, 10, new QueuedExecutor());
+
+ Message[] msgs = new Message[200];
+
+ MessageReference[] refs = new MessageReference[200];
+
+ //Send 150 np mesages
+ for (int i = 0; i < 150; i++)
+ {
+ msgs[i] = MessageFactory.createCoreMessage(i, false, null);
+
+ refs[i] = ms.reference(msgs[i]);
+
+ queue.handle(null, refs[i], null);
+
+ refs[i].releaseMemoryReference();
+ }
+
+ //Send 50 p messages
+ for (int i = 150; i < 200; i++)
+ {
+ msgs[i] = MessageFactory.createCoreMessage(i, true, null);
+
+ refs[i] = ms.reference(msgs[i]);
+
+ queue.handle(null, refs[i], null);
+
+ refs[i].releaseMemoryReference();
+ }
+
+ List refIds = getReferenceIds(queue.getChannelID());
+ assertEquals(100, refIds.size());
+
+ assertEquals(100, queue.memoryRefCount());
+
+ assertEquals(0, queue.downCacheCount());
+
+ assertTrue(queue.isPaging());
+
+ assertEquals(0, queue.memoryDeliveryCount());
+
+ //Stop and restart the persistence manager
+ //No messages should survive
+ //This is what would happen if the server crashed
+
+ tr.stop();
+ ms.stop();
+ pm.stop();
+
+ pm =
+ new JDBCPersistenceManager(sc.getDataSource(), sc.getTransactionManager());
+
+ ((JDBCPersistenceManager)pm).start();
+
+ ms = new SimpleMessageStore("store1");
+
+ tr = new TransactionRepository();
+
+ tr.start(pm);
+
+ ChannelSupport queue2 = new Queue(1, ms, pm, null, false, 100, 20, 10, new QueuedExecutor());
+
+ queue2.load();
+
+ refIds = getReferenceIds(queue.getChannelID());
+ assertEquals(0, refIds.size());
+
+ List msgIds = getMessageIds();
+ assertEquals(0, msgIds.size());
+
+ assertEquals(0, queue2.memoryRefCount());
+
+ assertEquals(0, queue2.downCacheCount());
+
+ assertFalse(queue2.isPaging());
+
+ assertEquals(0, queue2.memoryDeliveryCount());
+
+ assertEquals(0, queue2.messageCount());
+
+ assertEquals(0, LockMap.instance.getSize());
+ }
+
+ public void testNonRecoverableQueueRemoveAllReferences() throws Throwable
+ {
+ //Non recoverable queue - eg temporary queue
+
+ ChannelSupport queue = new Queue(1, ms, pm, null, false, 100, 20, 10, new QueuedExecutor());
+
+ Message[] msgs = new Message[200];
+
+ MessageReference[] refs = new MessageReference[200];
+
+ //Send 150 np mesages
+ for (int i = 0; i < 150; i++)
+ {
+ msgs[i] = MessageFactory.createCoreMessage(i, false, null);
+
+ refs[i] = ms.reference(msgs[i]);
+
+ queue.handle(null, refs[i], null);
+
+ refs[i].releaseMemoryReference();
+ }
+
+ //Send 50 p messages
+ for (int i = 150; i < 200; i++)
+ {
+ msgs[i] = MessageFactory.createCoreMessage(i, true, null);
+
+ refs[i] = ms.reference(msgs[i]);
+
+ queue.handle(null, refs[i], null);
+
+ refs[i].releaseMemoryReference();
+ }
+
+ List refIds = getReferenceIds(queue.getChannelID());
+ assertEquals(100, refIds.size());
+
+ assertEquals(100, queue.memoryRefCount());
+
+ assertEquals(0, queue.downCacheCount());
+
+ assertTrue(queue.isPaging());
+
+ assertEquals(0, queue.memoryDeliveryCount());
+
+ queue.removeAllReferences();
+
+ refIds = getReferenceIds(queue.getChannelID());
+ assertEquals(0, refIds.size());
+
+ List msgIds = getMessageIds();
+ assertEquals(0, msgIds.size());
+
+ assertEquals(0, queue.memoryRefCount());
+
+ assertEquals(0, queue.downCacheCount());
+
+ assertFalse(queue.isPaging());
+
+ assertEquals(0, queue.memoryDeliveryCount());
+
+ assertEquals(0, queue.messageCount());
+
+ assertEquals(0, LockMap.instance.getSize());
+ }
+
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -92,14 +92,14 @@
}
- protected void doSetup(boolean batch) throws Exception
+ protected void doSetup(boolean batch) throws Throwable
{
pm = createPM();
pm.setUsingBatchUpdates(batch);
ms = new SimpleMessageStore("s0");
}
- protected JDBCPersistenceManager createPM() throws Exception
+ protected JDBCPersistenceManager createPM() throws Throwable
{
JDBCPersistenceManager p = new JDBCPersistenceManager(sc.getDataSource(), sc.getTransactionManager());
p.start();
@@ -117,7 +117,7 @@
super.tearDown();
}
- public void testGetMinOrdering() throws Exception
+ public void testGetMinOrdering() throws Throwable
{
doSetup(false);
@@ -192,9 +192,9 @@
long minOrdering = pm.getMinOrdering(channel.getChannelID());
assertEquals(11, minOrdering);
-
- pm.removeAllChannelData(channel.getChannelID());
-
+
+ pm.removeReferences(channel.getChannelID(), refs);
+
pm.addReferences(channel.getChannelID(), refs, true);
refIds = getReferenceIds(channel.getChannelID());
@@ -228,12 +228,10 @@
minOrdering = pm.getMinOrdering(channel.getChannelID());
assertEquals(0, minOrdering);
-
- pm.removeAllChannelData(channel.getChannelID());
-
+
}
- public void testGetNumberOfReferences() throws Exception
+ public void testGetNumberOfReferences() throws Throwable
{
doSetup(false);
@@ -367,12 +365,10 @@
numberOfReferences = pm.getNumberOfUnloadedReferences(channel.getChannelID());
- assertEquals(4, numberOfReferences);
-
- pm.removeAllChannelData(channel.getChannelID());
+ assertEquals(4, numberOfReferences);
}
- public void testGetReferenceInfos() throws Exception
+ public void testGetReferenceInfos() throws Throwable
{
doSetup(false);
@@ -490,13 +486,10 @@
{
//ok - there are not this many refs
}
-
- pm.removeAllChannelData(channel.getChannelID());
-
}
- public void testGetMessages() throws Exception
+ public void testGetMessages() throws Throwable
{
doSetup(false);
@@ -570,8 +563,7 @@
assertTrue(containsMessage(ms, ref7.getMessageID()));
assertTrue(containsMessage(ms, ref9.getMessageID()));
assertTrue(containsMessage(ms, ref1.getMessageID()));
-
- pm.removeAllChannelData(channel.getChannelID());
+
}
protected boolean containsMessage(List msgs, long msgId)
@@ -588,7 +580,7 @@
return false;
}
- public void testGetMessagesMaxParams() throws Exception
+ public void testGetMessagesMaxParams() throws Throwable
{
doSetup(false);
@@ -662,22 +654,20 @@
assertTrue(containsMessage(ms, ref4.getMessageID()));
assertTrue(containsMessage(ms, ref7.getMessageID()));
assertTrue(containsMessage(ms, ref9.getMessageID()));
- assertTrue(containsMessage(ms, ref1.getMessageID()));
-
- pm.removeAllChannelData(channel.getChannelID());
+ assertTrue(containsMessage(ms, ref1.getMessageID()));
}
- public void testaddRemoveGetReferences_Batch() throws Exception
+ public void testaddRemoveGetReferences_Batch() throws Throwable
{
addRemoveGetReferences(true);
}
- public void testaddRemoveGetReferences_NoBatch() throws Exception
+ public void testaddRemoveGetReferences_NoBatch() throws Throwable
{
addRemoveGetReferences(false);
}
- protected void addRemoveGetReferences(boolean batch) throws Exception
+ protected void addRemoveGetReferences(boolean batch) throws Throwable
{
doSetup(false);
@@ -859,14 +849,12 @@
ms = getMessageIds();
assertNotNull(ms);
assertEquals(0, ms.size());
-
- pm.removeAllChannelData(channel1.getChannelID());
}
- public void testAddRemoveReference() throws Exception
+ public void testAddRemoveReference() throws Throwable
{
doSetup(false);
@@ -981,63 +969,26 @@
}
}
- public void testRemoveAllChannelData() throws Exception
- {
- doSetup(false);
-
- Channel channel = new SimpleChannel(0, ms);
-
- Message[] messages = createMessages(10);
-
- for (int i = 0; i < messages.length; i++)
- {
- Message m = messages[i];
-
- MessageReference ref = ms.reference(m);
-
- pm.addReference(channel.getChannelID(), ref, null);
- }
-
- List refs = getReferenceIds(channel.getChannelID());
- assertNotNull(refs);
- assertEquals(messages.length, refs.size());
-
-
- List msgs = getMessageIds();
- assertNotNull(msgs);
- assertEquals(messages.length, msgs.size());
-
- for (int i = 0; i < messages.length; i++)
- {
- Message m = messages[i];
- assertTrue(refs.contains(new Long(m.getMessageID())));
- }
-
- pm.removeAllChannelData(channel.getChannelID());
-
- refs = getReferenceIds(channel.getChannelID());
- assertTrue(refs.isEmpty());
-
- }
+
//non batch
- public void testCommit_NotXA_Long_NB() throws Exception
+ public void testCommit_NotXA_Long_NB() throws Throwable
{
doTransactionCommit(false, false);
}
- public void testCommit_XA_Long_NB() throws Exception
+ public void testCommit_XA_Long_NB() throws Throwable
{
doTransactionCommit(true, false);
}
- public void testRollback_NotXA_Long_NB() throws Exception
+ public void testRollback_NotXA_Long_NB() throws Throwable
{
doTransactionRollback(false, false);
}
- public void testRollback_XA_Long_NB() throws Exception
+ public void testRollback_XA_Long_NB() throws Throwable
{
doTransactionRollback(true, false);
}
@@ -1045,28 +996,28 @@
//batch
- public void testCommit_NotXA_Long_B() throws Exception
+ public void testCommit_NotXA_Long_B() throws Throwable
{
doTransactionCommit(false, true);
}
- public void testCommit_XA_Long_B() throws Exception
+ public void testCommit_XA_Long_B() throws Throwable
{
doTransactionCommit(true, true);
}
- public void testRollback_NotXA_Long_B() throws Exception
+ public void testRollback_NotXA_Long_B() throws Throwable
{
doTransactionRollback(false, true);
}
- public void testRollback_XA_Long_B() throws Exception
+ public void testRollback_XA_Long_B() throws Throwable
{
doTransactionRollback(true, true);
}
- public void testRetrievePreparedTransactions() throws Exception
+ public void testRetrievePreparedTransactions() throws Throwable
{
doSetup(false);
@@ -1103,14 +1054,10 @@
for (int i = 0; i < txs.length; i++)
{
txs[i].rollback();
- }
-
-
- pm.removeAllChannelData(channel.getChannelID());
-
+ }
}
- protected Message createMessage(byte i, boolean reliable) throws Exception
+ protected Message createMessage(byte i, boolean reliable) throws Throwable
{
Map headers = generateFilledMap(true);
@@ -1124,7 +1071,7 @@
i % 2 == 0 ? new WibblishObject() : null);
}
- protected Message[] createMessages(int num) throws Exception
+ protected Message[] createMessages(int num) throws Throwable
{
//Generate some messages with a good range of attribute values
Message[] messages = new Message[num];
@@ -1135,7 +1082,7 @@
return messages;
}
- protected void checkEquivalent(Message m1, Message m2) throws Exception
+ protected void checkEquivalent(Message m1, Message m2) throws Throwable
{
if (m1 == m2)
{
@@ -1425,7 +1372,7 @@
}
- protected void doTransactionCommit(boolean xa, boolean batch) throws Exception
+ protected void doTransactionCommit(boolean xa, boolean batch) throws Throwable
{
doSetup(batch);
@@ -1519,12 +1466,9 @@
assertTrue(msgs.contains(new Long(ref3.getMessageID())));
assertTrue(msgs.contains(new Long(ref4.getMessageID())));
assertTrue(msgs.contains(new Long(ref5.getMessageID())));
-
- pm.removeAllChannelData(channel.getChannelID());
-
}
- protected void doTransactionRollback(boolean xa, boolean batch) throws Exception
+ protected void doTransactionRollback(boolean xa, boolean batch) throws Throwable
{
doSetup(batch);
@@ -1611,13 +1555,10 @@
assertNotNull(msgs);
assertEquals(2, msgs.size());
assertTrue(msgs.contains(new Long(ref1.getMessageID())));
- assertTrue(msgs.contains(new Long(ref2.getMessageID())));
-
- pm.removeAllChannelData(channel.getChannelID());
-
+ assertTrue(msgs.contains(new Long(ref2.getMessageID())));
}
- protected List getReferenceIds(long channelId) throws Exception
+ protected List getReferenceIds(long channelId) throws Throwable
{
InitialContext ctx = new InitialContext();
@@ -1655,7 +1596,7 @@
return msgIds;
}
- protected List getMessageIds() throws Exception
+ protected List getMessageIds() throws Throwable
{
InitialContext ctx = new InitialContext();
Modified: trunk/tests/src/org/jboss/test/messaging/core/refqueue/PrioritizedReferenceQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/refqueue/PrioritizedReferenceQueueTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/core/refqueue/PrioritizedReferenceQueueTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -22,6 +22,7 @@
package org.jboss.test.messaging.core.refqueue;
import java.util.Iterator;
+import java.util.ListIterator;
import org.jboss.messaging.core.refqueue.BasicPrioritizedDeque;
import org.jboss.test.messaging.MessagingTestCase;
@@ -45,6 +46,22 @@
protected Wibble h;
protected Wibble i;
protected Wibble j;
+ protected Wibble k;
+ protected Wibble l;
+ protected Wibble m;
+ protected Wibble n;
+ protected Wibble o;
+ protected Wibble p;
+ protected Wibble q;
+ protected Wibble r;
+ protected Wibble s;
+ protected Wibble t;
+ protected Wibble u;
+ protected Wibble v;
+ protected Wibble w;
+ protected Wibble x;
+ protected Wibble y;
+ protected Wibble z;
public PrioritizedReferenceQueueTest(String name)
{
@@ -67,6 +84,22 @@
h = new Wibble("h");
i = new Wibble("i");
j = new Wibble("j");
+ k = new Wibble("k");
+ l = new Wibble("l");
+ m = new Wibble("m");
+ n = new Wibble("n");
+ o = new Wibble("o");
+ p = new Wibble("p");
+ q = new Wibble("q");
+ r = new Wibble("r");
+ s = new Wibble("s");
+ t = new Wibble("t");
+ u = new Wibble("u");
+ v = new Wibble("v");
+ w = new Wibble("w");
+ x = new Wibble("x");
+ y = new Wibble("y");
+ z = new Wibble("z");
}
@@ -74,133 +107,7 @@
{
super.tearDown();
}
-
-// public void testContainsOne() throws Exception
-// {
-// boolean one = deque.addFirst(a, 0);
-// assertTrue(one);
-// one = deque.addFirst(a, 0);
-// assertFalse(one);
-//
-// one = deque.addFirst(b, 1);
-// assertFalse(one);
-// one = deque.addFirst(b, 1);
-// assertFalse(one);
-//
-// one = deque.addFirst(c, 2);
-// assertFalse(one);
-// one = deque.addFirst(c, 2);
-// assertFalse(one);
-//
-// one = deque.addFirst(d, 3);
-// assertFalse(one);
-// one = deque.addFirst(d, 3);
-// assertFalse(one);
-//
-// one = deque.addFirst(e, 4);
-// assertFalse(one);
-// one = deque.addFirst(e, 4);
-// assertFalse(one);
-//
-// one = deque.addFirst(f, 5);
-// assertFalse(one);
-// one = deque.addFirst(f, 5);
-// assertFalse(one);
-//
-// one = deque.addFirst(g, 6);
-// assertFalse(one);
-// one = deque.addFirst(g, 6);
-// assertFalse(one);
-//
-// one = deque.addFirst(h, 7);
-// assertFalse(one);
-// one = deque.addFirst(h, 7);
-// assertFalse(one);
-//
-// one = deque.addFirst(i, 8);
-// assertFalse(one);
-// one = deque.addFirst(i, 8);
-// assertFalse(one);
-//
-// one = deque.addFirst(j, 9);
-// assertFalse(one);
-// one = deque.addFirst(j, 9);
-// assertFalse(one);
-//
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-// deque.removeFirst();
-//
-// one = deque.addLast(a, 0);
-// assertTrue(one);
-// one = deque.addLast(a, 0);
-// assertFalse(one);
-//
-// one = deque.addLast(b, 1);
-// assertFalse(one);
-// one = deque.addLast(b, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(c, 1);
-// assertFalse(one);
-// one = deque.addLast(c, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(d, 1);
-// assertFalse(one);
-// one = deque.addLast(d, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(e, 1);
-// assertFalse(one);
-// one = deque.addLast(e, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(f, 1);
-// assertFalse(one);
-// one = deque.addLast(f, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(g, 1);
-// assertFalse(one);
-// one = deque.addLast(g, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(h, 1);
-// assertFalse(one);
-// one = deque.addLast(h, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(i, 1);
-// assertFalse(one);
-// one = deque.addLast(i, 1);
-// assertFalse(one);
-//
-// one = deque.addLast(j, 1);
-// assertFalse(one);
-// one = deque.addLast(j, 1);
-// assertFalse(one);
-//
-// }
-
-
+
public void testAddFirst() throws Exception
{
deque.addFirst(a, 0);
@@ -235,22 +142,6 @@
}
-// public void testRemove() throws Exception
-// {
-// deque.addLast(a, 0);
-// deque.addLast(b, 0);
-// deque.addLast(c, 0);
-// deque.addLast(d, 0);
-// deque.addLast(e, 0);
-//
-// deque.remove(b);
-// deque.remove(d);
-//
-// assertEquals(a, deque.removeFirst());
-// assertEquals(c, deque.removeFirst());
-// assertEquals(e, deque.removeFirst());
-// assertNull(deque.removeFirst());
-// }
public void testRemoveFirst() throws Exception
{
@@ -463,7 +354,218 @@
}
assertEquals(10, count);
}
+
+ public void testIterator()
+ {
+ deque.addLast(a, 9);
+ deque.addLast(b, 9);
+ deque.addLast(c, 8);
+ deque.addLast(d, 8);
+ deque.addLast(e, 7);
+ deque.addLast(f, 7);
+ deque.addLast(g, 7);
+ deque.addLast(h, 6);
+ deque.addLast(i, 6);
+ deque.addLast(j, 6);
+ deque.addLast(k, 5);
+ deque.addLast(l, 5);
+ deque.addLast(m, 4);
+ deque.addLast(n, 4);
+ deque.addLast(o, 4);
+ deque.addLast(p, 3);
+ deque.addLast(q, 3);
+ deque.addLast(r, 3);
+ deque.addLast(s, 2);
+ deque.addLast(t, 2);
+ deque.addLast(u, 2);
+ deque.addLast(v, 1);
+ deque.addLast(w, 1);
+ deque.addLast(x, 1);
+ deque.addLast(y, 0);
+ deque.addLast(z, 0);
+ ListIterator iter = deque.iterator();
+
+ int c = 0;
+ while (iter.hasNext())
+ {
+ Wibble w = (Wibble)iter.next();
+ c++;
+ }
+ assertEquals(c, 26);
+
+ iter = deque.iterator();
+ assertTrue(iter.hasNext());
+ Wibble w = (Wibble)iter.next();
+ assertEquals("a", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("d", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("j", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("z", w.s);
+ assertFalse(iter.hasNext());
+
+ iter = deque.iterator();
+ assertTrue(iter.hasNext());
+ w = (Wibble)iter.next();
+ assertEquals("a", w.s);
+
+ iter.remove();
+
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("d", w.s);
+
+ iter.remove();
+
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("j", w.s);
+
+ iter.remove();
+
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("z", w.s);
+ iter.remove();
+ assertFalse(iter.hasNext());
+
+ iter = deque.iterator();
+ assertTrue(iter.hasNext());
+ w = (Wibble)iter.next();
+ assertEquals("b", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("c", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("e", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("f", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("g", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("h", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("i", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("k", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("l", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("m", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("n", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("o", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("p", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("q", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("r", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("s", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("t", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("u", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("v", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("w", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("x", w.s);
+ w = (Wibble)iter.next();
+ assertEquals("y", w.s);
+ assertFalse(iter.hasNext());
+
+ }
+
public void testClear()
{
Modified: trunk/tests/src/org/jboss/test/messaging/jms/BrowserTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/BrowserTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/BrowserTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -187,6 +187,7 @@
for (int i = 0; i < numMessages; i++)
{
Message m = mc.receive();
+ assertNotNull(m);
}
browser = session.createBrowser(queue);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/CreateClientOnServerCommand.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/CreateClientOnServerCommand.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/CreateClientOnServerCommand.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -32,7 +32,6 @@
import javax.jms.Session;
import org.jboss.jms.client.JBossConnection;
-import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.jmx.rmi.Command;
/**
@@ -48,8 +47,6 @@
{
private static final long serialVersionUID = -997724797145152821L;
- private static final Logger log = Logger.getLogger(CreateClientOnServerCommand.class);
-
private ConnectionFactory cf;
private Queue queue;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/CreateHangingConsumerCommand.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/CreateHangingConsumerCommand.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/CreateHangingConsumerCommand.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -30,7 +30,6 @@
import javax.jms.Session;
import org.jboss.jms.client.JBossConnection;
-import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.jmx.rmi.Command;
/**
@@ -46,8 +45,6 @@
{
private static final long serialVersionUID = -997724797145152821L;
- private static final Logger log = Logger.getLogger(CreateHangingConsumerCommand.class);
-
private ConnectionFactory cf;
private Queue queue;
Added: trunk/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageCleanupTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -0,0 +1,402 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.jms;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.core.plugin.SimpleMessageStore;
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.tm.TransactionManagerService;
+
+/**
+ *
+ * A MessageCleanupTest
+
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class MessageCleanupTest extends MessagingTestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected InitialContext ic;
+ protected ConnectionFactory cf;
+
+ protected Topic topic;
+
+ // Constructors --------------------------------------------------
+
+ public MessageCleanupTest(String name)
+ {
+ super(name);
+ }
+
+ // TestCase overrides -------------------------------------------
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ ServerManagement.start("all");
+
+
+ ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
+
+ ServerManagement.undeployTopic("TestTopic");
+ ServerManagement.deployTopic("TestTopic", 100, 10, 10);
+
+ topic = (Topic)ic.lookup("/topic/TestTopic");
+
+ log.debug("setup done");
+ }
+
+ public void tearDown() throws Exception
+ {
+ ServerManagement.undeployTopic("TestTopic");
+
+ super.tearDown();
+
+ log.debug("tear down done");
+ }
+
+ /*
+ * Test that all messages on a non durable sub are removed on close
+ */
+ public void testNonDurableClose() throws Exception
+ {
+ if (ServerManagement.isRemote()) return;
+
+ Connection conn = cf.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(topic);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ MessageConsumer cons = sess.createConsumer(topic);
+
+ for (int i = 0; i < 150; i++)
+ {
+ prod.send(sess.createMessage());
+ }
+
+ SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+
+ assertEquals(100, ms.messageIds().size());
+
+ //50 Should be paged onto disk
+
+ assertEquals(50, getReferenceIds().size());
+
+ assertEquals(50, getMessageIds().size());
+
+ //Now we close the consumer
+
+ cons.close();
+
+ assertEquals(0, ms.messageIds().size());
+
+ assertEquals(0, getReferenceIds().size());
+
+ assertEquals(0, getMessageIds().size());
+
+ conn.close();
+ }
+
+ public void testNonDurableClose2() throws Exception
+ {
+ if (ServerManagement.isRemote()) return;
+
+ Connection conn = cf.createConnection();
+
+ conn.setClientID("wibble12345");
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(topic);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ MessageConsumer cons1 = sess.createConsumer(topic);
+
+ MessageConsumer cons2 = sess.createDurableSubscriber(topic, "sub1");
+
+ for (int i = 0; i < 150; i++)
+ {
+ prod.send(sess.createMessage());
+ }
+
+ SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+
+ assertEquals(100, ms.messageIds().size());
+
+ assertEquals(100, getReferenceIds().size());
+
+ assertEquals(50, getMessageIds().size());
+
+ //Now we close the consumers
+
+ cons1.close();
+ cons2.close();
+
+ assertEquals(100, ms.messageIds().size());
+
+ assertEquals(50, getReferenceIds().size());
+
+ assertEquals(50, getMessageIds().size());
+
+ sess.unsubscribe("sub1");
+
+ assertEquals(0, ms.messageIds().size());
+
+ assertEquals(0, getReferenceIds().size());
+
+ assertEquals(0, getMessageIds().size());
+
+
+ conn.close();
+ }
+
+
+
+ /*
+ * Test that all messages on a temporary queue are removed on close
+ */
+ public void testTemporaryQueueClose() throws Exception
+ {
+ if (ServerManagement.isRemote()) return;
+
+ String objectName = "somedomain:service=TempQueueConnectionFactory";
+ String[] jndiBindings = new String[] { "/TempQueueConnectionFactory" };
+
+ ServerManagement.deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
+
+ ConnectionFactory cf2 = (ConnectionFactory)ic.lookup("/TempQueueConnectionFactory");
+
+ Connection conn = cf2.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ TemporaryQueue queue = sess.createTemporaryQueue();
+
+ MessageProducer prod = sess.createProducer(queue);
+
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+ conn.start();
+
+ for (int i = 0; i < 150; i++)
+ {
+ prod.send(sess.createMessage());
+ }
+
+ SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+
+ assertEquals(100, ms.messageIds().size());
+
+ assertEquals(50, getReferenceIds().size());
+
+ assertEquals(50, getMessageIds().size());
+
+ //Now we close the connection
+
+ conn.close();
+
+ assertEquals(0, ms.messageIds().size());
+
+ assertEquals(0, getReferenceIds().size());
+
+ assertEquals(0, getMessageIds().size());
+
+ }
+
+ /*
+ * Test that all messages on a temporary topic are removed on close
+ */
+ public void testTemporaryTopicClose() throws Exception
+ {
+ if (ServerManagement.isRemote()) return;
+
+ String objectName = "somedomain:service=TempTopicConnectionFactory";
+ String[] jndiBindings = new String[] { "/TempTopicConnectionFactory" };
+
+ ServerManagement.deployConnectionFactory(objectName, jndiBindings, 150, 100, 10, 10);
+
+ ConnectionFactory cf2 = (ConnectionFactory)ic.lookup("/TempTopicConnectionFactory");
+
+ Connection conn = cf2.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ TemporaryTopic topic = sess.createTemporaryTopic();
+
+ MessageProducer prod = sess.createProducer(topic);
+
+ prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+ MessageConsumer cons1 = sess.createConsumer(topic);
+
+ MessageConsumer cons2 = sess.createConsumer(topic);
+
+ //Don't start the connection
+
+ for (int i = 0; i < 150; i++)
+ {
+ prod.send(sess.createMessage());
+ }
+
+ SimpleMessageStore ms = (SimpleMessageStore)ServerManagement.getMessageStore();
+
+ assertEquals(100, ms.messageIds().size());
+
+ assertEquals(100, getReferenceIds().size());
+
+ assertEquals(50, getMessageIds().size());
+
+ //Now we close the connection
+
+ conn.close();
+
+ assertEquals(0, ms.messageIds().size());
+
+ assertEquals(0, getReferenceIds().size());
+
+ assertEquals(0, getMessageIds().size());
+
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ protected List getReferenceIds() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = ds.getConnection();
+ String sql = "SELECT MESSAGEID, ORD FROM JMS_MESSAGE_REFERENCE";
+ PreparedStatement ps = conn.prepareStatement(sql);
+
+ ResultSet rs = ps.executeQuery();
+
+ List msgIds = new ArrayList();
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ msgIds.add(new Long(msgId));
+ }
+ rs.close();
+ ps.close();
+ conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ return msgIds;
+ }
+
+
+ protected List getMessageIds() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+
+ TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+
+ javax.transaction.Transaction txOld = mgr.suspend();
+ mgr.begin();
+
+ java.sql.Connection conn = ds.getConnection();
+ String sql = "SELECT MESSAGEID FROM JMS_MESSAGE ORDER BY MESSAGEID";
+ PreparedStatement ps = conn.prepareStatement(sql);
+
+ ResultSet rs = ps.executeQuery();
+
+ List msgIds = new ArrayList();
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ msgIds.add(new Long(msgId));
+ }
+ rs.close();
+ ps.close();
+ conn.close();
+
+ mgr.commit();
+
+ if (txOld != null)
+ {
+ mgr.resume(txOld);
+ }
+
+ return msgIds;
+ }
+
+ // Inner classes -------------------------------------------------
+
+
+}
+
+
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageConsumerTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,40 +21,36 @@
*/
package org.jboss.test.messaging.jms;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
import javax.jms.Queue;
+import javax.jms.QueueReceiver;
import javax.jms.Session;
+import javax.jms.StreamMessage;
import javax.jms.TextMessage;
import javax.jms.Topic;
-import javax.jms.MessageListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.QueueBrowser;
-import javax.jms.InvalidDestinationException;
-import javax.jms.ObjectMessage;
-import javax.jms.MapMessage;
-import javax.jms.StreamMessage;
-import javax.jms.BytesMessage;
-import javax.jms.QueueReceiver;
import javax.jms.TopicSubscriber;
import javax.naming.InitialContext;
+import org.jboss.jms.destination.JBossTopic;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.destination.JBossTopic;
-import java.util.List;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
import EDU.oswego.cs.dl.util.concurrent.Latch;
@@ -150,6 +146,75 @@
super.tearDown();
}
+ public void testRelayMessage() throws Exception
+ {
+ Connection conn = cf.createConnection();
+
+ conn.start();
+
+ final Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer cons = sess.createConsumer(queue);
+
+ final Object lock = new Object();
+
+ final int numMessages = 100;
+
+
+ class MyListener implements MessageListener
+ {
+ boolean failed;
+
+ int count;
+
+ public void onMessage(Message m)
+ {
+ try
+ {
+ MessageProducer prod = sess.createProducer(queue2);
+
+ prod.send(m);
+
+ count++;
+
+ if (count == numMessages)
+ {
+ synchronized (lock)
+ {
+ lock.notify();
+ }
+
+ }
+ }
+ catch (JMSException e)
+ {
+ failed = true;
+ }
+ }
+ }
+
+ MyListener listener = new MyListener();
+
+ cons.setMessageListener(listener);
+
+ MessageProducer prod = sess.createProducer(queue);
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ prod.send(sess.createMessage());
+ }
+
+ synchronized (lock)
+ {
+ lock.wait();
+ }
+
+ conn.close();
+
+ assertFalse(listener.failed);
+ }
+
+
/*
* If there are two competing consumers on a queue/subscription then if one closes
* and has unacknowledged deliveries these should be cancelled but also
Modified: trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/MessageWithReadResolveTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -174,6 +174,7 @@
/* This class would trigger the exception when serialized with jboss serialization */
public static class TestMessage implements Serializable
{
+ private static final long serialVersionUID = -5932581134414145967L;
private long id;
private Object clazz;
@@ -209,6 +210,9 @@
public static class TestEnum implements Serializable
{
+
+ private static final long serialVersionUID = 4306026990380393029L;
+
public Object readResolve()
{
return null;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ReferenceableTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ReferenceableTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ReferenceableTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -33,14 +33,8 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.InitialContext;
-import javax.naming.Reference;
-import javax.naming.Referenceable;
import org.jboss.jms.client.JBossConnectionFactory;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.destination.JBossTopic;
-import org.jboss.jms.referenceable.ConnectionFactoryObjectFactory;
-import org.jboss.jms.referenceable.DestinationObjectFactory;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSCorrelationIDHeaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSCorrelationIDHeaderTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSCorrelationIDHeaderTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.messaging.jms.message;
-import javax.jms.JMSException;
import javax.jms.Message;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignObjectMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignObjectMessageTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignObjectMessageTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,10 +21,7 @@
*/
package org.jboss.test.messaging.jms.message.foreign;
-import java.io.Serializable;
-
import javax.jms.JMSException;
-import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignStreamMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignStreamMessageTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/foreign/ForeignStreamMessageTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -22,7 +22,6 @@
package org.jboss.test.messaging.jms.message.foreign;
import javax.jms.JMSException;
-import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.StreamMessage;
Modified: trunk/tests/src/org/jboss/test/messaging/jms/persistence/MessagePersistenceManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/persistence/MessagePersistenceManagerTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/persistence/MessagePersistenceManagerTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -64,7 +64,7 @@
super.setUp();
}
- protected void doSetup(boolean batch) throws Exception
+ protected void doSetup(boolean batch) throws Throwable
{
super.doSetup(batch);
@@ -107,7 +107,7 @@
}
}
- protected void checkEquivalent(Message m1, Message m2) throws Exception
+ protected void checkEquivalent(Message m1, Message m2) throws Throwable
{
super.checkEquivalent(m1, m2);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/selector/SelectorTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -211,7 +211,7 @@
m.setStringProperty("beatle", "john");
prod.send(m);
-
+
m = sess.createMessage();
m.setStringProperty("beatle", "kermit the frog");
@@ -222,14 +222,120 @@
for (int j = 0; j < 100; j++)
{
Message m = cons1.receive(1000);
+
+ assertNotNull(m);
+
+ assertEquals("john", m.getStringProperty("beatle"));
+ }
+ Message m = cons1.receive(1000);
+
+ assertNull(m);
+
+ String selector2 = "beatle = 'kermit the frog'";
+
+ MessageConsumer cons2 = sess.createConsumer(queue, selector2);
+
+ for (int j = 0; j < 100; j++)
+ {
+ m = cons2.receive(1000);
+
assertNotNull(m);
+
+ assertEquals("kermit the frog", m.getStringProperty("beatle"));
}
+
+ m = cons2.receive(1000);
- Message m = cons1.receiveNoWait();
+ assertNull(m);
+
+ sess.close();
+ }
+
+ public void testManyQueueWithExpired() throws Exception
+ {
+ String selector1 = "beatle = 'john'";
+
+ Connection conn = cf.createConnection();
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(queue);
+
+ for (int j = 0; j < 100; j++)
+ {
+ Message m = sess.createMessage();
+
+ m.setStringProperty("beatle", "john");
+
+ prod.setTimeToLive(0);
+
+ prod.send(m);
+
+ m = sess.createMessage();
+
+ m.setStringProperty("beatle", "john");
+
+ prod.setTimeToLive(1);
+
+ prod.send(m);
+
+ m = sess.createMessage();
+
+ m.setStringProperty("beatle", "kermit the frog");
+
+ prod.setTimeToLive(0);
+
+ prod.send(m);
+
+ m = sess.createMessage();
+
+ m.setStringProperty("beatle", "kermit the frog");
+
+ m.setJMSExpiration(System.currentTimeMillis());
+
+ prod.setTimeToLive(1);
+
+ prod.send(m);
+ }
+
+ Thread.sleep(2000);
+
+ MessageConsumer cons1 = sess.createConsumer(queue, selector1);
+
+ for (int j = 0; j < 100; j++)
+ {
+ Message m = cons1.receive(1000);
+
+ assertNotNull(m);
+
+ assertEquals("john", m.getStringProperty("beatle"));
+ }
+
+ Message m = cons1.receive(1000);
+
assertNull(m);
+
+ String selector2 = "beatle = 'kermit the frog'";
+
+ MessageConsumer cons2 = sess.createConsumer(queue, selector2);
+
+ for (int j = 0; j < 100; j++)
+ {
+ m = cons2.receive(1000);
+
+ assertNotNull(m);
+
+ assertEquals("kermit the frog", m.getStringProperty("beatle"));
+ }
+
+ m = cons2.receive(1000);
+ assertNull(m);
+
+
sess.close();
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/server/destination/TopicManagementTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -28,7 +28,6 @@
import javax.jms.DeliveryMode;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
-import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
Added: trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/RelayStressTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -0,0 +1,269 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.messaging.jms.stress;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+/**
+ *
+ * A RelayTest
+ *
+ * Send messages to a topic with selector1, consumer them with multiple consumers
+ * and relay them back to the topic with a different selector, then consume that with more consumers
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class RelayStressTest extends MessagingTestCase
+{
+ // Constants -----------------------------------------------------
+
+ private static Logger log = Logger.getLogger(RelayStressTest.class);
+
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private InitialContext ic;
+
+ // Constructors --------------------------------------------------
+
+ public RelayStressTest(String name)
+ {
+ super(name);
+ }
+
+ // Public --------------------------------------------------------
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ ServerManagement.start("all");
+ ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+ ServerManagement.deployTopic("StressTestTopic");
+
+ log.debug("setup done");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ ServerManagement.undeployTopic("StressTestTopic");
+ ic.close();
+ super.tearDown();
+ }
+
+ public void testRelay() throws Exception
+ {
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+
+ Topic topic = (Topic)ic.lookup("/topic/StressTestTopic");
+
+ final int numMessages = 50000;
+
+ final int numRelayers = 10;
+
+ final int numConsumers = 50;
+
+ Connection conn = cf.createConnection();
+
+ class Relayer implements MessageListener
+ {
+ boolean done;
+
+ boolean failed;
+
+ int count;
+
+ MessageProducer prod;
+
+ Relayer(MessageProducer prod)
+ {
+ this.prod = prod;
+ }
+
+ public void onMessage(Message m)
+ {
+ try
+ {
+ //log.info(this + " got message");
+
+ //log.info("blah");
+
+ m.clearProperties();
+ m.setStringProperty("name", "Tim");
+
+ //log.info("set property");
+
+ prod.send(m);
+
+ //log.info("sent");
+
+ count++;
+
+ if (count % 100 == 0)
+ {
+ // log.info("relayed " + count + " messages");
+ }
+
+ if (count == numMessages)
+ {
+ synchronized (this)
+ {
+ done = true;
+ notify();
+ }
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ synchronized (this)
+ {
+ done = true;
+ failed = true;
+ notify();
+ }
+ }
+ }
+ }
+
+ class Consumer implements MessageListener
+ {
+ boolean failed;
+
+ boolean done;
+
+ int count;
+
+ public void onMessage(Message m)
+ {
+ count++;
+
+ if (count % 100 == 0)
+ {
+ //log.info("consumed " + count + " messages");
+ }
+
+ if (count == numMessages * numRelayers)
+ {
+ synchronized (this)
+ {
+ done = true;
+ notify();
+ //log.info(this + " done");
+ }
+ }
+ }
+ }
+
+ Relayer[] relayers = new Relayer[numRelayers];
+
+ Consumer[] consumers = new Consumer[numConsumers];
+
+
+ for (int i = 0; i < numRelayers; i++)
+ {
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer cons = sess.createConsumer(topic, "name = 'Watt'");
+ //MessageConsumer cons = sess.createConsumer(topic);
+
+ MessageProducer prod = sess.createProducer(topic);
+
+ relayers[i] = new Relayer(prod);
+
+ cons.setMessageListener(relayers[i]);
+ }
+
+ for (int i = 0; i < numConsumers; i++)
+ {
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer cons = sess.createConsumer(topic, "name = 'Tim'");
+
+ consumers[i] = new Consumer();
+
+ cons.setMessageListener(consumers[i]);
+ }
+
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(topic);
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ Message m = sess.createMessage();
+
+ m.setStringProperty("name", "Watt");
+
+ prod.send(m);
+
+ if (i % 100 == 0)
+ {
+ log.info("sent " + i + " messages");
+ }
+ }
+
+ log.info("sent messages");
+
+ for (int i = 0; i < numRelayers; i++)
+ {
+ synchronized (relayers[i])
+ {
+ if (!relayers[i].done)
+ {
+ relayers[i].wait();
+ }
+ }
+ }
+
+ for (int i = 0; i < numConsumers; i++)
+ {
+ synchronized (consumers[i])
+ {
+ if (!consumers[i].done)
+ {
+ consumers[i].wait();
+ }
+ }
+ }
+
+ conn.close();
+
+ for (int i = 0; i < numRelayers; i++)
+ {
+ assertFalse(relayers[i].failed);
+ }
+
+ for (int i = 0; i < numConsumers; i++)
+ {
+ assertFalse(consumers[i].failed);
+ }
+
+ }
+}
+
Modified: trunk/tests/src/org/jboss/test/messaging/jms/stress/TransactionalReceiver.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/stress/TransactionalReceiver.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/jms/stress/TransactionalReceiver.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.messaging.jms.stress;
-import javax.jms.Connection;
-import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Session;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -441,6 +441,17 @@
insureStarted();
server.undeployDestination(isQueue, name);
}
+
+ public static void deployConnectionFactory(String objectName,
+ String[] jndiBindings, int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize)
+ throws Exception
+ {
+ server.deployConnectionFactory(objectName, jndiBindings, prefetchSize,
+ defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
+ }
public static void deployConnectionFactory(String objectName,
String[] jndiBindings, int prefetchSize)
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jboss/ServiceDeploymentDescriptor.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -6,21 +6,21 @@
*/
package org.jboss.test.messaging.tools.jboss;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
-import org.w3c.dom.NamedNodeMap;
-import org.jboss.jms.util.XMLUtil;
-import org.jboss.logging.Logger;
-import org.jboss.jms.util.XMLUtil;
-
-import javax.management.ObjectName;
import java.net.URL;
-import java.util.List;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
-import java.util.Collections;
+import java.util.List;
+import javax.management.ObjectName;
+
+import org.jboss.jms.util.XMLUtil;
+import org.jboss.logging.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
/**
* The convenience object model of a JBoss service deployment descriptor (<server>).
*
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/RemotingJMXWrapper.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/RemotingJMXWrapper.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/RemotingJMXWrapper.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -26,7 +26,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.logging.Logger;
import org.jboss.remoting.ConnectionListener;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvocationHandler;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -552,15 +552,26 @@
sc.unregisterService(destinationObjectName);
}
+
public void deployConnectionFactory(String objectName,
+ String[] jndiBindings,
+ int prefetchSize) throws Exception
+ {
+ deployConnectionFactory(objectName, jndiBindings, prefetchSize, -1, -1, -1);
+ }
+
+ public void deployConnectionFactory(String objectName,
String[] jndiBindings) throws Exception
{
- deployConnectionFactory(objectName, jndiBindings, -1);
+ deployConnectionFactory(objectName, jndiBindings, -1, -1, -1, -1);
}
public void deployConnectionFactory(String objectName,
String[] jndiBindings,
- int prefetchSize) throws Exception
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize) throws Exception
{
String config =
"<mbean code=\"org.jboss.jms.server.connectionfactory.ConnectionFactory\"\n" +
@@ -570,6 +581,21 @@
"<depends optional-attribute-name=\"Connector\">" + ServiceContainer.REMOTING_OBJECT_NAME +
"</depends>\n";
+ if (defaultTempQueueFullSize != -1)
+ {
+ config += "<attribute name=\"DefaultTempQueueFullSize\">" + defaultTempQueueFullSize + "</attribute>\n";
+ }
+
+ if (defaultTempQueuePageSize != -1)
+ {
+ config += "<attribute name=\"DefaultTempQueuePageSize\">" + defaultTempQueuePageSize + "</attribute>\n";
+ }
+
+ if (defaultTempQueueDownCacheSize != -1)
+ {
+ config += "<attribute name=\"DefaultTempQueueDownCacheSize\">" + defaultTempQueueDownCacheSize + "</attribute>\n";
+ }
+
if (prefetchSize != -1)
{
config += "<attribute name=\"PrefetchSize\">" + prefetchSize + "</attribute>";
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -154,6 +154,17 @@
{
server.deployConnectionFactory(objectName, jndiBindings, prefetchSize);
}
+
+ public void deployConnectionFactory(String objectName,
+ String[] jndiBindings,
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize) throws Exception
+ {
+ server.deployConnectionFactory(objectName, jndiBindings, prefetchSize,
+ defaultTempQueueFullSize, defaultTempQueuePageSize, defaultTempQueueDownCacheSize);
+ }
public void undeployConnectionFactory(ObjectName objectName) throws Exception
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -136,6 +136,12 @@
void undeployDestination(boolean isQueue, String name) throws Exception;
void deployConnectionFactory(String objectName,
+ String[] jndiBindings,
+ int prefetchSize,
+ int defaultTempQueueFullSize,
+ int defaultTempQueuePageSize,
+ int defaultTempQueueDownCacheSize) throws Exception;
+ void deployConnectionFactory(String objectName,
String[] jndiBindings,
int prefetchSize) throws Exception;
void deployConnectionFactory(String objectName,
Modified: trunk/tests/src/org/jboss/test/messaging/util/RemotingTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/util/RemotingTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/util/RemotingTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,17 +21,17 @@
*/
package org.jboss.test.messaging.util;
-import javax.management.MBeanServer;
-import javax.naming.InitialContext;
+import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
-import javax.jms.Connection;
-import javax.jms.Session;
+import javax.jms.Message;
import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
import javax.jms.MessageProducer;
-import javax.jms.Message;
+import javax.jms.Session;
import javax.jms.TextMessage;
-import javax.jms.MessageListener;
+import javax.management.MBeanServer;
+import javax.naming.InitialContext;
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
@@ -40,11 +40,11 @@
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvocationHandler;
import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.InvokerRegistry;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
+
import EDU.oswego.cs.dl.util.concurrent.Slot;
/**
Modified: trunk/tests/src/org/jboss/test/messaging/util/ServiceDeploymentDescriptorTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/util/ServiceDeploymentDescriptorTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/util/ServiceDeploymentDescriptorTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,16 +21,12 @@
*/
package org.jboss.test.messaging.util;
+import java.util.List;
+
import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.jms.util.XMLUtil;
import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
import org.jboss.test.messaging.tools.jboss.ServiceDeploymentDescriptor;
-import org.w3c.dom.Element;
-import javax.management.ObjectName;
-import java.util.Set;
-import java.util.List;
-
/**
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
Modified: trunk/tests/src/org/jboss/test/messaging/util/XMLUtilTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/util/XMLUtilTest.java 2006-08-02 03:23:58 UTC (rev 1173)
+++ trunk/tests/src/org/jboss/test/messaging/util/XMLUtilTest.java 2006-08-02 14:14:32 UTC (rev 1174)
@@ -21,13 +21,12 @@
*/
package org.jboss.test.messaging.util;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.jms.util.XMLUtil;
import org.jboss.jms.util.XMLRuntimeException;
import org.jboss.jms.util.XMLUtil;
+import org.jboss.test.messaging.MessagingTestCase;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
More information about the jboss-cvs-commits
mailing list