[jboss-cvs] JBoss Messaging SVN: r2421 - in trunk: src/etc/server/default/deploy and 18 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 24 19:06:06 EST 2007
Author: timfox
Date: 2007-02-24 19:06:06 -0500 (Sat, 24 Feb 2007)
New Revision: 2421
Removed:
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java
Modified:
trunk/.classpath
trunk/src/etc/server/default/deploy/clustered-db2-persistence-service.xml
trunk/src/etc/server/default/deploy/clustered-mssql-persistence-service.xml
trunk/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml
trunk/src/etc/server/default/deploy/clustered-oracle-persistence-service.xml
trunk/src/etc/server/default/deploy/clustered-postgresql-persistence-service.xml
trunk/src/etc/server/default/deploy/clustered-sybase-persistence-service.xml
trunk/src/etc/server/default/deploy/db2-persistence-service.xml
trunk/src/etc/server/default/deploy/mssql-persistence-service.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/main/org/jboss/jms/client/JBossConnectionConsumer.java
trunk/src/main/org/jboss/jms/client/JBossSession.java
trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java
trunk/src/main/org/jboss/jms/client/state/BrowserState.java
trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
trunk/src/main/org/jboss/jms/client/state/SessionState.java
trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java
trunk/src/main/org/jboss/jms/server/ServerPeer.java
trunk/src/main/org/jboss/jms/server/destination/QueueService.java
trunk/src/main/org/jboss/jms/server/destination/TopicService.java
trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java
trunk/src/main/org/jboss/jms/server/endpoint/DeliveryRecovery.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/endpoint/SessionEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/advised/SessionAdvised.java
trunk/src/main/org/jboss/jms/wireformat/ConnectionStartRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionCreateBrowserDelegateRequest.java
trunk/src/main/org/jboss/jms/wireformat/SessionCreateConsumerDelegateRequest.java
trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java
trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindRequest.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindingInfo.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/ClusterRouter.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/LocalClusteredQueue.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PostOfficeInternal.java
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RoundRobinRouter.java
trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
trunk/tests/src/org/jboss/test/messaging/jms/FailoverTest.java
trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
Log:
Lots of fixes to failover - mainly to remove failed over queues
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/.classpath 2007-02-25 00:06:06 UTC (rev 2421)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="docs/examples/queue-failover/src"/>
<classpathentry kind="src" path="output/gen-parsers"/>
- <classpathentry kind="src" path="docs/examples/queue-failover/src"/>
<classpathentry kind="src" path="docs/examples/common/src"/>
<classpathentry kind="src" path="docs/examples/distributed-topic/src"/>
<classpathentry kind="src" path="docs/examples/ejb3mdb/src"/>
Modified: trunk/src/etc/server/default/deploy/clustered-db2-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-db2-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-db2-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/clustered-mssql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-mssql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-mssql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID SMALLINT)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/clustered-oracle-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-oracle-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-oracle-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR2(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR2(1023), COND VARCHAR2(1023), SELECTOR VARCHAR2(1023), CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR2(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR2(1023), COND VARCHAR2(1023), SELECTOR VARCHAR2(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/clustered-postgresql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-postgresql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-postgresql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/clustered-sybase-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/clustered-sybase-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/clustered-sybase-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -44,6 +44,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -74,10 +75,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023) NULL, CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID SMALLINT NULL)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023) NULL, CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
<attribute name="GroupName">DefaultPostOffice</attribute>
<attribute name="StateTimeout">5000</attribute>
Modified: trunk/src/etc/server/default/deploy/db2-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/db2-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/db2-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/mssql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/mssql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/mssql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID SMALLINT)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/mysql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/mysql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/mysql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -73,10 +74,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/oracle-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/oracle-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/oracle-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -74,10 +75,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR2(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR2(1023), COND VARCHAR2(1023), SELECTOR VARCHAR2(1023), CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR2(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR2(1023), COND VARCHAR2(1023), SELECTOR VARCHAR2(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/postgresql-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -74,10 +75,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID INTEGER)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/etc/server/default/deploy/sybase-persistence-service.xml
===================================================================
--- trunk/src/etc/server/default/deploy/sybase-persistence-service.xml 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/etc/server/default/deploy/sybase-persistence-service.xml 2007-02-25 00:06:06 UTC (rev 2421)
@@ -44,6 +44,7 @@
SELECT_EXISTS_REF=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
SELECT_EXISTS_REF_MESSAGE_ID=SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?
UPDATE_DELIVERY_COUNT=UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?
+ UPDATE_CHANNEL_ID=UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?
LOAD_MESSAGES=SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, TYPE FROM JBM_MSG
INSERT_MESSAGE=INSERT INTO JBM_MSG (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, HEADERS, PAYLOAD, CHANNEL_COUNT, TYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
INC_CHANNEL_COUNT=UPDATE JBM_MSG SET CHANNEL_COUNT = CHANNEL_COUNT + 1 WHERE MESSAGE_ID=?
@@ -74,10 +75,10 @@
<attribute name="DataSource">java:/DefaultDS</attribute>
<attribute name="CreateTablesOnStartup">true</attribute>
<attribute name="SqlProperties"><![CDATA[
-CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023) NULL, CHANNEL_ID INTEGER, IS_FAILED_OVER CHAR(1), FAILED_NODE_ID SMALLINT NULL)
-INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023) NULL, CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
+INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
-LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, IS_FAILED_OVER, FAILED_NODE_ID FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
+LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]></attribute>
</mbean>
Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -39,6 +39,7 @@
import org.jboss.jms.delegate.SessionDelegate;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.message.MessageProxy;
+import org.jboss.jms.util.MessageQueueNameHelper;
import org.jboss.jms.util.ThreadContextClassLoaderChanger;
import org.jboss.logging.Logger;
@@ -98,7 +99,7 @@
private int maxDeliveries;
- private long channelID;
+ private String queueName;
// Static --------------------------------------------------------
@@ -126,7 +127,7 @@
// not call pre or postDeliver so messages won't be acked, or stored in session/tx.
sess = conn.createSessionDelegate(false, Session.CLIENT_ACKNOWLEDGE, false);
- cons = sess.createConsumerDelegate(dest, messageSelector, false, subName, true, -1);
+ cons = sess.createConsumerDelegate(dest, messageSelector, false, subName, true);
}
finally
{
@@ -136,10 +137,17 @@
ConsumerState state = (ConsumerState)((DelegateSupport)cons).getState();
this.consumerID = state.getConsumerID();
+
+ this.maxDeliveries = state.getMaxDeliveries();
- this.channelID = state.getChannelID();
-
- this.maxDeliveries = state.getMaxDeliveries();
+ if (subName != null)
+ {
+ queueName = MessageQueueNameHelper.createSubscriptionName(conn.getClientID(), subName);
+ }
+ else
+ {
+ queueName = dest.getName();
+ }
id = threadId.increment();
internalThread = new Thread(this, "Connection Consumer for dest " + dest + " id=" + id);
@@ -287,7 +295,7 @@
for (int i = 0; i < mesList.size(); i++)
{
MessageProxy m = (MessageProxy)mesList.get(i);
- session.addAsfMessage(m, consumerID, channelID, maxDeliveries, sess);
+ session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess);
if (trace) { log.trace("added " + m + " to session"); }
}
Modified: trunk/src/main/org/jboss/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossSession.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/JBossSession.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -264,7 +264,7 @@
tccc.set(getClass().getClassLoader());
ConsumerDelegate cd = delegate.
- createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false, -1);
+ createConsumerDelegate((JBossDestination)d, messageSelector, noLocal, null, false);
return new JBossMessageConsumer(cd);
}
@@ -317,7 +317,7 @@
tccc.set(getClass().getClassLoader());
ConsumerDelegate cd =
- delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false, -1);
+ delegate.createConsumerDelegate((JBossTopic)topic, null, false, name, false);
return new JBossMessageConsumer(cd);
}
@@ -352,7 +352,7 @@
}
ConsumerDelegate cd = delegate.
- createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false, -1);
+ createConsumerDelegate((JBossTopic)topic, messageSelector, noLocal, name, false);
return new JBossMessageConsumer(cd);
}
@@ -389,7 +389,7 @@
tccc.set(getClass().getClassLoader());
BrowserDelegate del =
- delegate.createBrowserDelegate((JBossQueue)queue, messageSelector, -1);
+ delegate.createBrowserDelegate((JBossQueue)queue, messageSelector);
return new JBossQueueBrowser(queue, messageSelector, del);
}
@@ -518,10 +518,10 @@
* This method is used by the JBossConnectionConsumer to load up the session
* with messages to be processed by the session's run() method
*/
- void addAsfMessage(MessageProxy m, int consumerID, long channelID, int maxDeliveries,
+ void addAsfMessage(MessageProxy m, int consumerID, String queueName, int maxDeliveries,
SessionDelegate connectionConsumerSession)
{
- delegate.addAsfMessage(m, consumerID, channelID, maxDeliveries, connectionConsumerSession);
+ delegate.addAsfMessage(m, consumerID, queueName, maxDeliveries, connectionConsumerSession);
}
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/container/ConsumerAspect.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -33,6 +33,7 @@
import org.jboss.jms.client.state.SessionState;
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.delegate.SessionDelegate;
+import org.jboss.jms.util.MessageQueueNameHelper;
import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
@@ -75,15 +76,24 @@
SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
int consumerID = consumerState.getConsumerID();
- long channelID = consumerState.getChannelID();
int prefetchSize = consumerState.getBufferSize();
QueuedExecutor sessionExecutor = sessionState.getExecutor();
int maxDeliveries = consumerState.getMaxDeliveries();
+ //We need the queue name for recovering any deliveries after failover
+ String queueName = null;
+ if (consumerState.getSubscriptionName() != null)
+ {
+ queueName = MessageQueueNameHelper.createSubscriptionName(connectionState.getClientID(), consumerState.getSubscriptionName());
+ }
+ else if (consumerState.getDestination().isQueue())
+ {
+ queueName = consumerState.getDestination().getName();
+ }
+
MessageCallbackHandler messageHandler =
new MessageCallbackHandler(isCC, sessionState.getAcknowledgeMode(),
- sessionDelegate, consumerDelegate, consumerID,
- channelID,
+ sessionDelegate, consumerDelegate, consumerID, queueName,
prefetchSize, sessionExecutor, maxDeliveries);
sessionState.addCallbackHandler(messageHandler);
Modified: trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/container/FailoverValveInterceptor.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -101,14 +101,6 @@
JMSRemotingConnection remotingConnection = null;
String methodName = ((MethodInvocation)invocation).getMethod().getName();
- // consumer.receive should be ignored as it doesn't perform any server IO:
- // http://jira.jboss.org/jira/browse/JBMESSAGING-790
- if (invocation.getTargetObject() instanceof ClientConsumerDelegate &&
- methodName.equals("receive"))
- {
- return invocation.invokeNext();
- }
-
try
{
valve.enter();
Modified: trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/container/SessionAspect.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -748,7 +748,7 @@
MessageProxy m = (MessageProxy)mi.getArguments()[0];
int theConsumerID = ((Integer)mi.getArguments()[1]).intValue();
- long channelID = ((Long)mi.getArguments()[2]).longValue();
+ String queueName = (String)mi.getArguments()[2];
int maxDeliveries = ((Integer)mi.getArguments()[3]).intValue();
SessionDelegate connectionConsumerDelegate = ((SessionDelegate)mi.getArguments()[4]);
@@ -760,7 +760,7 @@
AsfMessageHolder holder = new AsfMessageHolder();
holder.msg = m;
holder.consumerID = theConsumerID;
- holder.channelID = channelID;
+ holder.queueName = queueName;
holder.maxDeliveries = maxDeliveries;
holder.connectionConsumerDelegate = connectionConsumerDelegate;
@@ -791,7 +791,7 @@
if (trace) { log.trace("sending " + holder.msg + " to the message listener" ); }
MessageCallbackHandler.callOnMessage(del, state.getDistinguishedListener(), holder.consumerID,
- holder.channelID, false,
+ holder.queueName, false,
holder.msg, ackMode, holder.maxDeliveries,
holder.connectionConsumerDelegate);
}
@@ -873,7 +873,7 @@
{
private MessageProxy msg;
private int consumerID;
- private long channelID;
+ private String queueName;
private int maxDeliveries;
private SessionDelegate connectionConsumerDelegate;
}
Modified: trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -162,12 +162,11 @@
int consumerID = consumerDelegate.getID();
int bufferSize = consumerDelegate.getBufferSize();
int maxDeliveries = consumerDelegate.getMaxDeliveries();
- long channelID = consumerDelegate.getChannelID();
ConsumerState consumerState =
new ConsumerState(sessionState, consumerDelegate, dest, selector, noLocal,
subscriptionName, consumerID, connectionConsumer, bufferSize,
- maxDeliveries, channelID);
+ maxDeliveries);
delegate.setState(consumerState);
return consumerDelegate;
@@ -209,10 +208,8 @@
JBossDestination destination = (JBossDestination)mi.getArguments()[0];
String selector = (String)mi.getArguments()[1];
- long channelID = browserDelegate.getChannelID();
-
BrowserState state =
- new BrowserState(sessionState, browserDelegate, destination, selector, channelID);
+ new BrowserState(sessionState, browserDelegate, destination, selector);
delegate.setState(state);
return browserDelegate;
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientBrowserDelegate.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -54,16 +54,13 @@
// Attributes -----------------------------------------------------------------------------------
- private long channelID;
-
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
- public ClientBrowserDelegate(int objectID, long channelID)
+ public ClientBrowserDelegate(int objectID)
{
super(objectID);
- this.channelID = channelID;
}
public ClientBrowserDelegate()
@@ -147,15 +144,11 @@
public void read(DataInputStream in) throws Exception
{
super.read(in);
-
- channelID = in.readLong();
}
public void write(DataOutputStream out) throws Exception
{
super.write(out);
-
- out.writeLong(channelID);
}
// Public ---------------------------------------------------------------------------------------
@@ -165,11 +158,6 @@
return "BrowserStack";
}
- public long getChannelID()
- {
- return channelID;
- }
-
public String toString()
{
return "BrowserDelegate[" + id + "]";
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -235,7 +235,7 @@
{
RequestSupport req = new ConnectionStartRequest(id, version);
- doInvoke(client, req);
+ doInvokeOneway(client, req);
}
public void stop() throws JMSException
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -56,18 +56,16 @@
private int bufferSize;
private int maxDeliveries;
- private long channelID;
-
+
// Static ---------------------------------------------------------------------------------------
// Constructors ---------------------------------------------------------------------------------
- public ClientConsumerDelegate(int objectID, long channelID, int bufferSize, int maxDeliveries)
+ public ClientConsumerDelegate(int objectID, int bufferSize, int maxDeliveries)
{
super(objectID);
this.bufferSize = bufferSize;
this.maxDeliveries = maxDeliveries;
- this.channelID = channelID;
}
public ClientConsumerDelegate()
@@ -92,7 +90,6 @@
bufferSize = newDelegate.getBufferSize();
maxDeliveries = newDelegate.getMaxDeliveries();
- channelID = newDelegate.getChannelID();
client = ((ConnectionState)state.getParent().getParent()).getRemotingConnection().
getRemotingClient();
@@ -202,8 +199,6 @@
bufferSize = in.readInt();
maxDeliveries = in.readInt();
-
- channelID = in.readLong();
}
public void write(DataOutputStream out) throws Exception
@@ -213,15 +208,13 @@
out.writeInt(bufferSize);
out.writeInt(maxDeliveries);
-
- out.writeLong(channelID);
}
// Public ---------------------------------------------------------------------------------------
public String toString()
{
- return "ConsumerDelegate[" + id + ", ChID=" + channelID + "]";
+ return "ConsumerDelegate[" + id + "]";
}
public int getBufferSize()
@@ -233,11 +226,6 @@
{
return maxDeliveries;
}
-
- public long getChannelID()
- {
- return channelID;
- }
// Protected ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -194,11 +194,10 @@
throw new IllegalStateException("This invocation should not be handled here!");
}
- public BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector,
- long failoverChannelID) throws JMSException
+ public BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector) throws JMSException
{
RequestSupport req = new SessionCreateBrowserDelegateRequest(id, version, queue,
- messageSelector, failoverChannelID);
+ messageSelector);
Object res = doInvoke(client, req);
@@ -217,11 +216,10 @@
public ConsumerDelegate createConsumerDelegate(JBossDestination destination, String selector,
boolean noLocal, String subscriptionName,
- boolean connectionConsumer,
- long failoverChannelID) throws JMSException
+ boolean connectionConsumer) throws JMSException
{
RequestSupport req = new SessionCreateConsumerDelegateRequest(id, version, destination,
- selector, noLocal, subscriptionName, connectionConsumer, failoverChannelID);
+ selector, noLocal, subscriptionName, connectionConsumer);
return (ConsumerDelegate)doInvoke(client, req);
}
@@ -429,7 +427,7 @@
* This invocation should either be handled by the client-side interceptor chain or by the
* server-side endpoint.
*/
- public void addAsfMessage(MessageProxy m, int consumerID, long channelId, int maxDeliveries,
+ public void addAsfMessage(MessageProxy m, int consumerID, String queueName, int maxDeliveries,
SessionDelegate connectionConsumerSession)
{
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 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/remoting/MessageCallbackHandler.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -114,7 +114,7 @@
public static void callOnMessage(SessionDelegate sess,
MessageListener listener,
int consumerID,
- long channelID,
+ String queueName,
boolean isConnectionConsumer,
MessageProxy m,
int ackMode,
@@ -129,7 +129,7 @@
}
DeliveryInfo deliveryInfo =
- new DeliveryInfo(m, consumerID, channelID, connectionConsumerSession);
+ new DeliveryInfo(m, consumerID, queueName, connectionConsumerSession);
m.incDeliveryCount();
@@ -197,7 +197,7 @@
private QueuedExecutor sessionExecutor;
private boolean listenerRunning;
private int maxDeliveries;
- private long channelID;
+ private String queueName;
private long lastDeliveryId = -1;
private volatile boolean serverSending = true;
@@ -206,7 +206,7 @@
public MessageCallbackHandler(boolean isCC, int ackMode,
SessionDelegate sess, ConsumerDelegate cons, int consumerID,
- long channelID,
+ String queueName,
int bufferSize, QueuedExecutor sessionExecutor,
int maxDeliveries)
{
@@ -223,7 +223,7 @@
this.sessionDelegate = sess;
this.consumerDelegate = cons;
this.consumerID = consumerID;
- this.channelID = channelID;
+ this.queueName = queueName;
mainLock = new Object();
this.sessionExecutor = sessionExecutor;
this.maxDeliveries = maxDeliveries;
@@ -436,7 +436,7 @@
if (!isConnectionConsumer && !ignore)
{
- DeliveryInfo info = new DeliveryInfo(m, consumerID, channelID, null);
+ DeliveryInfo info = new DeliveryInfo(m, consumerID, queueName, null);
m.incDeliveryCount();
@@ -804,7 +804,7 @@
{
try
{
- callOnMessage(sessionDelegate, listener, consumerID, channelID,
+ callOnMessage(sessionDelegate, listener, consumerID, queueName,
false, mp, ackMode, maxDeliveries, null);
}
catch (JMSException e)
Modified: trunk/src/main/org/jboss/jms/client/state/BrowserState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/BrowserState.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/state/BrowserState.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -52,18 +52,14 @@
private JBossDestination jmsDestination;
private String messageSelector;
- // Needed for failover
- private long channelID;
-
// Constructors ---------------------------------------------------------------------------------
public BrowserState(SessionState parent, BrowserDelegate delegate,
- JBossDestination jmsDestination, String selector, long channelID)
+ JBossDestination jmsDestination, String selector)
{
super(parent, (DelegateSupport)delegate);
this.jmsDestination = jmsDestination;
this.messageSelector = selector;
- this.channelID = channelID;
}
// HierarchicalState implementation -------------------------------------------------------------
@@ -95,9 +91,7 @@
// HierarchicalStateSupport overrides -----------------------------------------------------------
public void synchronizeWith(HierarchicalState ns) throws Exception
- {
- BrowserState newState = (BrowserState)ns;
- channelID = newState.channelID;
+ {
}
// Public ---------------------------------------------------------------------------------------
@@ -112,11 +106,6 @@
return messageSelector;
}
- public long getChannelID()
- {
- return channelID;
- }
-
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/client/state/ConsumerState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/state/ConsumerState.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -32,6 +32,7 @@
import org.jboss.jms.delegate.ConsumerDelegate;
import org.jboss.jms.destination.JBossDestination;
import org.jboss.jms.server.Version;
+import org.jboss.jms.util.MessageQueueNameHelper;
/**
* State corresponding to a Consumer. This state is acessible inside aspects/interceptors.
@@ -52,7 +53,7 @@
// Attributes -----------------------------------------------------------------------------------
private int consumerID;
- private Destination destination;
+ private JBossDestination destination;
private String selector;
private String subscriptionName;
private boolean noLocal;
@@ -63,17 +64,14 @@
private boolean storingDeliveries;
- // Needed for failover
- private long channelID;
-
private SessionState parent;
private ConsumerDelegate delegate;
-
+
// Constructors ---------------------------------------------------------------------------------
public ConsumerState(SessionState parent, ConsumerDelegate delegate, JBossDestination dest,
String selector, boolean noLocal, String subscriptionName, int consumerID,
- boolean isCC, int bufferSize, int maxDeliveries, long channelID)
+ boolean isCC, int bufferSize, int maxDeliveries)
{
super(parent, (DelegateSupport)delegate);
children = Collections.EMPTY_SET;
@@ -85,18 +83,17 @@
this.bufferSize = bufferSize;
this.subscriptionName=subscriptionName;
this.maxDeliveries = maxDeliveries;
- this.channelID = channelID;
-
+
//We don't store deliveries if this a non durable subscriber
if (dest.isTopic() && subscriptionName == null)
{
- storingDeliveries = false;
+ storingDeliveries = false;
}
else
{
storingDeliveries = true;
- }
+ }
}
// HierarchicalState implementation -------------------------------------------------------------
@@ -134,8 +131,7 @@
int oldConsumerID = consumerID;
consumerID = newState.consumerID;
- channelID = newState.channelID;
-
+
CallbackManager oldCallbackManager = ((ClientConnectionDelegate)getParent().getParent().
getDelegate()).getRemotingConnection().getCallbackManager();
CallbackManager newCallbackManager = ((ClientConnectionDelegate)ns.getParent().getParent().
@@ -152,7 +148,7 @@
// Public ---------------------------------------------------------------------------------------
- public Destination getDestination()
+ public JBossDestination getDestination()
{
return destination;
}
@@ -207,11 +203,6 @@
return maxDeliveries;
}
- public long getChannelID()
- {
- return channelID;
- }
-
public boolean isStoringDeliveries()
{
return storingDeliveries;
Modified: trunk/src/main/org/jboss/jms/client/state/SessionState.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/client/state/SessionState.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -215,8 +215,7 @@
consState.getSelector(),
consState.isNoLocal(),
consState.getSubscriptionName(),
- consState.isConnectionConsumer(),
- consState.getChannelID());
+ consState.isConnectionConsumer());
log.debug(this + " created new consumer " + newConsDelegate);
consDelegate.synchronizeWith(newConsDelegate);
@@ -244,8 +243,7 @@
// create a new browser over the new session for each browser on the old session
ClientBrowserDelegate newBrowserDelegate = (ClientBrowserDelegate)newDelegate.
createBrowserDelegate(browserState.getJmsDestination(),
- browserState.getMessageSelector(),
- browserState.getChannelID());
+ browserState.getMessageSelector());
log.debug(this + " created new browser " + newBrowserDelegate);
browserDelegate.synchronizeWith(newBrowserDelegate);
@@ -324,7 +322,7 @@
DeliveryRecovery recInfo =
new DeliveryRecovery(del.getMessageProxy().getDeliveryId(),
del.getMessageProxy().getMessage().getMessageID(),
- del.getChannelId());
+ del.getQueueName());
recoveryInfos.add(recInfo);
}
Modified: trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/delegate/SessionDelegate.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -78,7 +78,7 @@
XAResource getXAResource();
- void addAsfMessage(MessageProxy m, int consumerID, long channelID,
+ void addAsfMessage(MessageProxy m, int consumerID, String queueName,
int maxDeliveries, SessionDelegate connectionConsumerDelegate);
boolean getTransacted();
Modified: trunk/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/ServerPeer.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -60,6 +60,7 @@
import org.jboss.messaging.core.memory.SimpleMemoryManager;
import org.jboss.messaging.core.message.SimpleMessageStore;
import org.jboss.messaging.core.plugin.IDManager;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
import org.jboss.messaging.core.plugin.contract.PostOffice;
@@ -1515,7 +1516,15 @@
{
try
{
- postOffice.unbindQueue(binding.getQueue().getName());
+ Queue queue = binding.getQueue();
+ if (!queue.isClustered())
+ {
+ postOffice.unbindQueue(queue.getName());
+ }
+ else
+ {
+ ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
+ }
}
catch (Throwable t)
{
Modified: trunk/src/main/org/jboss/jms/server/destination/QueueService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/destination/QueueService.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -7,8 +7,6 @@
package org.jboss.jms.server.destination;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import javax.jms.IllegalStateException;
@@ -22,7 +20,6 @@
import org.jboss.messaging.core.local.PagingFilteredQueue;
import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.postoffice.Binding;
-import org.jboss.messaging.core.plugin.postoffice.cluster.FailedOverQueue;
import org.jboss.messaging.core.plugin.postoffice.cluster.LocalClusteredQueue;
/**
@@ -67,6 +64,8 @@
try
{
+ log.info("Starting queue " + destination.getName());
+
postOffice = serverPeer.getPostOfficeInstance();
destination.setServerPeer(serverPeer);
@@ -74,56 +73,35 @@
// Binding must be added before destination is registered in JNDI otherwise the user could
// get a reference to the destination and use it while it is still being loaded. Also,
// binding might already exist.
-
- JMSCondition topicCond = new JMSCondition(true, destination.getName());
-
- // There may be many bindings since there maybe failed over queues
- Collection bindings = postOffice.getBindingsForCondition(topicCond);
- Iterator iter = bindings.iterator();
-
+
PagingFilteredQueue queue = null;
- while (iter.hasNext())
- {
- Binding binding = (Binding)iter.next();
+ Binding binding = postOffice.getBindingForQueueName(destination.getName());
+
+ if (binding != null)
+ {
+ queue = (PagingFilteredQueue)binding.getQueue();
- PagingFilteredQueue q = (PagingFilteredQueue)binding.getQueue();
-
- q.setPagingParams(destination.getFullSize(),
- destination.getPageSize(),
- destination.getDownCacheSize());
- q.load();
-
- if (q instanceof FailedOverQueue && queue.getMessageCount() == 0)
- {
- // If there are no message references in the queue we can safely delete it. We don't
- // want empty queues from previous failed nodes clogging up the database.
+ queue.setPagingParams(destination.getFullSize(),
+ destination.getPageSize(),
+ destination.getDownCacheSize());
+ queue.load();
- //TODO - commented out for now
-
-// ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-// cpo.unbindClusteredQueue(q.getName());
- }
- else
- {
- // Must be done after load
- q.setMaxSize(destination.getMaxSize());
- q.activate();
-
- if (!(queue instanceof FailedOverQueue))
- {
- queue = q;
- }
- }
- }
+ // Must be done after load
+ queue.setMaxSize(destination.getMaxSize());
+ queue.activate();
+ log.info("Activated queue " + queue);
+ }
+
if (queue == null)
{
+ log.info("Queue was null so creating a new one");
// Create a new queue
JMSCondition queueCond = new JMSCondition(true, destination.getName());
- if (postOffice.isLocal())
+ if (postOffice.isLocal() || !destination.isClustered())
{
queue = new PagingFilteredQueue(destination.getName(),
idm.getID(), ms, pm, true, true,
@@ -133,24 +111,18 @@
postOffice.bindQueue(queueCond, queue);
}
else
- {
+ {
+ ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+
queue = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, destination.getName(),
- idm.getID(), ms, pm, true, true,
- destination.getMaxSize(), null, tr,
- destination.getFullSize(), destination.getPageSize(),
- destination.getDownCacheSize());
+ idm.getID(), ms, pm, true, true,
+ destination.getMaxSize(), null, tr,
+ destination.getFullSize(), destination.getPageSize(),
+ destination.getDownCacheSize());
- ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
+ cpo.bindClusteredQueue(queueCond, (LocalClusteredQueue)queue);
- if (destination.isClustered())
- {
- cpo.bindClusteredQueue(queueCond, (LocalClusteredQueue)queue);
- }
- else
- {
- cpo.bindQueue(queueCond, (LocalClusteredQueue)queue);
- }
- }
+ }
}
((ManagedQueue)destination).setQueue(queue);
Modified: trunk/src/main/org/jboss/jms/server/destination/TopicService.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/TopicService.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/destination/TopicService.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -18,8 +18,8 @@
import org.jboss.jms.util.MessageQueueNameHelper;
import org.jboss.jms.util.XMLUtil;
import org.jboss.messaging.core.local.PagingFilteredQueue;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.postoffice.Binding;
-import org.jboss.messaging.core.plugin.postoffice.cluster.FailedOverQueue;
/**
* A deployable JBoss Messaging topic.
@@ -87,42 +87,29 @@
queue.setPagingParams(destination.getFullSize(), destination.getPageSize(), destination.getDownCacheSize());
queue.load();
+
+ queue.activate();
+
+ //Must be done after load
+ queue.setMaxSize(destination.getMaxSize());
- if (queue instanceof FailedOverQueue && queue.getMessageCount() == 0)
+ //Create a counter
+ String counterName = SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queue.getName();
+
+ String subName = MessageQueueNameHelper.createHelper(queue.getName()).getSubName();
+
+ int dayLimitToUse = destination.getMessageCounterHistoryDayLimit();
+ if (dayLimitToUse == -1)
{
- // If there are no message references in the queue we can safely delete it. We don't
- // want empty queues from previous failed nodes clogging up the database.
-
- //TODO - commented out for now
-
-// ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-// cpo.unbindClusteredQueue(queue.getName());
+ //Use override on server peer
+ dayLimitToUse = serverPeer.getDefaultMessageCounterHistoryDayLimit();
}
- else
- {
- queue.activate();
-
- //Must be done after load
- queue.setMaxSize(destination.getMaxSize());
-
- //Create a counter
- String counterName = SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queue.getName();
-
- String subName = MessageQueueNameHelper.createHelper(queue.getName()).getSubName();
-
- int dayLimitToUse = destination.getMessageCounterHistoryDayLimit();
- if (dayLimitToUse == -1)
- {
- //Use override on server peer
- dayLimitToUse = serverPeer.getDefaultMessageCounterHistoryDayLimit();
- }
-
- MessageCounter counter =
- new MessageCounter(counterName, subName, queue, true, true,
- dayLimitToUse);
-
- serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
- }
+
+ MessageCounter counter =
+ new MessageCounter(counterName, subName, queue, true, true,
+ dayLimitToUse);
+
+ serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
}
dm.registerDestination(destination);
@@ -169,7 +156,14 @@
queue.removeAllReferences();
// Unbind
- postOffice.unbindQueue(queue.getName());
+ if (!queue.isClustered())
+ {
+ postOffice.unbindQueue(queue.getName());
+ }
+ else
+ {
+ ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
+ }
}
queue.deactivate();
Modified: trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/DeliveryInfo.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -39,9 +39,7 @@
// Attributes ----------------------------------------------------
- //This is needed on failover when recreating delivery list on the server session
- //we need to know the channel id so we can recreate the deliveries
- private long channelID;
+ private String queueName;
//This is needed when doing local redelivery of messages, since we need to know which
//consumer gets the message
@@ -58,31 +56,27 @@
//to the connection consumer's session, otherwise it will be null
private SessionDelegate connectionConsumerSession;
- // private boolean exceedDeliveryAttempts;
-
- // private boolean expired;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public DeliveryInfo(MessageProxy msg, int consumerId, long channelID,
+ public DeliveryInfo(MessageProxy msg, int consumerId, String queueName,
SessionDelegate connectionConsumerSession)
{
this.msg = msg;
this.consumerId = consumerId;
- this.channelID = channelID;
+ this.queueName = queueName;
this.connectionConsumerSession = connectionConsumerSession;
}
// Public --------------------------------------------------------
- public long getChannelId()
+ public String getQueueName()
{
- return channelID;
+ return queueName;
}
public int getConsumerId()
@@ -100,31 +94,6 @@
return connectionConsumerSession;
}
-// public void setExceededDeliveryAttempts()
-// {
-// exceedDeliveryAttempts = true;
-// }
-//
-// public void setExpired()
-// {
-// expired = true;
-// }
-//
-// public boolean exceededDeliveryAttempts()
-// {
-// return exceedDeliveryAttempts;
-// }
-//
-// public boolean isExpired()
-// {
-// return expired;
-// }
-//
-// public boolean isToCancel()
-// {
-// return exceedDeliveryAttempts || expired;
-// }
-
public String toString()
{
return "Delivery[" + getDeliveryID() + ", " + msg + "]";
Modified: trunk/src/main/org/jboss/jms/server/endpoint/DeliveryRecovery.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/DeliveryRecovery.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/DeliveryRecovery.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -48,7 +48,7 @@
private long deliveryID;
private long messageID;
- private long channelID;
+ private String queueName;
// Constructors ---------------------------------------------------------------------------------
@@ -56,11 +56,11 @@
{
}
- public DeliveryRecovery(long deliveryID, long messageID, long channelID)
+ public DeliveryRecovery(long deliveryID, long messageID, String queueName)
{
this.deliveryID = deliveryID;
this.messageID = messageID;
- this.channelID = channelID;
+ this.queueName = queueName;
}
// Streamable implementation --------------------------------------------------------------------
@@ -69,14 +69,14 @@
{
deliveryID = in.readLong();
messageID = in.readLong();
- channelID = in.readLong();
+ queueName = in.readUTF();
}
public void write(DataOutputStream out) throws Exception
{
out.writeLong(deliveryID);
out.writeLong(messageID);
- out.writeLong(channelID);
+ out.writeUTF(queueName);
}
// Public ---------------------------------------------------------------------------------------
@@ -91,14 +91,14 @@
return messageID;
}
- public long getChannelID()
+ public String getQueueName()
{
- return channelID;
+ return queueName;
}
public String toString()
{
- return "DeliveryRecovery[ID=" + deliveryID + ", MID=" + messageID + ", CID=" + channelID + "]";
+ return "DeliveryRecovery[ID=" + deliveryID + ", MID=" + messageID + ", Queue name=" + queueName + "]";
}
// Package protected ----------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -43,6 +43,7 @@
import org.jboss.messaging.core.SimpleDelivery;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageReference;
+import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.contract.PostOffice;
import org.jboss.messaging.core.plugin.postoffice.Binding;
import org.jboss.messaging.core.tx.Transaction;
@@ -51,226 +52,265 @@
import org.jboss.remoting.callback.HandleCallbackException;
import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+
/**
- * Concrete implementation of ConsumerEndpoint.
+ * Concrete implementation of ConsumerEndpoint. Lives on the boundary between
+ * Messaging Core and the JMS Facade. Handles delivery of messages from the
+ * server to the client side consumer.
*
- * Lives on the boundary between Messaging Core and the JMS Facade. Handles delivery of messages
- * from the server to the client side consumer.
- *
- *
* @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$
+ * @version <tt>$Revision$</tt> $Id: ServerConsumerEndpoint.java 2399
+ * 2007-02-23 01:21:29Z ovidiu.feodorov at jboss.com $
*/
public class ServerConsumerEndpoint implements Receiver, ConsumerEndpoint
{
- // Constants ------------------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------------------
- private static final Logger log = Logger.getLogger(ServerConsumerEndpoint.class);
+ private static final Logger log = Logger
+ .getLogger(ServerConsumerEndpoint.class);
- // Static ---------------------------------------------------------------------------------------
+ // Static
+ // ---------------------------------------------------------------------------------------
- // Attributes -----------------------------------------------------------------------------------
+ // Attributes
+ // -----------------------------------------------------------------------------------
private boolean trace = log.isTraceEnabled();
private int id;
private Channel messageQueue;
-
+
private String queueName;
private ServerSessionEndpoint sessionEndpoint;
-
+
private ServerInvokerCallbackHandler callbackHandler;
-
+
private boolean noLocal;
private Selector messageSelector;
private JBossDestination destination;
-
+
private Queue dlq;
-
+
private Queue expiryQueue;
-
+
private long redeliveryDelay;
-
+
private boolean started;
-
- //This lock protects starting and stopping
+
+ // This lock protects starting and stopping
private Object startStopLock;
// Must be volatile
private volatile boolean clientAccepting;
+
+ private boolean storeDeliveries;
- private boolean storeDeliveries;
+ // Constructors
+ // ---------------------------------------------------------------------------------
- // Constructors ---------------------------------------------------------------------------------
-
ServerConsumerEndpoint(int id, Channel messageQueue, String queueName,
- ServerSessionEndpoint sessionEndpoint,
- String selector, boolean noLocal, JBossDestination dest,
- Queue dlq, Queue expiryQueue, long redeliveryDelay)
- throws InvalidSelectorException
+ ServerSessionEndpoint sessionEndpoint, String selector,
+ boolean noLocal, JBossDestination dest, Queue dlq,
+ Queue expiryQueue, long redeliveryDelay)
+ throws InvalidSelectorException
{
- if (trace) { log.trace("constructing consumer endpoint " + id); }
+ if (trace)
+ {
+ log.trace("constructing consumer endpoint " + id);
+ }
this.id = id;
-
+
this.messageQueue = messageQueue;
-
+
this.queueName = queueName;
-
+
this.sessionEndpoint = sessionEndpoint;
-
- this.callbackHandler = sessionEndpoint.getConnectionEndpoint().getCallbackHandler();
-
+
+ this.callbackHandler = sessionEndpoint.getConnectionEndpoint()
+ .getCallbackHandler();
+
this.noLocal = noLocal;
-
+
this.destination = dest;
-
+
this.dlq = dlq;
-
+
this.redeliveryDelay = redeliveryDelay;
-
+
this.expiryQueue = expiryQueue;
-
+
// Always start as false - wait for consumer to initiate.
this.clientAccepting = false;
-
+
this.startStopLock = new Object();
-
+
if (dest.isTopic() && !messageQueue.isRecoverable())
{
- // This is a consumer of a non durable topic subscription. We don't need to store
+ // This is a consumer of a non durable topic subscription. We don't
+ // need to store
// deliveries since if the consumer is closed or dies the refs go too.
this.storeDeliveries = false;
- }
- else
+ } else
{
this.storeDeliveries = true;
}
-
+
storeDeliveries = true;
-
+
if (selector != null)
{
- if (trace) log.trace("creating selector:" + selector);
+ if (trace)
+ log.trace("creating selector:" + selector);
this.messageSelector = new Selector(selector);
- if (trace) log.trace("created selector");
+ if (trace)
+ log.trace("created selector");
}
-
+
this.started = this.sessionEndpoint.getConnectionEndpoint().isStarted();
// adding the consumer to the queue
this.messageQueue.add(this);
-
- //We don't need to prompt delivery - this will come from the client in a changeRate request
-
+
+ // We don't need to prompt delivery - this will come from the client in a
+ // changeRate request
+
log.debug(this + " constructed");
}
- // Receiver implementation ----------------------------------------------------------------------
+ // Receiver implementation
+ // ----------------------------------------------------------------------
/*
- * The queue ensures that handle is never called concurrently by more than one thread.
+ * The queue ensures that handle is never called concurrently by more than
+ * one thread.
*/
- public Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx)
+ public Delivery handle(DeliveryObserver observer, MessageReference ref,
+ Transaction tx)
{
- if (trace) { log.trace(this + " receives " + ref + " for delivery"); }
-
+ if (trace)
+ {
+ log.trace(this + " receives " + ref + " for delivery");
+ }
+
// This is ok to have outside lock - is volatile
if (!clientAccepting)
{
- if (trace) { log.trace(this + "'s client is NOT accepting messages!"); }
-
+ if (trace)
+ {
+ log.trace(this + "'s client is NOT accepting messages!");
+ }
+
return null;
}
-
+
if (ref.getMessage().isExpired())
{
SimpleDelivery delivery = new SimpleDelivery(observer, ref, true);
-
+
try
{
sessionEndpoint.expireDelivery(delivery, expiryQueue);
- }
- catch (Throwable t)
+ } catch (Throwable t)
{
log.error("Failed to expire delivery: " + delivery, t);
}
-
+
return delivery;
}
-
+
synchronized (startStopLock)
- {
- // If the consumer is stopped then we don't accept the message, it should go back into the
+ {
+ // If the consumer is stopped then we don't accept the message, it
+ // should go back into the
// queue for delivery later.
if (!started)
{
- if (trace) { log.trace(this + " NOT started yet!"); }
-
+ if (trace)
+ {
+ log.trace(this + " NOT started yet!");
+ }
+
return null;
}
-
- if (trace) { log.trace(this + " has startStopLock lock, preparing the message for delivery"); }
-
+
+ if (trace)
+ {
+ log
+ .trace(this
+ + " has startStopLock lock, preparing the message for delivery");
+ }
+
Message message = ref.getMessage();
-
+
boolean selectorRejected = !this.accept(message);
-
- SimpleDelivery delivery = new SimpleDelivery(observer, ref, !storeDeliveries, !selectorRejected);
-
+
+ SimpleDelivery delivery = new SimpleDelivery(observer, ref,
+ !storeDeliveries, !selectorRejected);
+
if (selectorRejected)
{
return delivery;
}
-
+
long deliveryId;
-
+
if (storeDeliveries)
{
- deliveryId = sessionEndpoint.addDelivery(delivery, id, dlq, expiryQueue, redeliveryDelay);
- }
- else
+ deliveryId = sessionEndpoint.addDelivery(delivery, id, dlq,
+ expiryQueue, redeliveryDelay);
+ } else
{
deliveryId = -1;
}
-
- // We send the message to the client on the current thread. The message is written onto the
- // transport and then the thread returns immediately without waiting for a response.
-
+
+ // We send the message to the client on the current thread. The message
+ // is written onto the
+ // transport and then the thread returns immediately without waiting
+ // for a response.
+
Client callbackClient = callbackHandler.getCallbackClient();
-
- ClientDelivery del = new ClientDelivery(message, id, deliveryId, ref.getDeliveryCount());
-
+
+ ClientDelivery del = new ClientDelivery(message, id, deliveryId, ref
+ .getDeliveryCount());
+
Callback callback = new Callback(del);
-
+
try
{
- //FIXME - due a design (flaw??) in the socket based transports, they use a pool of TCP
- // connections, so subsequent invocations can end up using different underlying
- // connections meaning that later invocations can overtake earlier invocations, if there
- // are more than one user concurrently invoking on the same transport. We need someway
- // of pinning the client object to the underlying invocation. For now we just serialize
- // all access so that only the first connection in the pool is ever used - bit this is
+ // FIXME - due a design (flaw??) in the socket based transports,
+ // they use a pool of TCP
+ // connections, so subsequent invocations can end up using different
+ // underlying
+ // connections meaning that later invocations can overtake earlier
+ // invocations, if there
+ // are more than one user concurrently invoking on the same
+ // transport. We need someway
+ // of pinning the client object to the underlying invocation. For
+ // now we just serialize
+ // all access so that only the first connection in the pool is ever
+ // used - bit this is
// far from ideal!!!
// See http://jira.jboss.com/jira/browse/JBMESSAGING-789
-
+
Object invoker = null;
if (callbackClient != null)
{
invoker = callbackClient.getInvoker();
- }
- else
+ } else
{
- // TODO: dummy synchronization object, in case there's no clientInvoker. This will
- // happen during the first invocation anyway. It's a kludge, I know, but this whole
+ // TODO: dummy synchronization object, in case there's no
+ // clientInvoker. This will
+ // happen during the first invocation anyway. It's a kludge, I
+ // know, but this whole
// synchronization thing is a huge kludge. Needs to be reviewed.
invoker = new Object();
}
@@ -278,20 +318,30 @@
synchronized (invoker)
{
// one way invocation, no acknowledgment sent back by the client
- if (trace) { log.trace(this + " submitting message " + message + " to the remoting layer to be sent asynchronously"); }
- callbackHandler.handleCallbackOneway(callback);
+ if (trace)
+ {
+ log
+ .trace(this
+ + " submitting message "
+ + message
+ + " to the remoting layer to be sent asynchronously");
+ }
+ callbackHandler.handleCallbackOneway(callback);
}
- }
- catch (HandleCallbackException e)
+ } catch (HandleCallbackException e)
{
- // it's an oneway callback, so exception could only have happened on the server, while
- // trying to send the callback. This is a good reason to smack the whole connection.
- // I trust remoting to have already done its own cleanup via a CallbackErrorHandler,
+ // it's an oneway callback, so exception could only have happened on
+ // the server, while
+ // trying to send the callback. This is a good reason to smack the
+ // whole connection.
+ // I trust remoting to have already done its own cleanup via a
+ // CallbackErrorHandler,
// I need to do my own cleanup at ConnectionManager level.
log.debug(this + " failed to handle callback", e);
- ServerConnectionEndpoint sce = sessionEndpoint.getConnectionEndpoint();
+ ServerConnectionEndpoint sce = sessionEndpoint
+ .getConnectionEndpoint();
ConnectionManager cm = sce.getServerPeer().getConnectionManager();
cm.handleClientFailure(sce.getRemotingClientSessionID(), false);
@@ -300,28 +350,33 @@
return null;
}
-
- return delivery;
+
+ return delivery;
}
- }
-
-
+ }
- // Filter implementation ------------------------------------------------------------------------
+ // Filter implementation
+ // ------------------------------------------------------------------------
public boolean accept(Message msg)
{
boolean accept = true;
-
+
if (destination.isQueue())
{
- // For subscriptions message selection is handled in the Subscription itself
+ // For subscriptions message selection is handled in the Subscription
+ // itself
// we do not want to do the check twice
if (messageSelector != null)
{
accept = messageSelector.accept(msg);
-
- if (trace) { log.trace("message selector " + (accept ? "accepts " : "DOES NOT accept ") + "the message"); }
+
+ if (trace)
+ {
+ log.trace("message selector "
+ + (accept ? "accepts " : "DOES NOT accept ")
+ + "the message");
+ }
}
}
@@ -329,257 +384,318 @@
{
if (noLocal)
{
- int conId = ((JBossMessage)msg).getConnectionID();
-
- if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }
-
- accept = conId != sessionEndpoint.getConnectionEndpoint().getConnectionID();
-
- if (trace) { log.trace("accepting? " + accept); }
+ int conId = ((JBossMessage) msg).getConnectionID();
+
+ if (trace)
+ {
+ log.trace("message connection id: "
+ + conId
+ + " current connection connection id: "
+ + sessionEndpoint.getConnectionEndpoint()
+ .getConnectionID());
+ }
+
+ accept = conId != sessionEndpoint.getConnectionEndpoint()
+ .getConnectionID();
+
+ if (trace)
+ {
+ log.trace("accepting? " + accept);
+ }
}
}
return accept;
}
+ // Closeable implementation
+ // ---------------------------------------------------------------------
- // Closeable implementation ---------------------------------------------------------------------
-
public void closing() throws JMSException
{
try
{
- if (trace) { log.trace(this + " closing"); }
-
- stop();
- }
- catch (Throwable t)
+ if (trace)
+ {
+ log.trace(this + " closing");
+ }
+
+ stop();
+ } catch (Throwable t)
{
throw ExceptionUtil.handleJMSInvocation(t, this + " closing");
- }
+ }
}
-
+
public void close() throws JMSException
- {
+ {
try
{
- if (trace) { log.trace(this + " close"); }
-
+ if (trace)
+ {
+ log.trace(this + " close");
+ }
+
localClose();
-
- sessionEndpoint.removeConsumer(id);
- }
- catch (Throwable t)
+
+ sessionEndpoint.removeConsumer(id);
+ } catch (Throwable t)
{
throw ExceptionUtil.handleJMSInvocation(t, this + " close");
}
}
-
- // ConsumerEndpoint implementation --------------------------------------------------------------
-
+
+ // ConsumerEndpoint implementation
+ // --------------------------------------------------------------
+
public void changeRate(float newRate) throws JMSException
{
- if (trace) { log.trace(this + " changing rate to " + newRate); }
-
+ if (trace)
+ {
+ log.trace(this + " changing rate to " + newRate);
+ }
+
try
- {
+ {
// For now we just support a binary on/off.
- // The client will send newRate = 0, to say it does not want any more messages when its
- // client side buffer gets full or it will send an arbitrary non zero number to say it
- // does want more messages, when its client side buffer empties to half its full size.
- // Note the client does not wait until the client side buffer is empty before sending a
+ // The client will send newRate = 0, to say it does not want any more
+ // messages when its
+ // client side buffer gets full or it will send an arbitrary non zero
+ // number to say it
+ // does want more messages, when its client side buffer empties to half
+ // its full size.
+ // Note the client does not wait until the client side buffer is empty
+ // before sending a
// newRate(+ve) message since this would add extra latency.
-
- // In the future we can fine tune this by allowing the client to specify an actual rate in
- // the newRate value so this is basically a placeholder for the future so we don't have to
+
+ // In the future we can fine tune this by allowing the client to
+ // specify an actual rate in
+ // the newRate value so this is basically a placeholder for the future
+ // so we don't have to
// change the wire format when we support it.
-
+
// No need to synchronize - clientAccepting is volatile.
-
- // Important note - this invocations can arrive in a different order to which they were
- // sent - this is inherent in one way invocations where a client side pool is used.
- // Therefore we just toggle the clientAccepting flag - if we actually looked at the newRate
+
+ // Important note - this invocations can arrive in a different order to
+ // which they were
+ // sent - this is inherent in one way invocations where a client side
+ // pool is used.
+ // Therefore we just toggle the clientAccepting flag - if we actually
+ // looked at the newRate
// value we might end up turning off the consumer when it should be on
// (since a off-on, arrives as on-off)
- // Toggling is safe, but when we start to look at the actual rate value we will
+ // Toggling is safe, but when we start to look at the actual rate value
+ // we will
// have to be a bit cleverer
-
+
clientAccepting = !clientAccepting;
-
+
if (clientAccepting)
{
promptDelivery();
- }
- }
- catch (Throwable t)
+ }
+ } catch (Throwable t)
{
throw ExceptionUtil.handleJMSInvocation(t, this + " changeRate");
}
}
-
-
-
+
/*
* This method is always called between closing() and close() being called
- * Instead of having a new method we could perhaps somehow pass the last delivery id
- * in with closing - then we don't need another message
+ * Instead of having a new method we could perhaps somehow pass the last
+ * delivery id in with closing - then we don't need another message
*/
public void cancelInflightMessages(long lastDeliveryId) throws JMSException
{
- if (trace) { log.trace(this + " cancelInflightMessages: " + lastDeliveryId); }
-
+ if (trace)
+ {
+ log.trace(this + " cancelInflightMessages: " + lastDeliveryId);
+ }
+
try
- {
- //Cancel all deliveries made by this consumer with delivery id > lastDeliveryId
-
- sessionEndpoint.cancelDeliveriesForConsumerAfterDeliveryId(id, lastDeliveryId);
- }
- catch (Throwable t)
{
- throw ExceptionUtil.handleJMSInvocation(t, this + " cancelInflightMessages");
- }
+ // Cancel all deliveries made by this consumer with delivery id >
+ // lastDeliveryId
+
+ sessionEndpoint.cancelDeliveriesForConsumerAfterDeliveryId(id,
+ lastDeliveryId);
+ } catch (Throwable t)
+ {
+ throw ExceptionUtil.handleJMSInvocation(t, this
+ + " cancelInflightMessages");
+ }
}
-
- // Public ---------------------------------------------------------------------------------------
-
+
+ // Public
+ // ---------------------------------------------------------------------------------------
+
public String toString()
{
return "ConsumerEndpoint[" + id + "]";
}
-
+
public JBossDestination getDestination()
{
return destination;
}
-
+
public ServerSessionEndpoint getSessionEndpoint()
{
return sessionEndpoint;
}
-
- // Package protected ----------------------------------------------------------------------------
-
+
+ // Package protected
+ // ----------------------------------------------------------------------------
+
Queue getDLQ()
{
return dlq;
}
-
+
Queue getExpiryQueue()
{
return expiryQueue;
}
-
+
long getRedliveryDelay()
{
return redeliveryDelay;
}
-
+
void localClose() throws Throwable
- {
- if (trace) { log.trace(this + " grabbed the main lock in close() " + this); }
+ {
+ if (trace)
+ {
+ log.trace(this + " grabbed the main lock in close() " + this);
+ }
- messageQueue.remove(this);
-
+ messageQueue.remove(this);
+
Dispatcher.instance.unregisterTarget(id, this);
-
- // If this is a consumer of a non durable subscription then we want to unbind the
+
+ // If this is a consumer of a non durable subscription then we want to
+ // unbind the
// subscription and delete all its data.
if (destination.isTopic())
{
- PostOffice postOffice =
- sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
-
+ PostOffice postOffice = sessionEndpoint.getConnectionEndpoint()
+ .getServerPeer().getPostOfficeInstance();
+
Binding binding = postOffice.getBindingForQueueName(queueName);
- //Note binding can be null since there can many competing subscribers for the subscription -
- //in which case the first will have removed the subscription and subsequently
- //ones won't find it
-
+ // Note binding can be null since there can many competing subscribers
+ // for the subscription -
+ // in which case the first will have removed the subscription and
+ // subsequently
+ // ones won't find it
+
if (binding != null && !binding.getQueue().isRecoverable())
{
- postOffice.unbindQueue(queueName);
-
- String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
-
- MessageCounter counter =
- sessionEndpoint.getConnectionEndpoint().getServerPeer().getMessageCounterManager().unregisterMessageCounter(counterName);
-
+ Queue queue = binding.getQueue();
+ if (!queue.isClustered())
+ {
+ postOffice.unbindQueue(queue.getName());
+ } else
+ {
+ ((ClusteredPostOffice) postOffice).unbindClusteredQueue(queue
+ .getName());
+ }
+
+ String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX
+ + queueName;
+
+ MessageCounter counter = sessionEndpoint.getConnectionEndpoint()
+ .getServerPeer().getMessageCounterManager()
+ .unregisterMessageCounter(counterName);
+
if (counter == null)
{
- throw new IllegalStateException("Cannot find counter to remove " + counterName);
+ throw new IllegalStateException("Cannot find counter to remove "
+ + counterName);
}
}
}
-
- }
-
+
+ }
+
void start()
- {
+ {
synchronized (startStopLock)
- {
+ {
if (started)
{
return;
}
-
+
started = true;
}
-
+
// Prompt delivery
promptDelivery();
}
-
+
void stop() throws Throwable
- {
+ {
synchronized (startStopLock)
- {
+ {
if (!started)
{
return;
}
-
- started = false;
- // Any message deliveries already transit to the consumer, will just be ignored by the
+ started = false;
+
+ // Any message deliveries already transit to the consumer, will just be
+ // ignored by the
// MessageCallbackHandler since it will be closed.
//
// To clarify, the close protocol (from connection) is as follows:
//
- // 1) MessageCallbackHandler::close() - any messages in buffer are cancelled to the server
- // session, and any subsequent receive messages will be ignored.
+ // 1) MessageCallbackHandler::close() - any messages in buffer are
+ // cancelled to the server
+ // session, and any subsequent receive messages will be ignored.
//
- // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any deliveries yet to
- // deliver to the client callback handler.
+ // 2) ServerConsumerEndpoint::closing() causes stop() this flushes any
+ // deliveries yet to
+ // deliver to the client callback handler.
//
- // 3) MessageCallbackHandler::cancelInflightMessages(long lastDeliveryId) - any deliveries
- // after lastDeliveryId for the consumer will be considered in flight and cancelled.
+ // 3) MessageCallbackHandler::cancelInflightMessages(long
+ // lastDeliveryId) - any deliveries
+ // after lastDeliveryId for the consumer will be considered in flight
+ // and cancelled.
//
// 4) ServerConsumerEndpoint:close() - endpoint is deregistered.
//
- // 5) Session.close() - acks or cancels any remaining deliveries in the SessionState as
- // appropriate.
+ // 5) Session.close() - acks or cancels any remaining deliveries in the
+ // SessionState as
+ // appropriate.
//
- // 6) ServerSessionEndpoint::close() - cancels any remaining deliveries and deregisters
- // session.
+ // 6) ServerSessionEndpoint::close() - cancels any remaining deliveries
+ // and deregisters
+ // session.
//
// 7) Client side session executor is shutdown.
//
// 8) ServerConnectionEndpoint::close() - connection is deregistered.
//
- // 9) Remoting connection listener is removed and remoting connection stopped.
+ // 9) Remoting connection listener is removed and remoting connection
+ // stopped.
}
}
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
+
+ // Protected
+ // ------------------------------------------------------------------------------------
+
+ // Private
+ // --------------------------------------------------------------------------------------
+
private void promptDelivery()
{
- messageQueue.deliver();
+ sessionEndpoint.promptDelivery(messageQueue);
}
-
- // Inner classes --------------------------------------------------------------------------------
-
+
+ // Inner classes
+ // --------------------------------------------------------------------------------
+
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -82,6 +82,7 @@
import org.jboss.util.id.GUID;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
/**
@@ -153,6 +154,8 @@
private SynchronizedLong deliveryIdSequence;
+ //Temporary until we have our own NIO transport
+ QueuedExecutor executor = new QueuedExecutor();
// Constructors ---------------------------------------------------------------------------------
@@ -192,23 +195,22 @@
String selector,
boolean noLocal,
String subscriptionName,
- boolean isCC,
- long failoverChannelID) throws JMSException
+ boolean isCC) throws JMSException
{
try
{
- if (!connectionEndpoint.isFailoverConnection())
- {
+// if (!connectionEndpoint.isFailoverConnection())
+// {
// regular consumer
return createConsumerDelegateInternal(jmsDestination, selector,
noLocal, subscriptionName);
- }
+ // }
- // we're child of a failover connection. Favor failover channels when creating new
- // consumers
- return createFailoverConsumerDelegateInternal(jmsDestination, selector,
- noLocal, subscriptionName,
- failoverChannelID);
+// // we're child of a failover connection. Favor failover channels when creating new
+// // consumers
+// return createFailoverConsumerDelegateInternal(jmsDestination, selector,
+// noLocal, subscriptionName,
+// failoverChannelID);
}
catch (Throwable t)
{
@@ -217,20 +219,20 @@
}
public BrowserDelegate createBrowserDelegate(JBossDestination jmsDestination,
- String selector, long failoverChannelID)
+ String selector)
throws JMSException
{
try
{
- if (!connectionEndpoint.isFailoverConnection())
- {
+// if (!connectionEndpoint.isFailoverConnection())
+// {
// regular browser
return createBrowserDelegateInternal(jmsDestination, selector);
- }
-
- // we're child of a failover connection. Favor failover channels when creating new
- // browsers
- return createFailoverBrowserDelegateInternal(jmsDestination, selector, failoverChannelID);
+// }
+//
+// // we're child of a failover connection. Favor failover channels when creating new
+// // browsers
+// return createFailoverBrowserDelegateInternal(jmsDestination, selector, failoverChannelID);
}
catch (Throwable t)
{
@@ -360,7 +362,7 @@
Delivery del = cancelDeliveryInternal(cancel);
//Prompt delivery
- ((Channel)del.getObserver()).deliver();
+ promptDelivery((Channel)del.getObserver());
}
catch (Throwable t)
{
@@ -419,15 +421,15 @@
{
DeliveryRecovery deliveryInfo = (DeliveryRecovery)iter.next();
- Long channelId = new Long(deliveryInfo.getChannelID());
+ String queueName = deliveryInfo.getQueueName();
+
+ List acks = (List)ackMap.get(queueName);
- List acks = (List)ackMap.get(channelId);
-
if (acks == null)
{
acks = new ArrayList();
- ackMap.put(channelId, acks);
+ ackMap.put(queueName, acks);
}
acks.add(deliveryInfo);
@@ -439,14 +441,14 @@
{
Map.Entry entry = (Map.Entry)iter.next();
- Long channelId = (Long)entry.getKey();
+ String queueName = (String)entry.getKey();
//Look up channel
- Binding binding = postOffice.getBindingforChannelId(channelId.longValue());
+ Binding binding = postOffice.getBindingForQueueName(queueName);
if (binding == null)
{
- throw new IllegalStateException("Cannot find channel with id: " + channelId);
+ throw new IllegalStateException("Cannot find channel with queue name: " + queueName);
}
List acks = (List)entry.getValue();
@@ -550,19 +552,9 @@
{
Queue coreQueue;
- if (postOffice.isLocal())
- {
- coreQueue = new PagingFilteredQueue(dest.getName(),
- idm.getID(), ms, pm, true, false,
- -1, null, fullSize, pageSize, downCacheSize);
- }
- else
- {
- // uniformly handle the temporary queue as LocalClusteredQueue
- coreQueue = new LocalClusteredQueue((ClusteredPostOffice)postOffice, nodeId, dest.getName(),
- idm.getID(), ms, pm, true, false,
- -1, null, tr, fullSize, pageSize, downCacheSize);
- }
+ coreQueue = new PagingFilteredQueue(dest.getName(),
+ idm.getID(), ms, pm, true, false,
+ -1, null, fullSize, pageSize, downCacheSize);
String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
@@ -978,6 +970,24 @@
}
}
}
+
+ void promptDelivery(final Channel channel)
+ {
+ try
+ {
+ //Prompting delivery must be asynchronous to avoid deadlock
+ //but we cannot use one way invocations on cancelDelivery and
+ //cancelDeliveries because remoting one way invocations can
+ //overtake each other in flight - this problem will
+ //go away when we have our own transport and our dedicated connection
+ this.executor.execute(new Runnable() { public void run() { channel.deliver(); } } );
+ }
+ catch (Throwable t)
+ {
+ log.error("Failed to prompt delivery", t);
+ }
+ }
+
// Protected ------------------------------------------------------------------------------------
@@ -1121,7 +1131,7 @@
//TODO - are we sure this is the right place to prompt delivery?
if (queue != null)
{
- queue.deliver();
+ promptDelivery(queue);
}
}
@@ -1143,116 +1153,6 @@
if (trace) { log.trace(this + " acknowledged delivery " + ack); }
}
- /**
- * @param oldChannelID - old channel ID. It may be null when creating consumer subsequently to
- * the actual failover, so it's our responsibility to look the proper channel.
- * @return
- * @throws Exception
- */
- private ConsumerDelegate createFailoverConsumerDelegateInternal(JBossDestination jmsDestination,
- String selectorString,
- boolean noLocal,
- String subscriptionName,
- long oldChannelID)
- throws Exception
- {
- log.debug(this + " creating FAILOVER consumer for failed channel " +
- oldChannelID + " for " + jmsDestination +
- (selectorString == null ? "" : ", selector '" + selectorString + "'") +
- (subscriptionName == null ? "" : ", subscription '" + subscriptionName + "'") +
- (noLocal ? ", noLocal" : ""));
-
- // fail over channel
- if (postOffice.isLocal())
- {
- throw new IllegalStateException("Cannot failover on a non-clustered post office!");
- }
-
- Binding binding = null;
-
- if (oldChannelID != -1)
- {
- binding = postOffice.getBindingforChannelId(oldChannelID);
- }
- else
- {
- // locate the binding based on destination name and the failed node ID
- Collection c = postOffice.
- getBindingsForCondition(new JMSCondition(true, jmsDestination.getName()));
-
- for(Iterator i = c.iterator(); i.hasNext(); )
- {
- Binding b = (Binding)i.next();
- if (connectionEndpoint.getFailedNodeID().equals(b.getFailedNodeID()))
- {
- binding = b;
- break;
- }
- }
- }
-
- if (binding == null)
- {
- throw new IllegalStateException("Can't find failed over " +
- (oldChannelID != -1 ?
- "channel " + oldChannelID : "queue " + jmsDestination.getName()));
- }
-
- Queue newQueue = binding.getQueue();
- long newChannelID = newQueue.getChannelID();
-
- int consumerID = connectionEndpoint.getServerPeer().getNextObjectID();
- int prefetchSize = connectionEndpoint.getPrefetchSize();
-
- ManagedDestination dest = sp.getDestinationManager().
- getDestination(jmsDestination.getName(), jmsDestination.isQueue());
-
- if (dest == null)
- {
- throw new IllegalStateException("Cannot find managed destination for " + jmsDestination);
- }
-
- Queue dlqToUse =
- dest.getDLQ() == null ? defaultDLQ : dest.getDLQ();
-
- Queue expiryQueueToUse =
- dest.getExpiryQueue() == null ? defaultExpiryQueue : dest.getExpiryQueue();
-
- long redeliveryDelay = dest.getRedeliveryDelay();
-
- if (redeliveryDelay == 0)
- {
- redeliveryDelay = sp.getDefaultRedeliveryDelay();
- }
-
- ServerConsumerEndpoint ep =
-
- new ServerConsumerEndpoint(consumerID, binding.getQueue(),
- binding.getQueue().getName(), this, selectorString, noLocal,
- jmsDestination, dlqToUse, expiryQueueToUse, redeliveryDelay);
-
- ConsumerAdvised advised;
-
- // Need to synchronized to prevent a deadlock
- // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
- synchronized (AspectManager.instance())
- {
- advised = new ConsumerAdvised(ep);
- }
-
- Dispatcher.instance.registerTarget(consumerID, advised);
-
- ClientConsumerDelegate stub =
- new ClientConsumerDelegate(consumerID, newChannelID, prefetchSize, maxDeliveryAttempts);
-
- synchronized (consumers)
- {
- consumers.put(new Integer(consumerID), ep);
- }
-
- return stub;
- }
-
private ConsumerDelegate createConsumerDelegateInternal(JBossDestination jmsDestination,
String selectorString,
boolean noLocal,
@@ -1321,7 +1221,7 @@
PagingFilteredQueue q;
- if (postOffice.isLocal())
+ if (postOffice.isLocal() || !mDest.isClustered())
{
q = new PagingFilteredQueue(new GUID().toString(), idm.getID(), ms, pm, true, false,
mDest.getMaxSize(), selector,
@@ -1341,15 +1241,8 @@
mDest.getDownCacheSize());
ClusteredPostOffice cpo = (ClusteredPostOffice)postOffice;
-
- if (mDest.isClustered())
- {
- binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
- }
- else
- {
- binding = cpo.bindQueue(topicCond, q);
- }
+
+ binding = cpo.bindClusteredQueue(topicCond, (LocalClusteredQueue)q);
}
String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + q.getName();
@@ -1565,7 +1458,7 @@
Dispatcher.instance.registerTarget(consumerID, advised);
ClientConsumerDelegate stub =
- new ClientConsumerDelegate(consumerID, binding.getQueue().getChannelID(),
+ new ClientConsumerDelegate(consumerID,
prefetchSize, maxDeliveryAttempts);
synchronized (consumers)
@@ -1578,73 +1471,6 @@
return stub;
}
- private BrowserDelegate createFailoverBrowserDelegateInternal(JBossDestination jmsDestination,
- String selector,
- long oldChannelID) throws Throwable
- {
- log.debug(this + " creating FAILOVER browser for failed channel " + oldChannelID + " for " +
- jmsDestination + (selector == null ? "" : ", selector '" + selector + "'"));
-
- if (postOffice.isLocal())
- {
- throw new IllegalStateException("Cannot failover on a non-clustered post office!");
- }
-
- Binding binding = null;
-
- if (oldChannelID != -1)
- {
- binding = postOffice.getBindingforChannelId(oldChannelID);
- }
- else
- {
- // locate the binding based on destination name and the failed node ID
- Collection c = postOffice.
- getBindingsForCondition(new JMSCondition(true, jmsDestination.getName()));
-
- for(Iterator i = c.iterator(); i.hasNext(); )
- {
- Binding b = (Binding)i.next();
- if (connectionEndpoint.getFailedNodeID().equals(b.getFailedNodeID()))
- {
- binding = b;
- break;
- }
- }
- }
-
- if (binding == null)
- {
- throw new IllegalStateException("Can't find failed over " +
- (oldChannelID != -1 ?
- "channel " + oldChannelID : "queue " + jmsDestination.getName()));
- }
-
- Channel newChannel = binding.getQueue();
-
- int browserID = connectionEndpoint.getServerPeer().getNextObjectID();
-
- ServerBrowserEndpoint ep = new ServerBrowserEndpoint(this, browserID, newChannel, selector);
-
- BrowserAdvised advised;
-
- // Need to synchronized to prevent a deadlock
- // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
- synchronized (AspectManager.instance())
- {
- advised = new BrowserAdvised(ep);
- }
-
- Dispatcher.instance.registerTarget(browserID, advised);
-
- // still need to synchronized since close() can come in on a different thread
- synchronized (browsers)
- {
- browsers.put(new Integer(browserID), ep);
- }
- return new ClientBrowserDelegate(browserID, newChannel.getChannelID());
- }
-
private BrowserDelegate createBrowserDelegateInternal(JBossDestination jmsDestination,
String selector) throws Throwable
{
@@ -1696,8 +1522,7 @@
Dispatcher.instance.registerTarget(browserID, advised);
- ClientBrowserDelegate stub =
- new ClientBrowserDelegate(browserID, binding.getQueue().getChannelID());
+ ClientBrowserDelegate stub = new ClientBrowserDelegate(browserID);
log.debug(this + " created and registered " + ep);
@@ -1713,7 +1538,7 @@
{
DeliveryObserver observer = (DeliveryObserver)iter.next();
- ((Channel)observer).deliver();
+ promptDelivery((Channel)observer);
}
}
Modified: trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/SessionEndpoint.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -51,15 +51,13 @@
*/
ConsumerDelegate createConsumerDelegate(JBossDestination destination, String selector,
boolean noLocal, String subscriptionName,
- boolean connectionConsumer,
- long failoverChannelID) throws JMSException;
+ boolean connectionConsumer) throws JMSException;
/**
* @param failoverChannelID - the ID of the channel for which there is a failover process in
* progress. -1 means regular (non-failover) browser delegate creation.
*/
- BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector,
- long failoverChannelID) throws JMSException;
+ BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector) throws JMSException;
/**
* Creates a queue identity given a Queue name. Does NOT create the physical queue. The physical
Modified: trunk/src/main/org/jboss/jms/server/endpoint/advised/SessionAdvised.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/advised/SessionAdvised.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/server/endpoint/advised/SessionAdvised.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -82,17 +82,15 @@
public ConsumerDelegate createConsumerDelegate(JBossDestination destination, String selector,
boolean noLocal, String subscriptionName,
- boolean connectionConsumer,
- long failoverChannelID) throws JMSException
+ boolean connectionConsumer) throws JMSException
{
return endpoint.createConsumerDelegate(destination, selector, noLocal, subscriptionName,
- connectionConsumer, failoverChannelID);
+ connectionConsumer);
}
- public BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector,
- long failoverChannelID) throws JMSException
+ public BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector) throws JMSException
{
- return endpoint.createBrowserDelegate(queue, messageSelector, failoverChannelID);
+ return endpoint.createBrowserDelegate(queue, messageSelector);
}
public JBossQueue createQueue(String queueName) throws JMSException
Modified: trunk/src/main/org/jboss/jms/wireformat/ConnectionStartRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/ConnectionStartRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/wireformat/ConnectionStartRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -25,7 +25,10 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.ConnectionEndpoint;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
/**
@@ -76,6 +79,17 @@
os.flush();
}
+
+ public Object getPayload()
+ {
+ OnewayInvocation oi = new OnewayInvocation(this);
+ InvocationRequest request =
+ new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,
+ oi, ONE_WAY_METADATA, null, null);
+
+ return request;
+ }
+
}
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveriesRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -28,9 +28,12 @@
import java.util.Iterator;
import java.util.List;
+import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.Cancel;
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.SessionEndpoint;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
/**
*
@@ -121,6 +124,6 @@
os.flush();
}
-
+
}
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCancelDeliveryRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -25,9 +25,12 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.server.endpoint.Cancel;
import org.jboss.jms.server.endpoint.DefaultCancel;
import org.jboss.jms.server.endpoint.SessionEndpoint;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
/**
*
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCreateBrowserDelegateRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCreateBrowserDelegateRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCreateBrowserDelegateRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -44,8 +44,7 @@
{
private JBossDestination dest;
private String selector;
- private long failoverChannelID;
-
+
public SessionCreateBrowserDelegateRequest()
{
}
@@ -53,14 +52,12 @@
public SessionCreateBrowserDelegateRequest(int objectId,
byte version,
JBossDestination destination,
- String selector,
- long failoverChannelID)
+ String selector)
{
super(objectId, PacketSupport.REQ_SESSION_CREATEBROWSERDELEGATE, version);
this.dest = destination;
this.selector = selector;
- this.failoverChannelID = failoverChannelID;
}
public void read(DataInputStream is) throws Exception
@@ -70,8 +67,6 @@
dest = JBossDestination.readDestination(is);
selector = readNullableString(is);
-
- failoverChannelID = is.readLong();
}
public ResponseSupport serverInvoke() throws Exception
@@ -84,7 +79,7 @@
throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
}
- return new SessionCreateBrowserDelegateResponse((ClientBrowserDelegate)endpoint.createBrowserDelegate(dest, selector, failoverChannelID));
+ return new SessionCreateBrowserDelegateResponse((ClientBrowserDelegate)endpoint.createBrowserDelegate(dest, selector));
}
public void write(DataOutputStream os) throws Exception
@@ -95,8 +90,6 @@
writeNullableString(selector, os);
- os.writeLong(failoverChannelID);
-
os.flush();
}
Modified: trunk/src/main/org/jboss/jms/wireformat/SessionCreateConsumerDelegateRequest.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/SessionCreateConsumerDelegateRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/jms/wireformat/SessionCreateConsumerDelegateRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -47,8 +47,7 @@
private boolean noLocal;
private String subName;
private boolean connectionConsumer;
- private long failoverChannelID;
-
+
public SessionCreateConsumerDelegateRequest()
{
}
@@ -57,8 +56,7 @@
byte version,
JBossDestination destination,
String selector, boolean noLocal,
- String subName, boolean connectionConsumer,
- long failoverChannelID)
+ String subName, boolean connectionConsumer)
{
super(objectId, PacketSupport.REQ_SESSION_CREATECONSUMERDELEGATE, version);
@@ -67,7 +65,6 @@
this.noLocal = noLocal;
this.subName = subName;
this.connectionConsumer = connectionConsumer;
- this.failoverChannelID = failoverChannelID;
}
public void read(DataInputStream is) throws Exception
@@ -83,8 +80,6 @@
subName = readNullableString(is);
connectionConsumer = is.readBoolean();
-
- failoverChannelID = is.readLong();
}
public ResponseSupport serverInvoke() throws Exception
@@ -97,7 +92,7 @@
throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
}
- return new SessionCreateConsumerDelegateResponse((ClientConsumerDelegate)endpoint.createConsumerDelegate(dest, selector, noLocal, subName, connectionConsumer, failoverChannelID));
+ return new SessionCreateConsumerDelegateResponse((ClientConsumerDelegate)endpoint.createConsumerDelegate(dest, selector, noLocal, subName, connectionConsumer));
}
public void write(DataOutputStream os) throws Exception
@@ -114,8 +109,6 @@
os.writeBoolean(connectionConsumer);
- os.writeLong(failoverChannelID);
-
os.flush();
}
Modified: trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/PagingChannelSupport.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -227,37 +227,18 @@
unload();
//Load the unpaged references
- InitialLoadInfo ili = pm.getInitialReferenceInfos(channelID, fullSize);
+ InitialLoadInfo ili = pm.loadFromStart(channelID, fullSize);
- if (ili.getMaxPageOrdering() != null)
- {
- firstPagingOrder = ili.getMinPageOrdering().longValue();
-
- nextPagingOrder = ili.getMaxPageOrdering().longValue() + 1;
-
- paging = true;
- }
- else
- {
- firstPagingOrder = nextPagingOrder = 0;
- }
+ doLoad(ili);
- Map refMap = processReferences(ili.getRefInfos());
-
- Iterator iter = ili.getRefInfos().iterator();
- while (iter.hasNext())
- {
- ReferenceInfo info = (ReferenceInfo)iter.next();
-
- addFromRefInfo(info, refMap);
- }
-
//Maybe we need to load some paged refs
while (checkLoad()) {}
}
}
+
+
public void unload() throws Exception
{
@@ -290,7 +271,7 @@
// Protected ------------------------------------------------------------------------------------
- protected void loadPagedReferences(long number) throws Exception
+ protected void loadPagedReferences(int number) throws Exception
{
if (trace) { log.trace(this + " Loading " + number + " paged references from storage"); }
@@ -395,7 +376,7 @@
if (refNum > 0)
{
- long numberLoadable = Math.min(refNum, pageSize);
+ int numberLoadable = (int)Math.min(refNum, pageSize);
if (messageRefs.size() <= fullSize - numberLoadable)
{
@@ -535,10 +516,40 @@
if (trace) { log.trace(this + " cleared downcache"); }
}
+
+
+
+ protected void doLoad(InitialLoadInfo ili) throws Exception
+ {
+ if (ili.getMaxPageOrdering() != null)
+ {
+ firstPagingOrder = ili.getMinPageOrdering().longValue();
+
+ nextPagingOrder = ili.getMaxPageOrdering().longValue() + 1;
+
+ paging = true;
+ }
+ else
+ {
+ firstPagingOrder = nextPagingOrder = 0;
+
+ paging = false;
+ }
+
+ Map refMap = processReferences(ili.getRefInfos());
+
+ Iterator iter = ili.getRefInfos().iterator();
+ while (iter.hasNext())
+ {
+ ReferenceInfo info = (ReferenceInfo)iter.next();
+
+ addFromRefInfo(info, refMap);
+ }
+ }
// Private --------------------------------------------------------------------------------------
- private MessageReference addFromRefInfo(ReferenceInfo info, Map refMap)
+ protected MessageReference addFromRefInfo(ReferenceInfo info, Map refMap)
{
long msgId = info.getMessageId();
@@ -559,7 +570,8 @@
return ref;
}
- private Map processReferences(List refInfos) throws Exception
+
+ protected Map processReferences(List refInfos) throws Exception
{
Map refMap = new HashMap(refInfos.size());
@@ -620,5 +632,6 @@
}
return refMap;
- }
+ }
+
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -962,9 +962,7 @@
Connection conn = null;
PreparedStatement ps = null;
TransactionWrapper wrap = new TransactionWrapper();
-
- final int MAX_TRIES = 25;
-
+
try
{
conn = ds.getConnection();
@@ -977,48 +975,152 @@
ps.setLong(3, channelID);
- int tries = 0;
-
- while (true)
+ int rows = updateWithRetry(ps);
+
+ if (trace) { log.trace(JDBCUtil.statementToString(getSQLStatement("UPDATE_REFS_NOT_PAGED"), new Long(channelID),
+ new Long(orderStart), new Long(orderEnd)) + " updated " + rows + " rows"); }
+
+ //Sanity check
+ if (rows != num)
{
+ throw new IllegalStateException("Did not update correct number of rows");
+ }
+ }
+ catch (Exception e)
+ {
+ wrap.exceptionOccurred();
+ throw e;
+ }
+ finally
+ {
+ if (ps != null)
+ {
try
{
- int rows = updateWithRetry(ps);
-
- if (trace) { log.trace(JDBCUtil.statementToString(getSQLStatement("UPDATE_REFS_NOT_PAGED"), new Long(channelID),
- new Long(orderStart), new Long(orderEnd)) + " updated " + rows + " rows"); }
- if (tries > 0)
- {
- log.warn("Update worked after retry");
- }
-
- //Sanity check
- if (rows != num)
- {
- throw new IllegalStateException("Did not update correct number of rows");
- }
-
- break;
+ ps.close();
}
- catch (SQLException e)
+ catch (Throwable e)
{
- log.warn("SQLException caught - assuming deadlock detected, try:" + (tries + 1), e);
-
- tries++;
-
- if (tries == MAX_TRIES)
+ }
+ }
+ if (conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ wrap.end();
+ }
+ }
+
+ public InitialLoadInfo mergeAndLoad(long fromChannelID, long toChannelID, int fullSize) throws Exception
+ {
+ if (trace) { log.trace("Merging channel from " + fromChannelID + " to " + toChannelID); }
+
+ Connection conn = null;
+ PreparedStatement ps = null;
+ ResultSet rs = null;
+ TransactionWrapper wrap = new TransactionWrapper();
+ PreparedStatement ps2 = null;
+
+ try
+ {
+ conn = ds.getConnection();
+
+ // First swap the channel id
+
+ ps = conn.prepareStatement(getSQLStatement("UPDATE_CHANNEL_ID"));
+
+ ps.setLong(1, toChannelID);
+
+ ps.setLong(2, fromChannelID);
+
+ int rows = updateWithRetry(ps);
+
+ if (trace) { log.trace("Update channel id updated " + rows + " rows"); }
+
+ //Now set any pages refs to not paged
+
+ ps = conn.prepareStatement(getSQLStatement("UPDATE_REFS_NOT_PAGED"));
+
+ ps.setLong(1, 0);
+
+ ps.setLong(2, Integer.MAX_VALUE);
+
+ ps.setLong(3, toChannelID);
+
+ rows = updateWithRetry(ps);
+
+ if (trace) { log.trace(" Set paged refs updated " + rows + " rows"); }
+
+ //Now load the refs
+
+ ps = conn.prepareStatement(getSQLStatement("LOAD_UNPAGED_REFS"));
+
+ ps.setLong(1, toChannelID);
+
+ rs = ps.executeQuery();
+
+ List refs = new ArrayList();
+
+ int count = 0;
+ int pageOrd = 0;
+
+ boolean arePaged = false;
+
+ while (rs.next())
+ {
+ long msgId = rs.getLong(1);
+ int deliveryCount = rs.getInt(2);
+ long sched = rs.getLong(3);
+
+ ReferenceInfo ri = new ReferenceInfo(msgId, deliveryCount, sched);
+
+ if (count < fullSize)
+ {
+ refs.add(ri);
+ }
+ else
+ {
+ //These ones need to be made paged
+
+ if (ps2 == null)
{
- log.error("Retried " + tries + " times, now giving up");
+ ps2 = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
+
+ ps2.setLong(1, pageOrd);
- throw new IllegalStateException("Failed to update references");
+ ps2.setLong(2, msgId);
+
+ ps2.setLong(3, toChannelID);
+
+ rows = updateWithRetry(ps2);
+
+ if (trace) { log.trace("Update page ord updated " + rows + " rows"); }
+
+ pageOrd++;
+
+ arePaged = true;
+
}
-
- log.warn("Trying again after a pause");
-
- //Now we wait for a random amount of time to minimise risk of deadlock occurring again
- Thread.sleep((long)(Math.random() * 500));
- }
+ }
+
+ count++;
}
+
+ if (arePaged)
+ {
+ return new InitialLoadInfo(new Long(0), new Long(pageOrd - 1), refs);
+ }
+ else
+ {
+ return new InitialLoadInfo(null, null, refs);
+ }
+
}
catch (Exception e)
{
@@ -1037,6 +1139,16 @@
{
}
}
+ if (ps2 != null)
+ {
+ try
+ {
+ ps2.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
if (conn != null)
{
try
@@ -1141,7 +1253,7 @@
}
}
- public List getPagedReferenceInfos(long channelID, long orderStart, long number) throws Exception
+ public List getPagedReferenceInfos(long channelID, long orderStart, int number) throws Exception
{
if (trace) { log.trace("loading message reference info for channel " + channelID + " from " + orderStart + " number " + number); }
@@ -1240,12 +1352,10 @@
/*
* Load the initial, non paged refs
*/
- public InitialLoadInfo getInitialReferenceInfos(long channelID, int fullSize) throws Exception
+ public InitialLoadInfo loadFromStart(long channelID, int number) throws Exception
{
if (trace) { log.trace("loading initial reference infos for channel " + channelID); }
- List refs = new ArrayList();
-
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
@@ -1277,12 +1387,9 @@
{
maxOrdering = null;
}
+ conn.close();
- //For unpaged refs we must make sure we only load refs with state='C' - i.e.
- //they're not part of an XA transactions.
- //Otherwise we could end up loading message that hadn't be committed
- //or end up loading refs which are due to be acked by a transaction that's yet
- //to be recovered.
+ conn = ds.getConnection();
ps = conn.prepareStatement(getSQLStatement("LOAD_UNPAGED_REFS"));
@@ -1290,6 +1397,8 @@
rs = ps.executeQuery();
+ List refs = new ArrayList();
+
int count = 0;
while (rs.next())
{
@@ -1299,7 +1408,7 @@
ReferenceInfo ri = new ReferenceInfo(msgId, deliveryCount, sched);
- if (count < fullSize)
+ if (count < number)
{
refs.add(ri);
}
@@ -1309,10 +1418,10 @@
//No refs paged
- if (count > fullSize)
+ if (count > number)
{
throw new IllegalStateException("Cannot load channel " + channelID + " since the fullSize parameter is too small to load " +
- " all the required references, fullSize needs to be at least " + count + " it is currently " + fullSize);
+ " all the required references, fullSize needs to be at least " + count + " it is currently " + number);
}
return new InitialLoadInfo(minOrdering, maxOrdering, refs);
@@ -1359,7 +1468,6 @@
}
-
// End of paging functionality
// ===========================
@@ -3304,6 +3412,7 @@
map.put("SELECT_EXISTS_REF", "SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?");
map.put("SELECT_EXISTS_REF_MESSAGE_ID", "SELECT MESSAGE_ID FROM JBM_MSG_REF WHERE MESSAGE_ID = ?");
map.put("UPDATE_DELIVERY_COUNT", "UPDATE JBM_MSG_REF SET DELIVERY_COUNT = ? WHERE CHANNEL_ID = ? AND MESSAGE_ID = ?");
+ map.put("UPDATE_CHANNEL_ID", "UPDATE JBM_MSG_REF SET CHANNEL_ID = ? WHERE CHANNEL_ID = ?");
//Message
map.put("LOAD_MESSAGES",
"SELECT MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP, " +
@@ -3524,13 +3633,17 @@
private synchronized long getOrdering()
{
//We generate the ordering for the message reference by taking the lowest 48 bits of the current time and
- //concetaning with a 15 bit rotating counter to form a string of 63 bits which we then place
+ //concatenating with a 15 bit rotating counter to form a string of 63 bits which we then place
//in the right most bits of a long, giving a positive signed 63 bit integer.
+ //Having a time element in the ordering means we don't have to maintain a counter in the database
+ //It also helps with failover since if two queues merge after failover then, the ordering will mean
+ //their orderings interleave nicely and they still get consumed in pretty much time order
+
//We only have to guarantee ordering per session, so having slight differences of time on different nodes is
//not a problem
- //This is good for about 8919 years - if you're still running JBoss Messaging then, I suggest you need an
+ //The time element is good for about 8919 years - if you're still running JBoss Messaging then, I suggest you need an
//upgrade!
long order = System.currentTimeMillis();
Modified: trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -65,11 +65,13 @@
void updatePageOrder(long channelID, List references) throws Exception;
void updateReferencesNotPagedInRange(long channelID, long orderStart, long orderEnd, long num) throws Exception;
-
- List getPagedReferenceInfos(long channelID, long orderStart, long number) throws Exception;
- InitialLoadInfo getInitialReferenceInfos(long channelID, int fullSize) throws Exception;
-
+ List getPagedReferenceInfos(long channelID, long orderStart, int number) throws Exception;
+
+ InitialLoadInfo loadFromStart(long channelID, int fullSize) throws Exception;
+
+ InitialLoadInfo mergeAndLoad(long fromChannelID, long toChannelID, int fullSize) throws Exception;
+
List getMessages(List messageIds) throws Exception;
//Counter related functionality - TODO we should split this out into its own interface
@@ -143,6 +145,7 @@
return scheduledDelivery;
}
}
+
class InitialLoadInfo
{
private Long minPageOrdering;
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/Binding.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -40,11 +40,4 @@
Condition getCondition();
Queue getQueue();
-
- boolean isFailed();
-
- void setFailed(boolean failed);
-
- Integer getFailedNodeID();
-
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultBinding.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -23,7 +23,6 @@
import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.plugin.contract.Condition;
-import org.jboss.messaging.core.plugin.postoffice.cluster.FailedOverQueue;
/**
*
@@ -51,8 +50,6 @@
private Queue queue;
- private boolean failed;
-
// this only works if we keep DefautlBinding immutable
private String toString;
@@ -62,12 +59,11 @@
{
}
- public DefaultBinding(int nodeID, Condition condition, Queue queue, boolean failed)
+ public DefaultBinding(int nodeID, Condition condition, Queue queue)
{
this.nodeID = nodeID;
this.condition = condition;
this.queue = queue;
- this.failed = failed;
}
// Binding implementation -----------------------------------------------------------------------
@@ -87,25 +83,6 @@
return queue;
}
- public boolean isFailed()
- {
- return failed;
- }
-
- public void setFailed(boolean failed)
- {
- this.failed = failed;
- }
-
- public Integer getFailedNodeID()
- {
- if (queue instanceof FailedOverQueue)
- {
- return new Integer(((FailedOverQueue)queue).getFailedNodeID());
- }
- return null;
- }
-
// Public ---------------------------------------------------------------------------------------
public String toString()
@@ -116,13 +93,6 @@
sb.append(nodeID).append(',');
sb.append(queue);
-// sb.append('(');
-// sb.append(queue.getClass().getName()).append(')');
-//
-// if (condition != null)
-// {
-// sb.append(", condition: ").append(condition);
-// }
sb.append("]");
toString = sb.toString();
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/DefaultPostOffice.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -138,7 +138,7 @@
super.start();
- loadBindings();
+ loadBindings(false);
log.debug(this + " started");
}
@@ -197,7 +197,7 @@
throw new IllegalArgumentException("Binding already exists for name " + queue.getName());
}
- binding = new DefaultBinding(currentNodeId, condition, queue, false);
+ binding = new DefaultBinding(currentNodeId, condition, queue);
addBinding(binding);
@@ -553,7 +553,7 @@
// internally. Creating queues is problematic since there are params we do not know until
// destination deploy time e.g. paging params, maxsize etc. This means we have to load the queues
// disabled and then set the params and re-activate them which is not clean.
- protected void loadBindings() throws Exception
+ protected void loadBindings(boolean nonClusteredOnly) throws Exception
{
lock.writeLock().acquire();
@@ -562,6 +562,8 @@
ResultSet rs = null;
TransactionWrapper wrap = new TransactionWrapper();
+ log.info("loading bindings, non cliustered only " + nonClusteredOnly);
+
try
{
conn = ds.getConnection();
@@ -585,33 +587,41 @@
}
long channelID = rs.getLong(5);
- boolean failed = rs.getString(6).equals("Y");
+
+ boolean isClustered = rs.getString(6).equals("Y");
- Integer failedNodeID = null;
- int i = rs.getInt(7);
-
- if(!rs.wasNull())
- {
- failedNodeID = new Integer(i);
- }
-
Condition condition = conditionFactory.createCondition(conditionText);
-
- //Temp hack
- //For non clustered po don't want to load other nodes bindings!
- if (!(this instanceof ClusteredPostOffice) && (nodeID != this.currentNodeId))
+
+ if (nonClusteredOnly && isClustered)
{
- //Don't load other nodes binding
+ // Don't want to load clustered bindings
+
+ log.info("it's a clustered binding not loading it since non clustered only");
}
else
{
- Binding binding = createBinding(nodeID, condition, queueName, channelID,
- selector, true, failed, failedNodeID);
-
- log.debug(this + " loaded from database " + binding);
-
- binding.getQueue().deactivate();
- addBinding(binding);
+
+ //Temp hack
+ //For non clustered po don't want to load other nodes bindings!
+ if (!(this instanceof ClusteredPostOffice) && (nodeID != this.currentNodeId))
+ {
+ //Don't load other nodes binding
+ }
+ else if ((this instanceof ClusteredPostOffice) && (nodeID != this.currentNodeId) &&
+ !isClustered)
+ {
+ //We don't load non clustered bindings on other nodes
+ }
+ else
+ {
+ Binding binding = createBinding(nodeID, condition, queueName, channelID,
+ selector, true, isClustered);
+
+ log.debug(this + " loaded from database " + binding);
+
+ binding.getQueue().deactivate();
+ addBinding(binding);
+ }
}
}
}
@@ -640,11 +650,11 @@
*/
protected Binding createBinding(int nodeID, Condition condition, String queueName,
long channelID, String filterString, boolean durable,
- boolean failed, Integer failedNodeID) throws Exception
+ boolean isClustered) throws Exception
{
Filter filter = filterFactory.createFilter(filterString);
return createBinding(nodeID, condition, queueName, channelID,
- filter, durable, failed, failedNodeID);
+ filter, durable, isClustered);
}
/**
@@ -652,7 +662,7 @@
*/
protected Binding createBinding(int nodeID, Condition condition, String queueName,
long channelID, Filter filter, boolean durable,
- boolean failed, Integer failedNodeID)
+ boolean isClustered)
{
Queue queue;
@@ -664,10 +674,10 @@
else
{
throw new IllegalStateException("This is a non clustered post office - should not " +
- "have bindings from different nodes!");
+ "have bindings from different nodes!");
}
- return new DefaultBinding(nodeID, condition, queue, failed);
+ return new DefaultBinding(nodeID, condition, queue);
}
protected void insertBinding(Binding binding) throws Exception
@@ -698,17 +708,14 @@
{
ps.setNull(5, Types.VARCHAR);
}
- ps.setLong(6, binding.getQueue().getChannelID());
- ps.setString(7,binding.isFailed() ? "Y":"N");
-
- Integer failedNodeID = binding.getFailedNodeID();
- if (failedNodeID == null)
+ ps.setLong(6, binding.getQueue().getChannelID());
+ if (binding.getQueue().isClustered())
{
- ps.setNull(8, Types.INTEGER);
+ ps.setString(7, "Y");
}
else
{
- ps.setInt(8, failedNodeID.intValue());
+ ps.setString(7, "N");
}
ps.executeUpdate();
@@ -879,9 +886,8 @@
"CONDITION, " +
"SELECTOR, " +
"CHANNEL_ID, " +
- "IS_FAILED_OVER, " +
- "FAILED_NODE_ID) " +
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
+ "CLUSTERED) " +
+ "VALUES (?, ?, ?, ?, ?, ?, ?)");
map.put("DELETE_BINDING",
"DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?");
@@ -893,8 +899,7 @@
"CONDITION, " +
"SELECTOR, " +
"CHANNEL_ID, " +
- "IS_FAILED_OVER, " +
- "FAILED_NODE_ID " +
+ "CLUSTERED " +
"FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?");
return map;
@@ -906,8 +911,8 @@
map.put("CREATE_POSTOFFICE_TABLE",
"CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID INTEGER," +
"QUEUE_NAME VARCHAR(1023), CONDITION VARCHAR(1023), " +
- "SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, IS_FAILED_OVER CHAR(1), " +
- "FAILED_NODE_ID INTEGER)");
+ "SELECTOR VARCHAR(1023), CHANNEL_ID BIGINT, " +
+ "CLUSTERED CHAR(1))");
return map;
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindRequest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindRequest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -44,17 +44,16 @@
}
BindRequest(int nodeId, String queueName, String conditionText, String filterString,
- long channelId, boolean durable, boolean failed)
+ long channelId, boolean durable)
{
bindingInfo = new BindingInfo(nodeId, queueName, conditionText, filterString,
- channelId, durable, failed);
+ channelId, durable);
}
Object execute(PostOfficeInternal office) throws Exception
{
office.addBindingFromCluster(bindingInfo.getNodeId(), bindingInfo.getQueueName(), bindingInfo.getConditionText(),
- bindingInfo.getFilterString(), bindingInfo.getChannelId(), bindingInfo.isDurable(),
- bindingInfo.isFailed());
+ bindingInfo.getFilterString(), bindingInfo.getChannelId(), bindingInfo.isDurable());
return null;
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindingInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindingInfo.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/BindingInfo.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -50,14 +50,12 @@
private boolean durable;
- private boolean failed;
-
BindingInfo()
{
}
BindingInfo(int nodeId, String queueName, String conditionText, String filterString,
- long channelId, boolean durable, boolean failed)
+ long channelId, boolean durable)
{
this.nodeId = nodeId;
@@ -70,14 +68,12 @@
this.channelId = channelId;
this.durable = durable;
-
- this.failed = failed;
}
public void execute(PostOfficeInternal office) throws Exception
{
office.addBindingFromCluster(nodeId, queueName, conditionText,
- filterString, channelId, durable, failed);
+ filterString, channelId, durable);
}
@@ -140,14 +136,4 @@
{
return queueName;
}
-
- public boolean isFailed()
- {
- return failed;
- }
-
- public void setFailed(boolean failed)
- {
- this.failed = failed;
- }
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/ClusterRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/ClusterRouter.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/ClusterRouter.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -21,11 +21,12 @@
*/
package org.jboss.messaging.core.plugin.postoffice.cluster;
+import java.util.List;
+
+import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.Receiver;
import org.jboss.messaging.core.Router;
-import java.util.List;
-
/**
* A ClusterRouter
*
@@ -39,10 +40,7 @@
{
List getQueues();
- List getFailedQueues();
+ Queue getLocalQueue();
- ClusteredQueue getLocalQueue();
-
- boolean add(Receiver receiver, boolean failedOver);
-
+ boolean add(Receiver receiver);
}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -207,10 +207,6 @@
private Map routerMap;
- /** List of failed over bindings.
- * Map<int nodeId, Map<channelId,Binding>>*/
- private Map failedBindings;
-
private StatsSender statsSender;
private ReplicationListener nodeAddressMapListener;
@@ -264,8 +260,6 @@
routerMap = new HashMap();
- failedBindings = new LinkedHashMap();
-
statsSender = new StatsSender(this, statsSendPeriod);
holdingArea = new HashMap();
@@ -449,9 +443,7 @@
if (queue.getNodeId() != this.currentNodeId)
{
- log.warn("queue.getNodeId is not this node");
- //throw new IllegalArgumentException("Queue node id does not match office node id");
- // TODO what to do when HA failing?
+ throw new IllegalArgumentException("Queue node id does not match office node id");
}
Binding binding = (Binding)super.bindQueue(condition, queue);
@@ -479,41 +471,13 @@
return listBindingsForConditionInternal(condition, false);
}
- public Binding getBindingforChannelId(long channelId) throws Exception
- {
- lock.readLock().acquire();
-
- try
- {
- //First look in the failed map
- //Failed bindings are stored in the failed map by channel id
- Map channelMap = (Map)failedBindings.get(new Integer(currentNodeId));
- Binding binding = null;
- if (channelMap != null)
- {
- binding = (Binding)channelMap.get(new Long(channelId));
- }
-
- if (binding == null)
- {
- binding = super.getBindingforChannelId(channelId);
- }
- return binding;
- }
- finally
- {
- lock.readLock().release();
- }
- }
-
// PostOfficeInternal implementation ------------------------------------------------------------
/*
* Called when another node adds a binding
*/
public void addBindingFromCluster(int nodeId, String queueName, String conditionText,
- String filterString, long channelID, boolean durable,
- boolean failed)
+ String filterString, long channelID, boolean durable)
throws Exception
{
lock.writeLock().acquire();
@@ -542,14 +506,14 @@
binding = (Binding)nameMap.get(queueName);
}
- if (binding != null && failed)
+ if (binding != null)
{
throw new IllegalArgumentException(this + " has already this binding for node " +
nodeId + ", queue " + queueName);
}
binding = createBinding(nodeId, condition, queueName, channelID,
- filterString, durable, failed, null);
+ filterString, durable, true);
addBinding(binding);
}
@@ -938,22 +902,27 @@
{
Binding bb = (Binding)iter.next();
- LocalClusteredQueue q = (LocalClusteredQueue)bb.getQueue();
+ Queue q = bb.getQueue();
- if (q.isActive())
- {
- QueueStats stats = q.getStats();
-
- if (stats != null)
+ //Only send stats for clustered queues
+
+ if (q instanceof ClusteredQueue)
+ {
+ if (q.isActive())
{
- if (statsList == null)
+ QueueStats stats = ((ClusteredQueue)q).getStats();
+
+ if (stats != null)
{
- statsList = new ArrayList();
+ if (statsList == null)
+ {
+ statsList = new ArrayList();
+ }
+
+ statsList.add(stats);
+
+ if (trace) { log.trace(this.currentNodeId + " adding stat for send " + stats); }
}
-
- statsList.add(stats);
-
- if (trace) { log.trace(this.currentNodeId + " adding stat for send " + stats); }
}
}
}
@@ -1397,33 +1366,7 @@
StringWriter buffer = new StringWriter();
PrintWriter out = new PrintWriter(buffer);
out.print(super.printBindingInformation());
-
- out.println("<br>FailOver bindings");
- out.println("<table border=1><tr><td>Node</td><td>ChannelID</td><td>Binding</td>");
-
- for (Iterator iter = this.failedBindings.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry)iter.next();
-
- int count=0;
- Map bindings = (Map)entry.getValue();
- for (Iterator iterValues = bindings.entrySet().iterator();iterValues.hasNext();)
- {
- Map.Entry entry2 = (Map.Entry)iterValues.next();
- if ( count++ == 0 )
- {
- out.print("<tr><td>" + entry.getKey() + "</td>");
- }
- else
- {
- out.print("<tr><td> </td>");
- }
- out.println("<td>" + entry2.getKey() + "</td><td>" + entry2.getValue() + "</td></tr>");
- }
- }
-
- out.println("</table>");
-
+
out.println("<br>Router Information");
out.println("<table border=1><tr><td>Queue Route</td><td>Local Queue</td><td>Elements</td></tr>");
@@ -1438,16 +1381,6 @@
out.println("<table border=1>");
- if (!router.getFailedQueues().isEmpty())
- {
- out.println("<tr><td><b>Failed Over Queues</b></td><</tr>");
- for (Iterator queuesIterator = router.getFailedQueues().iterator();queuesIterator.hasNext();)
- {
- Object queue = queuesIterator.next();
- out.println("<tr><td>" + queue + "</td></tr>");
- }
- }
-
out.println("<tr><td><b>Queues</b></td><</tr>");
for (Iterator queuesIterator = router.getQueues().iterator();queuesIterator.hasNext();)
@@ -1523,18 +1456,6 @@
// Protected ------------------------------------------------------------------------------------
- protected void addToNameMap(Binding binding)
- {
- if (!binding.isFailed())
- {
- super.addToNameMap(binding);
- }
- else
- {
- addIntoFailedMaps(binding);
- }
- }
-
protected void addToConditionMap(Binding binding)
{
Condition condition = binding.getCondition();
@@ -1560,9 +1481,7 @@
bindings.addRouter(queueName, router);
}
- // TODO Maybe we should have isFailed as a property of Queue instead of Binding, so we won't
- // need to change this signature.
- router.add(binding.getQueue(), binding.isFailed());
+ router.add(binding.getQueue());
}
protected void removeFromConditionMap(Binding binding)
@@ -1608,7 +1527,7 @@
}
}
- protected void loadBindings() throws Exception
+ protected void loadBindings(boolean nonClusteredOnly) throws Exception
{
if (trace) { log.trace(this + " loading bindings"); }
@@ -1620,7 +1539,7 @@
// the database.
if (trace) { log.trace(this + " is the first member of group, so will load bindings from database"); }
- super.loadBindings();
+ super.loadBindings(false);
}
else
{
@@ -1629,6 +1548,10 @@
if (trace) { log.trace(this + " not first member of group, so waiting for state to arrive...."); }
+ // The state will give us the clustered bindings - but not the non clustered ones - so we load these
+ // explicitly
+ log.info(" not first member of group, so waiting for state to arrive....");
+
synchronized (setStateLock)
{
//TODO we should implement a timeout on this
@@ -1637,17 +1560,22 @@
setStateLock.wait();
}
}
+
+ log.info("loading non clustered bindings from db");
+ super.loadBindings(true);
+
+
if (trace) { log.trace(this + " received state"); }
}
}
protected Binding createBinding(int nodeId, Condition condition, String queueName,
long channelId, String filterString, boolean durable,
- boolean failed, Integer failedNodeID) throws Exception
+ boolean isClustered) throws Exception
{
Filter filter = filterFactory.createFilter(filterString);
return createBinding(nodeId, condition, queueName, channelId,
- filter, durable, failed, failedNodeID);
+ filter, durable, isClustered);
}
//FIXME - we should not create queues here
@@ -1655,29 +1583,29 @@
//we know all the params
protected Binding createBinding(int nodeID, Condition condition, String queueName,
long channelId, Filter filter, boolean durable,
- boolean failed, Integer failedNodeID)
+ boolean isClustered)
{
Queue queue;
- if (nodeID == currentNodeId)
+ if (isClustered)
{
- if (failedNodeID == null)
+ if (nodeID == currentNodeId)
{
queue = new LocalClusteredQueue(this, nodeID, queueName, channelId, ms, pm, true,
durable, -1, filter, tr);
}
else
{
- queue = new FailedOverQueue(this, nodeID, queueName, channelId, ms, pm, true,
- durable, filter, tr, failedNodeID.intValue());
+ queue = new RemoteQueueStub(nodeID, queueName, channelId, durable, pm, filter);
}
}
else
{
- queue = new RemoteQueueStub(nodeID, queueName, channelId, durable, pm, filter);
+ return super.createBinding(nodeID, condition, queueName, channelId, filter, durable,
+ isClustered);
}
- return new DefaultBinding(nodeID, condition, queue, failed);
+ return new DefaultBinding(nodeID, condition, queue);
}
// Private --------------------------------------------------------------------------------------
@@ -1688,8 +1616,7 @@
BindRequest request =
new BindRequest(this.currentNodeId, queue.getName(), condition.toText(),
queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
- binding.getQueue().getChannelID(), queue.isRecoverable(),
- binding.isFailed());
+ binding.getQueue().getChannelID(), queue.isRecoverable());
syncSendRequest(request);
}
@@ -1784,14 +1711,20 @@
private void notifyListeners(Serializable key, Map updatedReplicantMap, boolean added,
int originatorNodeId)
{
+ //We clone to avoid deadlock
+
+ Set clone;
+
synchronized (replicationListeners)
{
- for (Iterator i = replicationListeners.iterator(); i.hasNext(); )
- {
- ReplicationListener listener = (ReplicationListener)i.next();
- listener.onReplicationChange(key, updatedReplicantMap, added, originatorNodeId);
- }
+ clone = new HashSet(replicationListeners);
}
+
+ for (Iterator i = clone.iterator(); i.hasNext(); )
+ {
+ ReplicationListener listener = (ReplicationListener)i.next();
+ listener.onReplicationChange(key, updatedReplicantMap, added, originatorNodeId);
+ }
}
/*
@@ -1880,14 +1813,19 @@
Binding binding = (Binding)iter2.next();
Queue queue = binding.getQueue();
-
- BindingInfo info = new BindingInfo(binding.getNodeID(), queue.getName(),
- binding.getCondition().toText(),
- queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
- queue.getChannelID(),
- queue.isRecoverable(),
- binding.isFailed());
- bindings.add(info);
+
+ //we only replicate the clustered queues
+
+ if (queue.isClustered())
+ {
+ BindingInfo info = new BindingInfo(binding.getNodeID(), queue.getName(),
+ binding.getCondition().toText(),
+ queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
+ queue.getChannelID(),
+ queue.isRecoverable());
+
+ bindings.add(info);
+ }
}
}
@@ -1927,7 +1865,7 @@
Condition condition = conditionFactory.createCondition(info.getConditionText());
Binding binding =
createBinding(info.getNodeId(), condition, info.getQueueName(), info.getChannelId(),
- info.getFilterString(), info.isDurable(), info.isFailed(), null);
+ info.getFilterString(), info.isDurable(), true);
if (binding.getNodeID() == this.currentNodeId)
{
@@ -2084,8 +2022,6 @@
log.info(this + ": I am the failover node for node " + leftNodeID + " that crashed");
- //TODO server side valve
-
performFailover(leftNodeID);
}
}
@@ -2132,6 +2068,9 @@
log.debug(this + " announced the cluster it is starting failover procedure");
// Get the map of queues for the failed node
+ // The current node will take over responsibility for all clustered queues from the failed
+ // node. Non clustered queues will be left alone.
+ // If this node already has a queue with the same name, the queues will be merged
Map subMaps = (Map)nameMaps.get(failedNodeID);
@@ -2171,12 +2110,15 @@
ClusteredQueue queue = (ClusteredQueue)binding.getQueue();
// Sanity check
- if (queue.isLocal())
+ if (!queue.isClustered())
{
- throw new IllegalStateException("Queue " + queue.getName() + " is local!");
+ //We don't fail over non clustered queues
+ log.debug("Not failing over non clustered queue " + queue.getName());
}
-
- namesToRemove.add(entry);
+ else
+ {
+ namesToRemove.add(entry);
+ }
}
if (trace) { log.trace("deleting " + namesToRemove.size() + " bindings from old node"); }
@@ -2199,58 +2141,60 @@
// Note we do not need to send an unbind request across the cluster - this is because
// when the node crashes a view change will hit the other nodes and that will cause
// all binding data for that node to be removed anyway.
+
+ Binding current = internalGetBindingForQueueName(queueName);
- // If there is already a queue registered with the same name, then we set a flag
- // "failed" on the binding and then the queue will go into a special list of failed
- // bindings otherwise we treat at as a normal queue.
- // This is because we cannot deal with more than one queue with the same name. Any
- // new consumers will always only connect to queues in the main name map. This may
- // mean that queues in the failed map have messages stranded in them if consumers
- // disconnect (since no more can reconnect). However we message redistribution
- // activated other queues will be able to consume from them.
-
- //TODO allow message redistribution for queues in the failed list
-
- boolean failed = internalGetBindingForQueueName(queueName) != null;
-
- if (!failed)
+ if (current == null)
{
- log.debug(this + " did not have a " + queueName +
- " queue so it's assuming it as a regular queue");
+ log.debug(this + " did not have a " + queueName + " queue so no need to merge");
}
else
{
- log.debug(this + " has already a " + queueName + " queue so adding to failed map");
+ log.debug(this + " has already a " + queueName + " queue so merging queues");
}
-
- // Create a new binding
- Binding newBinding =
- createBinding(currentNodeId, binding.getCondition(), stub.getName(),
- stub.getChannelID(), stub.getFilter(), stub.isRecoverable(),
- failed, failedNodeID);
-
- // Insert it into the database
- insertBinding(newBinding);
-
- LocalClusteredQueue clusteredQueue = (LocalClusteredQueue)newBinding.getQueue();
-
- clusteredQueue.deactivate();
- clusteredQueue.load();
- clusteredQueue.activate();
-
- log.debug(this + " loaded " + clusteredQueue);
-
- // Add the new binding in memory
- addBinding(newBinding);
-
- // Send a bind request so other nodes add it too
- sendBindRequest(binding.getCondition(), clusteredQueue,newBinding);
-
- //FIXME there is a problem in the above code.
- //If the server crashes between deleting the binding from the database
- //and creating the new binding in the database, then the binding will be completely
- //lost from the database when the server is resurrected.
- //To remedy, both db operations need to be done in the same JBDC tx
+
+ if (current != null)
+ {
+ //need to merge the queues
+ log.debug("Merging queue " + queueName);
+
+ LocalClusteredQueue currentQueue = (LocalClusteredQueue)current.getQueue();
+
+ currentQueue.mergeIn(stub);
+
+ log.debug("Merged queue");
+ }
+ else
+ {
+ // Create a new binding
+ Binding newBinding =
+ createBinding(currentNodeId, binding.getCondition(), stub.getName(),
+ stub.getChannelID(), stub.getFilter(), stub.isRecoverable(),
+ true);
+
+ // Insert it into the database
+ insertBinding(newBinding);
+
+ LocalClusteredQueue clusteredQueue = (LocalClusteredQueue)newBinding.getQueue();
+
+ clusteredQueue.deactivate();
+ clusteredQueue.load();
+ clusteredQueue.activate();
+
+ log.debug(this + " loaded " + clusteredQueue);
+
+ // Add the new binding in memory
+ addBinding(newBinding);
+
+ // Send a bind request so other nodes add it too
+ sendBindRequest(binding.getCondition(), clusteredQueue,newBinding);
+
+ //FIXME there is a problem in the above code.
+ //If the server crashes between deleting the binding from the database
+ //and creating the new binding in the database, then the binding will be completely
+ //lost from the database when the server is resurrected.
+ //To remedy, both db operations need to be done in the same JBDC tx
+ }
}
}
@@ -2275,20 +2219,6 @@
}
}
- private void addIntoFailedMaps(Binding binding)
- {
- Map channelMap = (Map)failedBindings.get(new Integer(binding.getNodeID()));
-
- if (channelMap == null)
- {
- channelMap = new LinkedHashMap();
-
- failedBindings.put(new Integer(binding.getNodeID()), channelMap);
- }
-
- channelMap.put(new Long(binding.getQueue().getChannelID()), binding);
- }
-
private void sendJMXNotification(String notificationType)
{
Notification n = new Notification(notificationType, "", 0l);
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultRouter.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -28,21 +28,17 @@
import org.jboss.logging.Logger;
import org.jboss.messaging.core.Delivery;
import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.Receiver;
-import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.tx.Transaction;
/**
*
- * This router first favours the failed over queue (if there is one) TODO revisit this
+ * This router favours the local queue.
*
- * Then it favours the local queue.
- *
* If there is no local queue, then it will round robin between the non local queues.
*
- * FIXME - none of the new failed over functionality has been tested!!
- *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
* @version <tt>$Revision$</tt>
@@ -65,11 +61,8 @@
// ArrayList<>; MUST be an arraylist for fast index access
private ArrayList nonLocalQueues;
- // ArrayList<FailedOverQueue>; MUST be an arraylist for fast index access
- private ArrayList failedOverQueues;
+ private Queue localQueue;
- private ClusteredQueue localQueue;
-
private int target;
// Constructors ---------------------------------------------------------------------------------
@@ -77,8 +70,6 @@
public DefaultRouter()
{
nonLocalQueues = new ArrayList();
-
- failedOverQueues = new ArrayList();
}
// Receiver implementation ----------------------------------------------------------------------
@@ -89,31 +80,6 @@
// Favour the local queue or the failedOver queue in round robin
- //TODO - revisit all of this - it doesn't look right to me - Tim
- if (!failedOverQueues.isEmpty())
- {
- // If the message arrived over a failed-over connection, try to send the message to its
- // corresponding "failed-over" queue.
-
- Integer failedNodeID = (Integer)ref.getMessage().getHeader(Message.FAILED_NODE_ID);
-
- if (failedNodeID != null)
- {
- Delivery del = null;
-
- LocalClusteredQueue targetFailoverQueue = locateFailoverQueue(failedNodeID.intValue());
-
- if (targetFailoverQueue != null)
- {
- del = targetFailoverQueue.handle(observer, ref, tx);
- }
-
- if (trace) { log.trace(this + " routed message to fail-over queue " + targetFailoverQueue + ", returned " + del) ;}
-
- return del;
- }
- }
-
if (localQueue != null)
{
// The only time the local queue won't accept is if the selector doesn't match, in which
@@ -198,27 +164,14 @@
}
return true;
}
- else
- {
- //Maybe it's a failed over queue
- if (this.failedOverQueues.remove(queue))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
}
+ return false;
}
public void clear()
{
nonLocalQueues.clear();
- failedOverQueues.clear();
-
localQueue = null;
target = 0;
@@ -246,38 +199,34 @@
return queues;
}
- public List getFailedQueues()
+ public Queue getLocalQueue()
{
- return failedOverQueues;
- }
-
- public ClusteredQueue getLocalQueue()
- {
return localQueue;
}
public boolean add(Receiver receiver, boolean failedOver)
{
- ClusteredQueue queue = (ClusteredQueue)receiver;
-
- if (queue.isLocal())
+ if (receiver instanceof ClusteredQueue)
{
- if (failedOver)
+
+ ClusteredQueue queue = (ClusteredQueue)receiver;
+
+ if (queue.isLocal())
{
- failedOverQueues.add(receiver);
- }
- else
- {
if (localQueue != null)
{
throw new IllegalStateException(this + " already has local queue");
}
- localQueue = queue;
+ localQueue = queue;
}
+ else
+ {
+ nonLocalQueues.add(queue);
+ }
}
else
{
- nonLocalQueues.add(queue);
+ localQueue = (Queue)receiver;
}
return true;
@@ -311,25 +260,7 @@
}
}
- private FailedOverQueue locateFailoverQueue(int failedNodeID)
- {
- // TODO - this is a VERY slow sequential pass; I am sure we can come with a smarter way to
- // locate the queue
-
- // This is rubbish - should be using a Map for the failed over queues
- // or better still rethink the whole way this failed over queue routing works - it is a mess!
- for(int i = 0; i < failedOverQueues.size(); i++)
- {
- if (((FailedOverQueue)failedOverQueues.get(i)).getFailedNodeID() == failedNodeID)
- {
- return (FailedOverQueue)failedOverQueues.get(i);
- }
- }
- return null;
- }
-
// Inner classes --------------------------------------------------------------------------------
-
}
Deleted: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/FailedOverQueue.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -1,81 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.messaging.core.plugin.postoffice.cluster;
-
-import org.jboss.messaging.core.Filter;
-import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
-import org.jboss.messaging.core.plugin.contract.MessageStore;
-import org.jboss.messaging.core.plugin.contract.PersistenceManager;
-import org.jboss.messaging.core.tx.TransactionRepository;
-
-/**
- *
- * A LocalClusteredQueue
- *
- * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- *
- */
-public class FailedOverQueue extends LocalClusteredQueue
-{
- // Constants ------------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- private int failedNodeID;
-
- // Constructors ---------------------------------------------------------------------------------
-
- public FailedOverQueue(ClusteredPostOffice office, int nodeID, String name, long id, MessageStore ms,
- PersistenceManager pm, boolean acceptReliableMessages,
- boolean recoverable, Filter filter,
- TransactionRepository tr, int fullSize, int pageSize, int downCacheSize,
- int failedNodeID)
- {
- super(office, nodeID, name, id, ms, pm, acceptReliableMessages, recoverable,
- -1, filter, tr, fullSize, pageSize, downCacheSize);
-
- this.failedNodeID = failedNodeID;
- }
-
- public FailedOverQueue(ClusteredPostOffice office, int nodeID, String name, long id, MessageStore ms,
- PersistenceManager pm, boolean acceptReliableMessages,
- boolean recoverable, Filter filter,
- TransactionRepository tr, int failedNodeID)
- {
- super(office, nodeID, name, id, ms, pm, acceptReliableMessages, recoverable,
- -1, filter, tr);
-
- this.failedNodeID = failedNodeID;
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public int getFailedNodeID()
- {
- return failedNodeID;
- }
-
- public String toString()
- {
- return "FailedOverQueue[" + getChannelID() + "/" + getName() +
- "/failedNodeID=" + failedNodeID + "]";
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/LocalClusteredQueue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/LocalClusteredQueue.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/LocalClusteredQueue.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -21,6 +21,9 @@
*/
package org.jboss.messaging.core.plugin.postoffice.cluster;
+import java.util.Iterator;
+import java.util.Map;
+
import org.jboss.logging.Logger;
import org.jboss.messaging.core.Delivery;
import org.jboss.messaging.core.Filter;
@@ -31,6 +34,7 @@
import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
import org.jboss.messaging.core.plugin.contract.MessageStore;
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
+import org.jboss.messaging.core.plugin.contract.PersistenceManager.ReferenceInfo;
import org.jboss.messaging.core.tx.Transaction;
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.messaging.util.Future;
@@ -220,6 +224,27 @@
return ((Integer)result.getResult()).intValue();
}
+ /*
+ * Merge the contents of one queue with another - this happens at failover when
+ * a queue is failed over to another node, but a queue with the same name already exists
+ * In this case we merge the two queues
+ */
+ public void mergeIn(RemoteQueueStub remoteQueue) throws Exception
+ {
+ if (trace) { log.trace("Merging queue " + remoteQueue + " into " + this); }
+
+ synchronized (refLock)
+ {
+ flushDownCache();
+
+ PersistenceManager.InitialLoadInfo ili =
+ pm.mergeAndLoad(remoteQueue.getChannelID(), this.channelID, fullSize - messageRefs.size());
+
+ doLoad(ili);
+
+ }
+ }
+
protected void deliverInternal()
{
super.deliverInternal();
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PostOfficeInternal.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PostOfficeInternal.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/PostOfficeInternal.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -46,7 +46,7 @@
interface PostOfficeInternal extends ClusteredPostOffice
{
void addBindingFromCluster(int nodeId, String queueName, String conditionText,
- String filterString, long channelId, boolean durable, boolean failed)
+ String filterString, long channelId, boolean durable)
throws Exception;
void removeBindingFromCluster(int nodeId, String queueName)
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RoundRobinRouter.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RoundRobinRouter.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/RoundRobinRouter.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -28,8 +28,8 @@
import org.jboss.logging.Logger;
import org.jboss.messaging.core.Delivery;
import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Queue;
import org.jboss.messaging.core.Receiver;
-import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.message.MessageReference;
import org.jboss.messaging.core.tx.Transaction;
@@ -63,9 +63,6 @@
// ArrayList<>; MUST be an arraylist for fast index access
private ArrayList queues;
- // ArrayList<FailedOverQueue>; MUST be an arraylist for fast index access
- private ArrayList failedOverQueues;
-
private ClusteredQueue localQueue;
private int target;
@@ -75,9 +72,6 @@
public RoundRobinRouter()
{
queues = new ArrayList();
-
- //FIXME - this should be a map not an arraylist
- failedOverQueues = new ArrayList();
}
// Receiver implementation ----------------------------------------------------------------------
@@ -86,33 +80,6 @@
{
if (trace) { log.trace(this + " routing " + ref); }
- //TODO - revisit all of this - it doesn't look right to me - Tim
- if (!failedOverQueues.isEmpty())
- {
- // If the message arrived over a failed-over connection, try to send the message to its
- // corresponding "failed-over" queue.
-
- Integer failedNodeID = (Integer)ref.getMessage().getHeader(Message.FAILED_NODE_ID);
-
- if (failedNodeID != null)
- {
- Delivery del = null;
-
- LocalClusteredQueue targetFailoverQueue = locateFailoverQueue(failedNodeID.intValue());
-
- if (targetFailoverQueue != null)
- {
- del = targetFailoverQueue.handle(observer, ref, tx);
- }
-
- if (trace) { log.trace(this + " routed message to fail-over queue " + targetFailoverQueue + ", returned " + del) ;}
-
- return del;
- }
- }
-
- // We round robin among the rest.
-
if (!queues.isEmpty())
{
ClusteredQueue queue = (ClusteredQueue)queues.get(target);
@@ -169,26 +136,14 @@
}
return true;
}
- else
- {
- //Maybe it's a failed over queue
- if (this.failedOverQueues.remove(queue))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
+
+ return false;
}
public void clear()
{
queues.clear();
- failedOverQueues.clear();
-
localQueue = null;
target = 0;
@@ -207,11 +162,6 @@
return queues;
}
- public List getFailedQueues()
- {
- return failedOverQueues;
- }
-
public boolean add(Receiver receiver, boolean failedOver)
{
ClusteredQueue queue = (ClusteredQueue)receiver;
@@ -228,18 +178,12 @@
}
}
- if (failedOver)
- {
- failedOverQueues.add(receiver);
- }
- else
- {
- queues.add(receiver);
- }
+ queues.add(receiver);
+
return true;
}
- public ClusteredQueue getLocalQueue()
+ public Queue getLocalQueue()
{
return localQueue;
}
@@ -272,23 +216,6 @@
}
}
- private FailedOverQueue locateFailoverQueue(int failedNodeID)
- {
- // TODO - this is a VERY slow sequential pass; I am sure we can come with a smarter way to
- // locate the queue
-
- // This is rubbish - should be using a Map for the failed over queues
- // or better still rethink the whole way this failed over queue routing works - it is a mess!
- for(int i = 0; i < failedOverQueues.size(); i++)
- {
- if (((FailedOverQueue)failedOverQueues.get(i)).getFailedNodeID() == failedNodeID)
- {
- return (FailedOverQueue)failedOverQueues.get(i);
- }
- }
- return null;
- }
-
// Inner classes --------------------------------------------------------------------------------
}
Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -837,7 +837,7 @@
pm.pageReferences(channel.getChannelID(), refs, false);
//First load exactly 10
- PersistenceManager.InitialLoadInfo info = pm.getInitialReferenceInfos(channel.getChannelID(), 10);
+ PersistenceManager.InitialLoadInfo info = pm.loadFromStart(channel.getChannelID(), 10);
assertNull(info.getMinPageOrdering());
assertNull(info.getMaxPageOrdering());
Modified: trunk/tests/src/org/jboss/test/messaging/jms/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/FailoverTest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/tests/src/org/jboss/test/messaging/jms/FailoverTest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -59,92 +59,97 @@
super.tearDown();
}
- public void testSendReceive() throws Exception
- {
- Hashtable properties = new Hashtable();
-
- properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ public void testNOOP()
+ {
- properties.put("java.naming.provider.url", "jnp://192.168.1.11:1199");
-
- properties.put("java.naming.factory.url", "org.jnp.interfaces");
-
- log.info("Creaing ic");
-
- InitialContext ic = new InitialContext(properties);
-
- log.info("************ REMOTE");
-
- Connection conn = null;
-
- try
- {
- log.info("Created ic");
-
- Queue queue = (Queue)ic.lookup("/queue/testDistributedQueue");
-
- log.info("Looked up queue");
-
- ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
-
- log.info("Looked up cf");
-
- conn = cf.createConnection();
-
- Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session sessCons = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageConsumer cons = sessCons.createConsumer(queue);
-
- MessageListener list = new MyListener();
-
- cons.setMessageListener(list);
-
- conn.start();
-
- MessageProducer prod = sessSend.createProducer(queue);
-
- prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-
- int count = 0;
-
- while (true)
- {
- TextMessage tm = sessSend.createTextMessage("message " + count);
-
- prod.send(tm);
-
- log.info("sent " + count);
-
- count++;
-
- //Thread.sleep(1000);
- }
-
-
- }
- catch (Exception e)
- {
- log.error("Failed", e);
- }
- finally
- {
- if (conn != null)
- {
- log.info("closing connetion");
- try
- {
- conn.close();
- }
- catch (Exception ignore)
- {
- }
- log.info("closed connection");
- }
- }
}
+// public void testSendReceive() throws Exception
+// {
+// Hashtable properties = new Hashtable();
+//
+// properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+//
+// properties.put("java.naming.provider.url", "jnp://192.168.1.11:1199");
+//
+// properties.put("java.naming.factory.url", "org.jnp.interfaces");
+//
+// log.info("Creaing ic");
+//
+// InitialContext ic = new InitialContext(properties);
+//
+// log.info("************ REMOTE");
+//
+// Connection conn = null;
+//
+// try
+// {
+// log.info("Created ic");
+//
+// Queue queue = (Queue)ic.lookup("/queue/testDistributedQueue");
+//
+// log.info("Looked up queue");
+//
+// ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+//
+// log.info("Looked up cf");
+//
+// conn = cf.createConnection();
+//
+// Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+//
+// Session sessCons = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+//
+// MessageConsumer cons = sessCons.createConsumer(queue);
+//
+// MessageListener list = new MyListener();
+//
+// cons.setMessageListener(list);
+//
+// conn.start();
+//
+// MessageProducer prod = sessSend.createProducer(queue);
+//
+// prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+//
+// int count = 0;
+//
+// while (true)
+// {
+// TextMessage tm = sessSend.createTextMessage("message " + count);
+//
+// prod.send(tm);
+//
+// log.info("sent " + count);
+//
+// count++;
+//
+// //Thread.sleep(250);
+// }
+//
+//
+// }
+// catch (Exception e)
+// {
+// log.error("Failed", e);
+// }
+// finally
+// {
+// if (conn != null)
+// {
+// log.info("closing connetion");
+// try
+// {
+// conn.close();
+// }
+// catch (Exception ignore)
+// {
+// }
+// log.info("closed connection");
+// }
+// }
+// }
+
class MyListener implements MessageListener
{
Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-02-24 22:49:17 UTC (rev 2420)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java 2007-02-25 00:06:06 UTC (rev 2421)
@@ -534,7 +534,7 @@
public void testSessionCreateConsumerDelegateRequest() throws Exception
{
RequestSupport req =
- new SessionCreateConsumerDelegateRequest(23, (byte)77, new JBossQueue("wibble"), null, false, null, false, -1);
+ new SessionCreateConsumerDelegateRequest(23, (byte)77, new JBossQueue("wibble"), null, false, null, false);
testPacket(req, PacketSupport.REQ_SESSION_CREATECONSUMERDELEGATE);
}
@@ -542,7 +542,7 @@
public void testSessionCreateBrowserDelegateRequest() throws Exception
{
RequestSupport req =
- new SessionCreateBrowserDelegateRequest(23, (byte)77, new JBossQueue("wibble"), null, -1);
+ new SessionCreateBrowserDelegateRequest(23, (byte)77, new JBossQueue("wibble"), null);
testPacket(req, PacketSupport.REQ_SESSION_CREATEBROWSERDELEGATE);
}
@@ -787,7 +787,7 @@
public void testSessionCreateConsumerDelegateResponse() throws Exception
{
- ClientConsumerDelegate del = new ClientConsumerDelegate(786, 13123, 213, 123);
+ ClientConsumerDelegate del = new ClientConsumerDelegate(786, 13123, 213);
ResponseSupport resp =
new SessionCreateConsumerDelegateResponse(del);
@@ -798,7 +798,7 @@
public void testSessionCreateBrowserDelegateResponse() throws Exception
{
- ClientBrowserDelegate del = new ClientBrowserDelegate(786, 12);
+ ClientBrowserDelegate del = new ClientBrowserDelegate(786);
ResponseSupport resp =
new SessionCreateBrowserDelegateResponse(del);
More information about the jboss-cvs-commits
mailing list