[jboss-cvs] JBoss Messaging SVN: r8597 - in branches/Branch_1_4: src/main/org/jboss/jms/tx and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 28 04:35:43 EDT 2013
Author: gaohoward
Date: 2013-03-28 04:35:43 -0400 (Thu, 28 Mar 2013)
New Revision: 8597
Modified:
branches/Branch_1_4/integration/EAP5/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java
branches/Branch_1_4/src/main/org/jboss/jms/tx/ResourceManager.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XATest.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
JBMESSAGING-1943
Modified: branches/Branch_1_4/integration/EAP5/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- branches/Branch_1_4/integration/EAP5/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/integration/EAP5/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -582,7 +582,7 @@
int downCacheSize,
boolean clustered) throws Exception
{
- deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+ deployDestination(false, name, jndiName, fullSize, pageSize, downCacheSize, -1, clustered);
}
public void deployTopicProgrammatically(String name, String jndiName) throws Exception
@@ -605,9 +605,20 @@
int downCacheSize,
boolean clustered) throws Exception
{
- deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize, clustered);
+ deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize, -1, clustered);
}
+ public void deployQueue(String name,
+ String jndiName,
+ int fullSize,
+ int pageSize,
+ int downCacheSize,
+ int maxSize,
+ boolean clustered) throws Exception
+ {
+ deployDestination(true, name, jndiName, fullSize, pageSize, downCacheSize, maxSize, clustered);
+ }
+
public void deployQueueProgrammatically(String name, String jndiName) throws Exception
{
sc.invoke(serverPeerObjectName,
@@ -773,9 +784,10 @@
int fullSize,
int pageSize,
int downCacheSize,
+ int maxSize,
boolean clustered) throws Exception
{
- log.info("deploying queue, fullsize:" + fullSize + ", ps:" + pageSize + " dc size:" + downCacheSize);
+ log.info("deploying queue, fullsize:" + fullSize + ", ps:" + pageSize + " dc size:" + downCacheSize + " maxSize: " + maxSize);
String config = "<mbean code=\"org.jboss.jms.server.destination." + (isQueue ? "QueueService" : "TopicService") +
"\"" +
@@ -798,6 +810,9 @@
" <attribute name=\"DownCacheSize\">" +
downCacheSize +
"</attribute>" +
+ " <attribute name=\"MaxSize\">" +
+ maxSize +
+ "</attribute>" +
" <attribute name=\"Clustered\">" +
String.valueOf(clustered) +
"</attribute>" +
Modified: branches/Branch_1_4/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/tx/ResourceManager.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/src/main/org/jboss/jms/tx/ResourceManager.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -756,6 +756,13 @@
log.debug("A Throwable was caught in sending one phase commit: " + t, xaEx);
throw xaEx;
}
+ else if (t instanceof JMSException)
+ {
+ //for one-phase commit the server will always roll back the tx
+ MessagingXAException xaEx = new MessagingXAException(XAException.XA_RBOTHER, "A Throwable was caught in sending one phase commit", t);
+ log.debug("A Throwable was caught in sending one phase commit: " + t, xaEx);
+ throw xaEx;
+ }
else
{
MessagingXAException xaEx = new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending one phase commit", t);
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XATest.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XATest.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -2171,6 +2171,68 @@
}
+ public void test1PCSendRollbackOnMaxSize() throws Exception
+ {
+ final int maxSize = 10;
+ ServerManagement.deployQueue("onePcSendRBonMaxSize",
+ null,
+ 75000,
+ 2000,
+ 2000,
+ maxSize);
+ Queue queue = (Queue)ic.lookup("/queue/onePcSendRBonMaxSize");
+ XAConnection conn = null;
+ Connection conn2 = null;
+
+ try
+ {
+ conn = cf.createXAConnection();
+
+ for (int i = 0; i < maxSize + 1; i++)
+ {
+ tm.begin();
+
+ XASession sess = conn.createXASession();
+ XAResource res = sess.getXAResource();
+
+ Transaction tx = tm.getTransaction();
+ tx.enlistResource(res);
+
+ MessageProducer prod = sess.createProducer(queue);
+ Message m = sess.createTextMessage("XATest" + i);
+ prod.send(m);
+
+ tx.delistResource(res, XAResource.TMSUCCESS);
+
+ tm.commit();
+ }
+
+ fail("Transaction doesn't roll back on maxSize!");
+ }
+ catch (Exception e)
+ {
+ //here we should ignore RB exception
+ if (!(e instanceof RollbackException))
+ {
+ throw e;
+ }
+ }
+ finally
+ {
+ this.drainDestination(cf, queue);
+ if (conn != null)
+ {
+ conn.close();
+ }
+ if (conn2 != null)
+ {
+ conn2.close();
+ }
+ ServerManagement.undeployQueue("onePcSendRBonMaxSize");
+ }
+
+ }
+
public void test1PCSendRollback() throws Exception
{
XAConnection conn = null;
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -1046,6 +1046,12 @@
servers[0].getServer().deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, false);
}
+ public static void deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize, int maxSize) throws Exception
+ {
+ insureStarted();
+ servers[0].getServer().deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, maxSize, false);
+ }
+
/**
* Simulates a queue deployment (copying the queue descriptor in the deploy directory).
*/
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -383,6 +383,17 @@
server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, clustered);
}
+ public void deployQueue(String name,
+ String jndiName,
+ int fullSize,
+ int pageSize,
+ int downCacheSize,
+ int maxSize,
+ boolean clustered) throws Exception
+ {
+ server.deployQueue(name, jndiName, fullSize, pageSize, downCacheSize, maxSize, clustered);
+ }
+
public void deployQueueProgrammatically(String name, String jndiName) throws Exception
{
server.deployQueueProgrammatically(name, jndiName);
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java 2013-03-08 08:32:04 UTC (rev 8596)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java 2013-03-28 08:35:43 UTC (rev 8597)
@@ -179,6 +179,11 @@
void deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize, boolean clustered) throws Exception;
/**
+ * Simulates a queue deployment (copying the queue descriptor in the deploy directory).
+ */
+ void deployQueue(String name, String jndiName, int fullSize, int pageSize, int downCacheSize, int maxSize, boolean clustered) throws Exception;
+
+ /**
* Creates a queue programatically.
*/
void deployQueueProgrammatically(String name, String jndiName) throws Exception;
More information about the jboss-cvs-commits
mailing list