Author: clebert.suconic(a)jboss.com
Date: 2011-03-11 00:11:27 -0500 (Fri, 11 Mar 2011)
New Revision: 10317
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/HornetQException.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
https://issues.jboss.org/browse/JBPAPP-6080 - DuplicateID changes
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/HornetQException.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/HornetQException.java 2011-03-10
20:55:26 UTC (rev 10316)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/HornetQException.java 2011-03-11
05:11:27 UTC (rev 10317)
@@ -128,6 +128,11 @@
* server is starting and has not finish to be initialized)
*/
public static final int SESSION_CREATION_REJECTED = 112;
+
+ /**
+ * A DuplicateID was rejected.
+ */
+ public static final int DUPLICATE_ID_REJECTED = 113;
// Native Error codes ----------------------------------------------
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-03-10
20:55:26 UTC (rev 10316)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-03-11
05:11:27 UTC (rev 10317)
@@ -1064,7 +1064,7 @@
if (context.getTransaction() != null)
{
- context.getTransaction().markAsRollbackOnly(new
HornetQException(HornetQException.TRANSACTION_ROLLED_BACK, warnMessage.toString()));
+ context.getTransaction().markAsRollbackOnly(new
HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage.toString()));
}
return false;
@@ -1107,7 +1107,7 @@
if (context.getTransaction() != null)
{
- context.getTransaction().markAsRollbackOnly(new
HornetQException(HornetQException.TRANSACTION_ROLLED_BACK, warnMessage.toString()));
+ context.getTransaction().markAsRollbackOnly(new
HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage.toString()));
}
return false;
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2011-03-10
20:55:26 UTC (rev 10316)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2011-03-11
05:11:27 UTC (rev 10317)
@@ -181,17 +181,17 @@
public static final byte REPLICATION_COMPARE_DATA = 102;
public static final byte REPLICATION_SYNC = 103;
-
+
// HA
+ public static final byte SESS_ADD_METADATA = 104;
+
public static final byte CLUSTER_TOPOLOGY = 110;
public static final byte NODE_ANNOUNCE = 111;
public static final byte SUBSCRIBE_TOPOLOGY = 112;
- public static final byte SESS_ADD_METADATA = 104;
-
// Static --------------------------------------------------------
public PacketImpl(final byte type)
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2011-03-10
20:55:26 UTC (rev 10316)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2011-03-11
05:11:27 UTC (rev 10317)
@@ -412,6 +412,11 @@
}
catch (HornetQException e)
{
+ if (e.getCode() == HornetQException.DUPLICATE_ID_REJECTED)
+ {
+ break;
+ }
+ else
if (e.getCode() == HornetQException.TRANSACTION_ROLLED_BACK ||
e.getCode() == HornetQException.UNBLOCKED)
{
// OK
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-03-10
20:55:26 UTC (rev 10316)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-03-11
05:11:27 UTC (rev 10317)
@@ -1977,7 +1977,14 @@
producer.send(message);
}
- session2.commit();
+ try
+ {
+ session2.commit();
+ }
+ catch (HornetQException e)
+ {
+ assertEquals(HornetQException.DUPLICATE_ID_REJECTED, e.getCode());
+ }
ClientConsumer consumer = session2.createConsumer(FailoverTestBase.ADDRESS);